/* =========================================================================
   AERO Maintenance Fee — Design System
   ========================================================================= */
:root {
    --brand-500: #1d9bf0;
    --brand-600: #0a6cff;
    --brand-700: #0a4fd6;
    --brand-grad: linear-gradient(135deg, #1d9bf0 0%, #0a6cff 55%, #5b46f0 100%);
    --accent-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

    --ink-900: #0f172a;
    --ink-700: #334155;
    --ink-500: #64748b;
    --ink-400: #94a3b8;
    --line: #e6ebf2;
    --bg: #f4f7fb;
    --surface: #ffffff;

    --green-50: #e9f9ef;  --green-600: #15a04f;
    --amber-50: #fff5e6;  --amber-600: #d98300;
    --red-50: #fdeaea;    --red-600: #dc3545;
    --indigo-50:#eef0ff;  --indigo-600:#5b46f0;

    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, .08);
    --shadow-lg: 0 18px 50px rgba(15, 23, 42, .14);
    --sidebar-w: 264px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink-900);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-600); text-decoration: none; }
h1,h2,h3,h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }

/* ---- Layout ----------------------------------------------------------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: #0b1424;
    color: #cbd5e1;
    position: fixed;
    inset: 0 auto 0 0;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    z-index: 60;
    transition: transform .32s cubic-bezier(.4,0,.2,1);
    background-image: radial-gradient(900px 400px at -10% -10%, rgba(29,155,240,.18), transparent 60%);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 4px 20px; }
.brand-logo { width: 100%; height: auto; background: #fff; padding: 9px 12px; border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.brand .logo {
    width: 40px; height: 40px; border-radius: 12px;
    background: var(--brand-grad); display: grid; place-items: center;
    color: #fff; font-weight: 800; font-size: 19px; box-shadow: 0 6px 18px rgba(10,108,255,.45);
}
.brand .name { color: #fff; font-weight: 800; font-size: 17px; line-height: 1; }
.brand .name small { display: block; color: #7c8aa3; font-weight: 500; font-size: 10.5px; margin-top: 3px; letter-spacing: .03em; }

.nav-section { color: #5b6982; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 18px 12px 8px; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10.5px 12px; border-radius: 11px; color: #aab6c8;
    font-weight: 500; margin-bottom: 2px; transition: all .18s ease; position: relative;
}
.nav-link i { font-size: 17px; width: 20px; text-align: center; }
.nav-link:hover { background: rgba(255,255,255,.06); color: #fff; transform: translateX(2px); }
.nav-link.active { background: var(--brand-grad); color: #fff; box-shadow: 0 8px 20px rgba(10,108,255,.35); }
.nav-link .badge-mini {
    margin-left: auto; background: #ef4444; color: #fff; font-size: 10.5px;
    font-weight: 700; padding: 1px 7px; border-radius: 999px;
}
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.07); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 11px; }
.user-chip .avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--accent-grad);
    color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.user-chip .meta b { color: #fff; font-size: 13px; display: block; }
.user-chip .meta span { color: #6b7a93; font-size: 11.5px; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 14px;
    padding: 14px 26px; background: rgba(244,247,251,.82);
    backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 19px; }
.topbar .crumb { color: var(--ink-400); font-size: 12.5px; font-weight: 500; }
.hamburger { display: none; background: var(--surface); border: 1px solid var(--line); width: 40px; height: 40px; border-radius: 11px; font-size: 19px; cursor: pointer; }
.content { padding: 26px;  }

/* ---- Cards ------------------------------------------------------------ */
.card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 22px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 15.5px; }
.card-head .sub { color: var(--ink-500); font-size: 12.5px; font-weight: 500; }

/* ---- Stat cards ------------------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.stat {
    position: relative; overflow: hidden;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
    transition: transform .25s ease, box-shadow .25s ease;
}
.stat:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.stat .ico {
    width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
    font-size: 22px; margin-bottom: 14px;
}
.stat .ico.blue { background: #e7f1ff; color: var(--brand-600); }
.stat .ico.green { background: var(--green-50); color: var(--green-600); }
.stat .ico.amber { background: var(--amber-50); color: var(--amber-600); }
.stat .ico.indigo { background: var(--indigo-50); color: var(--indigo-600); }
.stat .label { color: var(--ink-500); font-size: 12.5px; font-weight: 600; }
.stat .value { font-size: 25px; font-weight: 800; letter-spacing: -.02em; margin-top: 3px; }
.stat .value.sm { font-size: 20px; }
.stat::after { content: ''; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--brand-grad); opacity: .05; }
/* Inline variant: icon on the left, label + value stacked to its right */
.stat.inline { display: flex; align-items: center; gap: 15px; }
.stat.inline .ico { margin-bottom: 0; flex-shrink: 0; }
.stat.inline .value { margin-top: 1px; }
.stat.inline > div:last-child { min-width: 0; }

