:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --border: #e2e5ea;
    --ink: #1d2430;
    --ink-soft: #5a6573;
    --muted: #8a93a2;
    --primary: #1f4e79;
    --primary-dark: #163a5a;
    --accent: #b9892f;
    --success: #1e7d4f;
    --warning: #b5870b;
    --danger: #c0392b;
    --critical: #7d1f1f;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(20, 30, 50, .08), 0 1px 2px rgba(20, 30, 50, .04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
}

/* Warna seleksi teks agar selalu terbaca (tidak putih saat di-blok). */
::selection { background: #cfe0ef; color: #14181f; }
::-moz-selection { background: #cfe0ef; color: #14181f; }

.container { width: min(1080px, 92vw); margin: 0 auto; }

/* Topbar */
.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--primary); text-decoration: none; }
.brand-mark {
    display: inline-grid; place-items: center;
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--primary); color: #fff; font-size: 1.1rem;
}
.brand-logo { height: 34px; width: auto; display: block; }
.topnav { display: flex; align-items: center; gap: 18px; }
.topnav a { color: var(--ink-soft); text-decoration: none; font-weight: 500; }
.topnav a:hover { color: var(--primary); }

/* Hero */
.hero { padding: 36px 0 8px; }
.hero h1 { font-size: 1.9rem; margin: 0 0 8px; color: var(--ink); }
.hero p { color: var(--ink-soft); max-width: 760px; margin: 0; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
    margin: 18px 0;
}
.card h2 { margin: 0 0 16px; font-size: 1.25rem; }
.card h3 { font-size: 1.02rem; margin: 0 0 6px; }

/* Forms */
.form-row { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-weight: 600; font-size: .92rem; }
.form-row input[type=text], .form-row select, .form-row input[type=file] {
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
    font-size: .95rem; background: #fff; color: var(--ink);
}
.form-row input:focus, .form-row select:focus { outline: 2px solid rgba(31,78,121,.25); border-color: var(--primary); }
.hint, .small { font-size: .82rem; }
.hint { color: var(--muted); }
.form-actions { margin-top: 8px; }

