:root {
    --bg: #f4f6fb;
    --card: #ffffff;
    --ink: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --brand: #0d9488;
    --brand-dark: #0f766e;
    --danger: #dc2626;
    --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
}
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px; }

/* Topbar */
.topbar { background: var(--brand); color: #fff; box-shadow: var(--shadow); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 17px; }
.topbar nav { display: flex; gap: 18px; align-items: center; }
.topbar nav a { color: #e6fffb; text-decoration: none; font-size: 14px; }
.topbar nav a:hover { color: #fff; }

main.wrap { padding-top: 24px; padding-bottom: 40px; }
h1 { font-size: 24px; margin: 8px 0 4px; }
h2 { font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }

/* Buttons */
.btn {
    display: inline-block; background: var(--brand); color: #fff; border: 0;
    padding: 9px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
    text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--brand-dark); }
.btn-sm { padding: 5px 11px; font-size: 13px; background: rgba(255,255,255,.18); }
.btn-sm:hover { background: rgba(255,255,255,.3); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.link { color: var(--brand-dark); text-decoration: none; background: none; border: 0; cursor: pointer; font-size: 14px; padding: 0; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--danger); }

.flash { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; padding: 10px 14px; border-radius: 8px; margin-bottom: 18px; }
.empty { background: var(--card); border: 1px dashed var(--line); padding: 26px; border-radius: 10px; text-align: center; color: var(--muted); }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 12px; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 18px 0; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); font-size: 13px; color: var(--muted); }
.stat .num { display: block; font-size: 26px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.stat .num small { font-size: 14px; color: var(--muted); margin-left: 2px; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 5px; padding-top: 5px; border-top: 1px dashed var(--line); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.card:hover { border-color: var(--brand); }
.card-title { font-weight: 700; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; flex: 0 0 auto; }
.avatar.big { width: 64px; height: 64px; font-size: 26px; }

/* Member head */
.member-head { display: flex; gap: 18px; align-items: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); }
.member-head h1 { margin: 0 0 2px; }
.member-head > .head-actions { margin-left: auto; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; text-align: right; }
.note-box { margin-top: 8px; background: #fffbeb; border: 1px solid #fde68a; padding: 8px 12px; border-radius: 8px; font-size: 13px; }

/* Tabs */
.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin: 24px 0 18px; }
.tabs a { padding: 9px 16px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabs a.active { color: var(--brand-dark); border-bottom-color: var(--brand); }

/* Forms */
.form { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; box-shadow: var(--shadow); }
.form label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 14px; }
.form input, .form select, .form textarea { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; font-weight: 400; background: #fff; }
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }

/* Add box */
.add { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 20px; box-shadow: var(--shadow); }
.add > summary { padding: 14px 18px; font-weight: 600; cursor: pointer; color: var(--brand-dark); }
.add[open] > summary { border-bottom: 1px solid var(--line); }
.add .form { border: 0; box-shadow: none; }

/* Tables */
.scroll-x { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.tbl th, .tbl td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; white-space: nowrap; }
.tbl th { background: #f9fafb; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl a { color: var(--brand-dark); text-decoration: none; }

/* Resume AI */
.ai-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 18px 0 4px; }
.btn-ai { background: linear-gradient(135deg, #7c3aed, #0d9488); }
.btn-ai:hover { background: linear-gradient(135deg, #6d28d9, #0f766e); }
.ai-box { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 24px 20px; box-shadow: var(--shadow); margin-top: 14px; }
.ai-box h3 { color: var(--brand-dark); font-size: 16px; margin: 18px 0 6px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.ai-box p { margin: 8px 0; }
.ai-box ul { margin: 6px 0; padding-left: 22px; }
.ai-box li { margin: 3px 0; }
.ai-disclaimer { margin-top: 14px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; padding: 12px 16px; border-radius: 10px; font-size: 13px; }
.ai-error { margin-top: 14px; background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: 14px 16px; border-radius: 10px; }
.resume-list { display: flex; flex-direction: column; gap: 12px; }
.resume-item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; box-shadow: var(--shadow); }
.resume-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.resume-date { font-weight: 700; color: var(--brand-dark); text-decoration: none; }
.resume-date:hover { text-decoration: underline; }
.resume-snip { color: var(--muted); font-size: 14px; margin: 6px 0 10px; }
.resume-actions { display: flex; gap: 16px; align-items: center; }

/* Penanda batas normal */
.flag i { font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 20px; margin-left: 4px; vertical-align: middle; }
.flag-high { color: #b91c1c; font-weight: 600; }
.flag-high i { background: #fee2e2; color: #b91c1c; }
.flag-warn { color: #b45309; font-weight: 600; }
.flag-warn i { background: #fef3c7; color: #b45309; }
.flag-low  { color: #1d4ed8; font-weight: 600; }
.flag-low i { background: #dbeafe; color: #1d4ed8; }

.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; vertical-align: middle; }
.chip-normal { background: #d1fae5; color: #065f46; }
.chip-warn { background: #fef3c7; color: #b45309; }
.chip-high { background: #fee2e2; color: #b91c1c; }
.chip-low  { background: #dbeafe; color: #1d4ed8; }

/* Halaman login / PIN */
.auth { max-width: 360px; margin: 40px auto; text-align: center; }
.auth-icon { font-size: 44px; }
.auth h1 { margin: 6px 0; }
.auth-form { text-align: left; margin-top: 18px; }
.auth-form .btn { width: 100%; }
.auth-form input { text-align: center; letter-spacing: 6px; font-size: 20px; }

/* Grafik */
.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 20px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.chart-head select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; font-family: inherit; background: #fff; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg .axis { font-size: 11px; fill: var(--muted); }
.chart-empty { padding: 30px; text-align: center; color: var(--muted); }
.chart-legend { display: flex; gap: 16px; justify-content: center; margin-top: 6px; font-size: 13px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.chart-note { text-align: center; font-size: 12px; color: var(--muted); margin-top: 4px; }
.chart-note i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; background: rgba(13,148,136,.18); vertical-align: middle; margin-right: 4px; }

.foot { margin-top: 30px; padding: 20px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.foot code { background: #eef2ff; padding: 1px 5px; border-radius: 4px; }

@media (max-width: 720px) {
    .stats { grid-template-columns: 1fr 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .topbar nav { gap: 12px; }
    .member-head { flex-wrap: wrap; }
    .member-head > .head-actions { margin-left: 0; flex-direction: row; align-items: flex-start; }
}