/* ---- Buttons ---------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
    padding: 10px 16px; border-radius: 11px; font-weight: 600; font-size: 13.5px;
    border: 1px solid transparent; cursor: pointer; transition: all .18s ease; white-space: nowrap;
}
.btn i { font-size: 16px; }
.btn-primary { background: var(--brand-grad); color: #fff; box-shadow: 0 8px 20px rgba(10,108,255,.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(10,108,255,.42); color:#fff; }
.btn-light { background: var(--surface); color: var(--ink-700); border-color: var(--line); }
.btn-light:hover { background: #f8fafc; border-color: #cdd6e4; color: var(--ink-900); }
.btn-ghost { background: transparent; color: var(--ink-500); }
.btn-ghost:hover { background: #eef2f7; color: var(--ink-900); }
.btn-success { background: var(--green-600); color: #fff; }
.btn-success:hover { filter: brightness(1.06); color:#fff; }
.btn-danger { background: var(--red-50); color: var(--red-600); border-color: #f6cccc; }
.btn-danger:hover { background: var(--red-600); color: #fff; }
.btn-sm { padding: 7px 11px; font-size: 12.5px; border-radius: 9px; }
.btn-block { width: 100%; }

/* ---- Tables ----------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
    text-align: left; padding: 13px 18px; color: var(--ink-500);
    font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--line); background: #fbfcfe; white-space: nowrap;
}
table.tbl td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr { transition: background .15s ease; }
table.tbl tbody tr:hover { background: #f8fbff; }
.t-strong { font-weight: 700; color: var(--ink-900); }
.t-muted { color: var(--ink-500); font-size: 12.5px; }

/* ---- Badges & chips --------------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px;
    border-radius: 999px; font-size: 11.5px; font-weight: 700;
}
.badge i { font-size: 13px; }
.badge-paid { background: var(--green-50); color: var(--green-600); }
.badge-unpaid { background: var(--amber-50); color: var(--amber-600); }
.badge-overdue { background: var(--red-50); color: var(--red-600); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 8px; font-size: 11.5px; font-weight: 600; background: #eef2f7; color: var(--ink-700); }
.chip.blue { background: #e7f1ff; color: var(--brand-600); }
.chip.indigo { background: var(--indigo-50); color: var(--indigo-600); }
.chip.green { background: var(--green-50); color: var(--green-600); }

/* ---- Forms ------------------------------------------------------------ */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 12.5px; color: var(--ink-700); margin-bottom: 7px; }
.field label .req { color: var(--red-600); }
.input, .select, textarea.input {
    width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit; background: #fff; color: var(--ink-900);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, textarea.input:focus {
    outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3.5px rgba(29,155,240,.16);
}
.input-group { position: relative; }
.input-group .prefix { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-400); font-weight: 600; pointer-events: none; }
.input-group .input { padding-left: 38px; }
.help { font-size: 11.5px; color: var(--ink-400); margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .col-span-2 { grid-column: 1 / -1; }

/* ---- Segmented period selector --------------------------------------- */
.seg { display: flex; flex-wrap: wrap; gap: 10px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
    cursor: pointer; padding: 12px 4px; border: 1.5px solid var(--line); border-radius: 12px;
    text-align: center; font-weight: 700; transition: all .18s ease; flex: 1; min-width: 72px;
    display: flex; flex-direction: column; gap: 2px; margin: 0;
}
.seg label small { font-weight: 600; font-size: 10.5px; color: var(--ink-400); }
.seg label:hover { border-color: var(--brand-500); }
.seg input:checked + label { border-color: var(--brand-600); background: #eef5ff; color: var(--brand-700); box-shadow: 0 6px 16px rgba(10,108,255,.15); transform: translateY(-2px); }
.seg input:checked + label small { color: var(--brand-600); }

/* ---- Alerts ----------------------------------------------------------- */
.alert { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: var(--radius-sm); font-weight: 500; font-size: 13.5px; margin-bottom: 18px; }
.alert i { font-size: 18px; }
.alert-success { background: var(--green-50); color: var(--green-600); }
.alert-error { background: var(--red-50); color: var(--red-600); }
.alert-info { background: #e7f1ff; color: var(--brand-700); }

/* ---- Empty state ------------------------------------------------------ */
.empty { text-align: center; padding: 54px 20px; color: var(--ink-400); }
.empty i { font-size: 46px; color: #cbd5e1; }
.empty h4 { color: var(--ink-700); margin: 14px 0 5px; }

/* ---- Page header ------------------------------------------------------ */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .ttl { font-size: 22px; }
.page-head .desc { color: var(--ink-500); font-size: 13.5px; margin-top: 3px; }

/* ---- Toolbar / filters ----------------------------------------------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 3px; }
.tabs a { padding: 8px 15px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--ink-500); }
.tabs a.active { background: var(--brand-grad); color: #fff; }

/* ---- Checkbox toggle for paid ---------------------------------------- */
.pay-toggle { display: inline-flex; align-items: center; cursor: pointer; }
.pay-toggle input { display: none; }
.pay-toggle .track { width: 44px; height: 25px; border-radius: 999px; background: #d6dde8; position: relative; transition: background .2s; }
.pay-toggle .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .22s cubic-bezier(.4,0,.2,1); }
.pay-toggle input:checked + .track { background: var(--green-600); }
.pay-toggle input:checked + .track::after { transform: translateX(19px); }

/* ---- Invoice preview (screen) ----------------------------------------- */
.invoice-sheet { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 46px; max-width: 760px; margin: 0 auto; }

/* ---- Toast notifications ---------------------------------------------- */
#aero-toasts { position: fixed; top: 18px; right: 18px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.aero-toast {
    display: flex; align-items: center; gap: 10px;
    background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--green-600);
    box-shadow: var(--shadow-lg); border-radius: 12px; padding: 12px 16px;
    font-size: 13.5px; font-weight: 500; color: var(--ink-900); min-width: 240px; max-width: 380px;
    transform: translateX(120%); opacity: 0; transition: transform .32s cubic-bezier(.22,.61,.36,1), opacity .32s;
}
.aero-toast.show { transform: translateX(0); opacity: 1; }
.aero-toast i { font-size: 18px; color: var(--green-600); flex-shrink: 0; }
.aero-toast.error { border-left-color: var(--red-600); }
.aero-toast.error i { color: var(--red-600); }
.aero-toast.info { border-left-color: var(--brand-600); }
.aero-toast.info i { color: var(--brand-600); }
.aero-toast a { margin-left: auto; font-weight: 700; white-space: nowrap; }
@media (max-width: 540px) { #aero-toasts { left: 12px; right: 12px; top: 12px; } .aero-toast { min-width: 0; max-width: none; } }

/* ---- Animations ------------------------------------------------------- */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.animate { opacity: 0; animation: fadeUp .5s cubic-bezier(.22,.61,.36,1) forwards; }
.d1{animation-delay:.05s}.d2{animation-delay:.1s}.d3{animation-delay:.15s}.d4{animation-delay:.2s}.d5{animation-delay:.25s}.d6{animation-delay:.3s}
@keyframes pop { 0%{transform:scale(.96);opacity:0} 100%{transform:scale(1);opacity:1} }

/* ---- Misc ------------------------------------------------------------- */
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.ml-auto { margin-left: auto; } .mt-3 { margin-top: 14px; } .mb-0 { margin-bottom: 0; } .text-right { text-align: right; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.overlay { display: none; position: fixed; inset: 0; background: rgba(8,13,24,.5); z-index: 55; backdrop-filter: blur(2px); }

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 1024px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main { margin-left: 0; }
    .hamburger { display: grid; place-items: center; }
    .overlay.show { display: block; }
    .grid-2, .form-grid { grid-template-columns: 1fr; }
    .content { padding: 18px; }
    .topbar { padding: 12px 16px; }
}
/* Stat cards: 1 kolom penuh di mobile agar nominal tidak terpotong.
   !important untuk override grid inline (repeat(3,1fr)) di halaman invoice/client/recurring. */
@media (max-width: 600px) {
    .stat-grid { grid-template-columns: 1fr !important; gap: 12px; }
}
@media (max-width: 540px) {
    .stat { padding: 15px; }
    .stat .value { font-size: 21px; }
    .invoice-sheet { padding: 22px; }
    .page-head .ttl { font-size: 19px; }
}