/* Buttons */
.btn {
    display: inline-block; cursor: pointer; border: 1px solid var(--border);
    background: #fff; color: var(--ink); padding: 9px 16px; border-radius: 8px;
    font-size: .92rem; font-weight: 600; text-decoration: none; transition: .15s;
    -webkit-user-select: none; user-select: none;
}
.btn:hover { background: #f0f2f5; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .65; cursor: default; }
.btn-sm { padding: 6px 12px; font-size: .82rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tr:last-child td { border-bottom: none; }
.doc-title { font-weight: 600; color: var(--primary); text-decoration: none; }
.doc-title:hover { text-decoration: underline; }
.row-actions { white-space: nowrap; }

/* Badges */
.badge {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: .76rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap;
}
.badge-lg { display: inline-block; padding: 8px 18px; border-radius: 999px; font-size: 1rem; font-weight: 700; }
.badge-success { background: #e6f4ec; color: var(--success); }
.badge-warning { background: #fbf2dc; color: var(--warning); }
.badge-danger { background: #fceae8; color: var(--danger); }
.badge-critical { background: #f6dada; color: var(--critical); }
.badge-muted { background: #eef0f3; color: var(--ink-soft); }

/* Scores */
.score { display: inline-grid; place-items: center; min-width: 34px; height: 28px; padding: 0 8px; border-radius: 6px; font-weight: 700; font-size: .85rem; }
.score-good, .score-value.score-good { color: var(--success); }
.score-mid, .score-value.score-mid { color: var(--warning); }
.score-bad, .score-value.score-bad { color: var(--danger); }
.score-muted, .score-value.score-muted { color: var(--muted); }

.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-top: 18px; }
.score-card { background: #f8f9fb; border: 1px solid var(--border); border-radius: 8px; padding: 14px; text-align: center; }
.score-value { font-size: 1.8rem; font-weight: 800; }
.score-name { font-size: .8rem; color: var(--muted); margin-top: 2px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; margin: 16px 0; font-size: .92rem; }
.alert-success { background: #e6f4ec; color: var(--success); border: 1px solid #bfe2cd; }
.alert-danger { background: #fceae8; color: var(--danger); border: 1px solid #f3c6c0; }
.alert-processing { background: #fbf2dc; color: #946f08; border: 1px solid #ecdcb6; display: flex; align-items: center; gap: 12px; }
.spinner { width: 18px; height: 18px; border: 3px solid #e3cf95; border-top-color: #946f08; border-radius: 50%; animation: spin .8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Misc layout */
.empty, .muted { color: var(--muted); }
.muted.small, .small { color: var(--muted); }
.breadcrumb a { color: var(--ink-soft); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }
.hero + .upload-card { margin-top: 16px; }

.doc-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.doc-header h1 { margin: 0 0 8px; font-size: 1.5rem; }
.doc-header-actions { display: flex; align-items: center; gap: 8px; }
.doc-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Review summary */
.review-top { display: flex; gap: 24px; justify-content: space-between; flex-wrap: wrap; }
.review-top > div:first-child { flex: 1 1 420px; }
.review-doctype { color: var(--ink-soft); }
.risk-box { text-align: center; padding: 6px 0; }
.risk-label { font-size: .8rem; color: var(--muted); margin-bottom: 8px; }

/* Parties */
.party-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }
.party { background: #f8f9fb; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }
.party-name { font-weight: 700; }
.party-role { color: var(--accent); font-size: .85rem; font-weight: 600; }

.def-list { display: grid; grid-template-columns: 180px 1fr; gap: 6px 16px; margin: 0; }
.def-list dt { font-weight: 600; color: var(--ink-soft); }
.def-list dd { margin: 0; }

/* Clauses */
.clause-list { display: flex; flex-direction: column; gap: 14px; }
.clause { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; background: #fcfcfd; }
.clause-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.clause p { margin: 6px 0; }
.reco { color: var(--primary-dark); }
.draft {
    margin: 8px 0 0; padding: 12px 14px; background: #f4f7fb;
    border-left: 3px solid var(--primary); border-radius: 4px;
    font-family: Georgia, "Times New Roman", serif; color: var(--ink);
}

/* Hak & Kewajiban */
.hk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.hk { border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; }
.hk h3 { color: var(--primary); }
.hk-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hk-cols h4 { margin: 6px 0; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.hk-cols ul { margin: 0; padding-left: 18px; }
.hk-cols li { margin-bottom: 4px; }

/* Callouts */
.callout { background: #f4f7fb; border: 1px solid #d8e2ee; border-radius: 8px; padding: 14px 16px; margin-top: 16px; }
.callout-strong { background: #fbf7ee; border-color: #ecdcb6; }
.callout-strong h3 { color: var(--accent); }

.finding-list { display: flex; flex-direction: column; gap: 12px; }
.finding { border-left: 3px solid var(--danger); background: #fdf6f5; padding: 10px 14px; border-radius: 4px; }
.finding p { margin: 4px 0; }

.disclaimer { font-size: .82rem; color: var(--muted); font-style: italic; text-align: center; margin: 8px 0 28px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 36px; padding: 22px 0; color: var(--muted); font-size: .85rem; }

/* ============================================================
   Button variants
   ============================================================ */
.btn-lg { padding: 13px 26px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.5); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.12); }
.btn-light { background: #fff; border-color: #fff; color: var(--primary); }
.btn-light:hover { background: #eef2f7; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }

/* ============================================================
   User menu (topbar)
   ============================================================ */
.user-menu { position: relative; }
.user-avatar {
    display: inline-grid; place-items: center; width: 36px; height: 36px;
    border-radius: 50%; background: var(--primary); color: #fff;
    font-weight: 700; cursor: pointer; user-select: none;
}
.user-dropdown {
    position: absolute; right: 0; top: 46px; min-width: 220px;
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(20,30,50,.14); padding: 8px;
    opacity: 0; visibility: hidden; transform: translateY(-6px); transition: .15s; z-index: 20;
}
.user-menu:hover .user-dropdown,
.user-menu:focus-within .user-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.user-info { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; display: flex; flex-direction: column; }
.dropdown-link {
    display: block; width: 100%; text-align: left; background: none; border: none; cursor: pointer;
    padding: 9px 12px; border-radius: 6px; font-size: .9rem; color: var(--ink); font-weight: 500;
    text-decoration: none;
}
.dropdown-link:hover { background: #f0f2f5; }
form .dropdown-link:hover { color: var(--danger); }

.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 760px) { .profile-grid { grid-template-columns: 1fr; } }

/* Filter bar */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.filter-bar input, .filter-bar select {
    padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: .9rem; background: #fff;
}
.filter-search { flex: 1 1 240px; min-width: 180px; }
.btn-clear { color: var(--ink-soft); }

/* Email card */
.email-card { border-left: 3px solid var(--primary); }
.email-card h2 { margin-bottom: 6px; }

/* ============================================================
   Landing page — gaya Finaria (terang, hero tengah, aksen hijau)
   ============================================================ */
.page-fluid { width: 100%; background: #f6f7f9; }

/* Tema hijau khusus halaman landing (header + isi) */
.theme-green { --primary: #15803d; --primary-dark: #11652f; --accent: #15803d; }
body.theme-green { background: #f6f7f9; }

/* Hero tengah */
.fn-hero { text-align: center; padding: 84px 0 60px; }
.fn-hero h1 {
    font-size: clamp(2.4rem, 6vw, 4.4rem); line-height: 1.07; letter-spacing: -.025em;
    font-weight: 800; color: #14181f; margin: 0 auto 22px; max-width: 17ch;
}
.fn-hero h1 .accent { color: var(--primary); }
.fn-lead { font-size: 1.14rem; color: #5b6573; line-height: 1.62; max-width: 720px; margin: 0 auto 34px; }
.fn-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* Kartu fitur */
.fn-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; padding-bottom: 88px; }
.fn-card {
    background: #fff; border: 1px solid #e7e9ee; border-radius: 16px; padding: 28px 26px;
    box-shadow: 0 1px 2px rgba(20,30,50,.04); transition: .18s;
}
.fn-card:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(20,30,50,.10); }
.fn-card h3 { margin: 0 0 10px; font-size: 1.2rem; color: #14181f; }
.fn-card p { margin: 0; color: #6b7280; font-size: .98rem; line-height: 1.6; }

@media (max-width: 820px) {
    .fn-hero { padding: 56px 0 44px; }
    .fn-features { grid-template-columns: 1fr; max-width: 460px; margin: 0 auto; }
}

/* ============================================================
   Auth (login / register) split-screen
   ============================================================ */
.auth-body { background: #f4f5f7; }
.auth-split { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.auth-aside {
    background: radial-gradient(900px 500px at 20% 0%, #2c6aa0 0%, transparent 60%),
                linear-gradient(160deg, #163a5a 0%, #1f4e79 100%);
    color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
}
.brand-light { color: #fff; }
.auth-aside-content h2 { font-size: 1.9rem; line-height: 1.25; max-width: 420px; }
.auth-points { list-style: none; padding: 0; margin: 24px 0 0; }
.auth-points li { padding: 8px 0 8px 30px; position: relative; color: #dbe6f1; }
.auth-points li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 800; }
.auth-aside-foot { color: #aac3da; font-size: .82rem; margin: 0; }

.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(420px, 100%); }
.auth-card h1 { font-size: 1.7rem; margin: 0 0 6px; }
.auth-subtitle { color: var(--ink-soft); margin: 0 0 26px; }
.auth-form .form-row { margin-bottom: 16px; }
.auth-alt { text-align: center; margin-top: 20px; color: var(--ink-soft); }
.auth-alt a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* ============================================================
   Dashboard
   ============================================================ */
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 28px 0 6px; }
.dash-head h1 { margin: 0 0 4px; font-size: 1.7rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 16px 0; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px 20px; display: flex; align-items: center; gap: 14px;
}
.stat-icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; font-size: 1.4rem; }
.icon-blue { background: #eaf1f8; color: var(--primary); }
.icon-green { background: #e6f4ec; color: var(--success); }
.icon-amber { background: #fbf2dc; color: var(--warning); }
.icon-red { background: #fceae8; color: var(--danger); }
.stat-num { font-size: 1.7rem; font-weight: 800; line-height: 1; }
.stat-label { font-size: .82rem; color: var(--muted); margin-top: 4px; }

@media (max-width: 860px) {
    .auth-split { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
}
@media (max-width: 640px) {
    .hk-cols { grid-template-columns: 1fr; }
    .def-list { grid-template-columns: 1fr; }
    .doc-header { flex-direction: column; }
    .form-grid-2 { grid-template-columns: 1fr; }
    .fn-hero h1 { font-size: 2.1rem; }
}