/* =====================================================================
   SIKURIR - Stylesheet utama
   Seluruh warna memakai CSS variable yang di-inject dari Setting Tema.
   ===================================================================== */

:root {
    --primary-color:    #0F766E;
    --secondary-color:  #14B8A6;
    --accent-color:     #F59E0B;
    --bg-color:         #F8FAFC;
    --text-color:       #0F172A;
    --sidebar-color:    #0B3B38;
    --radius:           12px;

    --muted:            #64748b;
    --border:           #e2e8f0;
    --card-bg:          #ffffff;
    --shadow-sm:        0 1px 2px rgba(15, 23, 42, .06);
    --shadow-md:        0 4px 16px rgba(15, 23, 42, .08);
    --shadow-lg:        0 12px 32px rgba(15, 23, 42, .12);
}

* { box-sizing: border-box; }

html, body { max-width: 100%; overflow-x: hidden; }

body {
    background: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: .95rem;
    line-height: 1.6;
}

a { color: var(--primary-color); text-decoration: none; }
a:hover { color: var(--secondary-color); }

/* ---------------------------------------------------------------- utils */
.text-primary-c   { color: var(--primary-color) !important; }
.text-secondary-c { color: var(--secondary-color) !important; }
.text-accent-c    { color: var(--accent-color) !important; }
.bg-primary-c     { background: var(--primary-color) !important; color: #fff !important; }
.bg-secondary-c   { background: var(--secondary-color) !important; color: #fff !important; }
.bg-accent-c      { background: var(--accent-color) !important; color: #fff !important; }
.bg-soft          { background: color-mix(in srgb, var(--primary-color) 8%, #fff); }

.rounded-c   { border-radius: var(--radius) !important; }
.shadow-c    { box-shadow: var(--shadow-md) !important; }
.fw-600      { font-weight: 600; }
.fs-13       { font-size: .8125rem; }
.fs-14       { font-size: .875rem; }
.min-w-0     { min-width: 0; }

/* ---------------------------------------------------------------- buttons */
.btn-brand {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    font-weight: 600;
    border-radius: calc(var(--radius) - 4px);
}
.btn-brand:hover, .btn-brand:focus {
    background: color-mix(in srgb, var(--primary-color) 85%, #000);
    border-color: color-mix(in srgb, var(--primary-color) 85%, #000);
    color: #fff;
}
.btn-brand-outline {
    background: transparent;
    border: 1.5px solid var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
    border-radius: calc(var(--radius) - 4px);
}
.btn-brand-outline:hover { background: var(--primary-color); color: #fff; }

.btn-accent {
    background: var(--accent-color); border-color: var(--accent-color);
    color: #1f2937; font-weight: 600; border-radius: calc(var(--radius) - 4px);
}
.btn-accent:hover { filter: brightness(.94); color: #1f2937; }

.btn { border-radius: calc(var(--radius) - 4px); }

/* ---------------------------------------------------------------- cards */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    padding: .875rem 1.125rem;
}
.card-body { padding: 1.125rem; }

.stat-card { position: relative; overflow: hidden; }
.stat-card .stat-icon {
    position: absolute; right: -6px; top: -6px;
    font-size: 3.6rem; opacity: .09; line-height: 1;
}
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat-card .stat-label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

/* ---------------------------------------------------------------- forms */
.form-control, .form-select {
    border-radius: calc(var(--radius) - 4px);
    border-color: var(--border);
    padding: .5rem .75rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--secondary-color) 25%, transparent);
}
.form-label { font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }
.required::after { content: ' *'; color: #dc2626; }

/* ------------------------------------------------------------ autocomplete */
.ac-wrap { position: relative; }
.ac-list {
    position: absolute; z-index: 1080; top: 100%; left: 0; right: 0;
    background: #fff; border: 1px solid var(--border);
    border-radius: calc(var(--radius) - 4px);
    box-shadow: var(--shadow-lg);
    max-height: 260px; overflow-y: auto; display: none;
    margin-top: 2px;
}
.ac-list .ac-item { padding: .5rem .75rem; cursor: pointer; font-size: .85rem; border-bottom: 1px solid #f1f5f9; }
.ac-list .ac-item:last-child { border-bottom: 0; }
.ac-list .ac-item:hover, .ac-list .ac-item.active { background: color-mix(in srgb, var(--primary-color) 10%, #fff); }
.ac-list .ac-item small { color: var(--muted); display: block; }
.ac-list .ac-empty { padding: .625rem .75rem; color: var(--muted); font-size: .85rem; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { font-size: .875rem; margin-bottom: 0; }
.table > thead > tr > th {
    background: color-mix(in srgb, var(--primary-color) 7%, #fff);
    color: var(--text-color);
    font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .02em;
    white-space: nowrap; border-bottom: 1px solid var(--border);
}
.table > tbody > tr > td { vertical-align: middle; }
.table-hover > tbody > tr:hover > * { background: color-mix(in srgb, var(--primary-color) 5%, #fff); }

.awb-link { font-family: 'SFMono-Regular', Consolas, monospace; font-weight: 600; letter-spacing: .02em; }

/* ================================================================ PANEL */
.panel-body { min-height: 100vh; }

.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 260px; z-index: 1040;
    background: var(--sidebar-color);
    color: rgba(255,255,255,.85);
    display: flex; flex-direction: column;
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: .625rem;
    padding: 1rem 1.125rem; border-bottom: 1px solid rgba(255,255,255,.1);
    color: #fff; font-weight: 700; font-size: 1.05rem;
}
.sidebar-brand img { height: 34px; width: auto; max-width: 130px; object-fit: contain; }
.sidebar-brand .brand-mark {
    width: 34px; height: 34px; border-radius: 9px; flex: 0 0 34px;
    background: var(--secondary-color); color: #fff;
    display: grid; place-items: center; font-weight: 800; font-size: 1rem;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem .625rem 2rem; }
.sidebar-nav .nav-section {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
    color: rgba(255,255,255,.4); padding: .875rem .75rem .375rem;
}
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: .625rem;
    color: rgba(255,255,255,.8); padding: .5rem .75rem;
    border-radius: 9px; font-size: .875rem; margin-bottom: 2px;
}
.sidebar-nav .nav-link i { font-size: 1rem; width: 20px; text-align: center; flex: 0 0 20px; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.09); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--primary-color); color: #fff; font-weight: 600; }
.sidebar-footer { padding: .75rem 1.125rem; border-top: 1px solid rgba(255,255,255,.1); font-size: .75rem; color: rgba(255,255,255,.5); }

.sidebar-backdrop {
    position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 1035; display: none;
}
.sidebar-backdrop.show { display: block; }

.main-wrap { margin-left: 260px; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 1030;
    background: #fff; border-bottom: 1px solid var(--border);
    padding: .625rem 1.25rem;
    display: flex; align-items: center; gap: .75rem;
}
.topbar .page-title { font-weight: 700; font-size: 1.02rem; margin: 0; }
.topbar .page-sub   { font-size: .78rem; color: var(--muted); margin: 0; }

.content { padding: 1.25rem; flex: 1; }
.page-footer { padding: .875rem 1.25rem; border-top: 1px solid var(--border); font-size: .78rem; color: var(--muted); background: #fff; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main-wrap { margin-left: 0; }
    .content { padding: 1rem .875rem; }
}

/* ================================================================ PUBLIC */
.navbar-public {
    background: #fff; border-bottom: 1px solid var(--border);
    padding: .625rem 0;
}
.navbar-public .navbar-brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; color: var(--primary-color); }
.navbar-public .navbar-brand img { height: 38px; width: auto; max-width: 150px; object-fit: contain; }
.navbar-public .brand-mark {
    width: 38px; height: 38px; border-radius: 10px; flex: 0 0 38px;
    background: var(--primary-color); color: #fff; display: grid; place-items: center;
    font-weight: 800; font-size: 1.05rem;
}
.navbar-public .nav-link { font-weight: 500; color: #334155; padding: .5rem .8rem !important; }
.navbar-public .nav-link:hover, .navbar-public .nav-link.active { color: var(--primary-color); }

.hero {
    background:
        radial-gradient(1000px 420px at 88% -10%, color-mix(in srgb, var(--secondary-color) 35%, transparent), transparent 60%),
        linear-gradient(135deg, var(--primary-color) 0%, color-mix(in srgb, var(--primary-color) 55%, var(--sidebar-color)) 100%);
    color: #fff; padding: 3.5rem 0 4rem; position: relative; overflow: hidden;
}
.hero h1 { font-weight: 800; font-size: clamp(1.65rem, 4.2vw, 2.75rem); line-height: 1.2; }
.hero p.lead { color: rgba(255,255,255,.9); font-size: clamp(.95rem, 2.2vw, 1.08rem); }

.hero-card {
    background: #fff; color: var(--text-color);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: 1.25rem;
}
.hero-card .nav-tabs { border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.hero-card .nav-tabs .nav-link { border: 0; color: var(--muted); font-weight: 600; font-size: .875rem; padding: .5rem .875rem; }
.hero-card .nav-tabs .nav-link.active {
    color: var(--primary-color); background: transparent;
    border-bottom: 2.5px solid var(--primary-color);
}

.section { padding: 3rem 0; }
.section-title { font-weight: 800; font-size: clamp(1.3rem, 3.2vw, 1.85rem); margin-bottom: .5rem; }
.section-sub   { color: var(--muted); margin-bottom: 2rem; }

.feature-card { height: 100%; transition: transform .18s ease, box-shadow .18s ease; }
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.feature-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: color-mix(in srgb, var(--primary-color) 12%, #fff);
    color: var(--primary-color);
    display: grid; place-items: center; font-size: 1.4rem; margin-bottom: .875rem;
}

.public-footer { background: var(--sidebar-color); color: rgba(255,255,255,.75); padding: 2.5rem 0 1.25rem; margin-top: 2rem; }
.public-footer h6 { color: #fff; font-weight: 700; margin-bottom: .875rem; }
.public-footer a { color: rgba(255,255,255,.75); }
.public-footer a:hover { color: #fff; }
.public-footer .footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 1.75rem; padding-top: 1rem; font-size: .82rem; }

/* ---------------------------------------------------------------- timeline */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
    content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px;
    width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 1.25rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item .tl-dot {
    position: absolute; left: -2rem; top: 2px;
    width: 20px; height: 20px; border-radius: 50%;
    background: #fff; border: 2px solid var(--border);
    display: grid; place-items: center; font-size: .6rem; color: var(--muted);
}
.timeline-item.done .tl-dot { border-color: var(--primary-color); background: var(--primary-color); color: #fff; }
.timeline-item.current .tl-dot {
    border-color: var(--accent-color); background: var(--accent-color); color: #fff;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-color) 25%, transparent);
}
.timeline-item .tl-title { font-weight: 600; font-size: .9rem; margin: 0; }
.timeline-item .tl-meta  { font-size: .78rem; color: var(--muted); }

/* ---------------------------------------------------------------- login */
.login-page {
    min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
    background:
        radial-gradient(900px 400px at 15% 0%, color-mix(in srgb, var(--secondary-color) 28%, transparent), transparent 55%),
        linear-gradient(135deg, var(--sidebar-color), var(--primary-color));
}
.login-card { width: 100%; max-width: 420px; border-radius: var(--radius); box-shadow: var(--shadow-lg); border: 0; }

/* ---------------------------------------------------------------- misc */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.6rem; opacity: .35; display: block; margin-bottom: .625rem; }

.pagination { --bs-pagination-color: var(--primary-color); --bs-pagination-active-bg: var(--primary-color); --bs-pagination-active-border-color: var(--primary-color); margin-bottom: 0; }
.pagination .page-link { border-radius: 8px; margin: 0 2px; border-color: var(--border); font-size: .85rem; }

.badge-soft { background: color-mix(in srgb, var(--primary-color) 12%, #fff); color: var(--primary-color); font-weight: 600; }

.agent-item { cursor: pointer; border: 1px solid var(--border); border-radius: var(--radius); padding: .875rem; margin-bottom: .625rem; transition: all .15s; }
.agent-item:hover, .agent-item.active { border-color: var(--primary-color); background: color-mix(in srgb, var(--primary-color) 5%, #fff); }

#agentMap, #adminMap { height: 480px; border-radius: var(--radius); z-index: 1; }

.spinner-overlay {
    position: fixed; inset: 0; background: rgba(255,255,255,.7);
    display: none; place-items: center; z-index: 2000;
}
.spinner-overlay.show { display: grid; }

@media (max-width: 575.98px) {
    .stat-card .stat-value { font-size: 1.3rem; }
    .section { padding: 2rem 0; }
    .hero { padding: 2.25rem 0 2.75rem; }
    .card-body { padding: .9rem; }
    #agentMap, #adminMap { height: 320px; }
}
