/* ============================================================
   YPAMDR.net — Tema Putih & Biru Astra dengan motif geometris
   Font: Poppins
   ============================================================ */
:root {
    --blue:        #14579F;
    --blue-deep:   #0D3F77;
    --blue-bright: #1E6FC4;
    --blue-soft:   #E8F0FA;
    --blue-line:   #CBDCF0;
    --ink:         #1C2A3A;
    --ink-soft:    #5A6B80;
    --bg:          #F6F9FC;
    --card:        #FFFFFF;
    --border:      #E4EAF2;
    --green:       #1E8E5A;
    --green-soft:  #E3F4EC;
    --red:         #C2403A;
    --red-soft:    #FBEAE9;
    --amber:       #B97A14;
    --amber-soft:  #FCF3E3;
    --radius:      14px;
    --shadow:      0 1px 2px rgba(13, 63, 119, .06), 0 8px 24px rgba(13, 63, 119, .07);
    /* Motif geometris: lingkaran konsentris, wajik & chevron (selaras gambar PRD) */
    --motif: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='120' viewBox='0 0 240 120'%3E%3Cg fill='none' stroke='%23FFFFFF' stroke-opacity='.14' stroke-width='3'%3E%3Ccircle cx='40' cy='40' r='10'/%3E%3Ccircle cx='40' cy='40' r='20'/%3E%3Ccircle cx='40' cy='40' r='30'/%3E%3Cpath d='M120 12 148 40 120 68 92 40Z'/%3E%3Cpath d='M120 24 136 40 120 56 104 40Z'/%3E%3Cpath d='M120 34 126 40 120 46 114 40Z'/%3E%3Cpath d='M172 52l28-22 28 22M172 38l28-22 28 22M172 66l28-22 28 22'/%3E%3Ccircle cx='200' cy='96' r='8'/%3E%3Ccircle cx='200' cy='96' r='16'/%3E%3Cpath d='M40 110 56 94 72 110M40 96 56 80 72 96'/%3E%3Cpath d='M120 86 140 106 120 126 100 106Z'/%3E%3C/g%3E%3C/svg%3E");
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Poppins', system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14.5px;
    line-height: 1.55;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-bright); }

/* ============ Kerangka aplikasi ============ */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 268px;
    background: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    transition: transform .25s ease;
}

.brand {
    position: relative;
    background: linear-gradient(150deg, var(--blue-deep), var(--blue) 55%, var(--blue-bright));
    color: #fff;
    padding: 26px 22px 22px;
    overflow: hidden;
}
.brand-motif {
    position: absolute; inset: 0;
    background-image: var(--motif);
    background-size: 240px 120px;
    pointer-events: none;
}
.brand-text { position: relative; display: flex; flex-direction: column; gap: 2px; }
.brand-name { font-size: 21px; font-weight: 700; letter-spacing: .3px; }
.brand-name em { font-style: normal; font-weight: 300; opacity: .85; }
.brand-sub { font-size: 11px; font-weight: 300; letter-spacing: .6px; text-transform: uppercase; opacity: .85; }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px; }

.nav-link, .nav-group-btn {
    display: flex; align-items: center; gap: 11px;
    width: 100%;
    padding: 10px 12px;
    border: 0; background: none;
    border-radius: 10px;
    font: inherit; font-weight: 500; font-size: 13.5px;
    color: var(--ink-soft);
    cursor: pointer;
    text-align: left;
    transition: background .15s, color .15s;
}
.nav-link svg, .nav-group-btn svg { width: 19px; height: 19px; flex: none; }
.nav-link:hover, .nav-group-btn:hover { background: var(--blue-soft); color: var(--blue); }
.nav-link.active { background: var(--blue); color: #fff; }

.nav-group-btn .chev { width: 15px; height: 15px; margin-left: auto; transition: transform .2s; }
.nav-group.open .nav-group-btn .chev { transform: rotate(180deg); }
.nav-group.open .nav-group-btn { color: var(--blue); }

.nav-sub { display: none; padding: 2px 0 6px 16px; }
.nav-group.open .nav-sub { display: block; }
.nav-sub-link {
    display: block;
    padding: 7px 12px 7px 24px;
    border-left: 2px solid var(--border);
    font-size: 13px;
    color: var(--ink-soft);
    border-radius: 0 8px 8px 0;
}
.nav-sub-link:hover { color: var(--blue); background: var(--blue-soft); }
.nav-sub-link.active { color: var(--blue); border-left-color: var(--blue); font-weight: 600; background: var(--blue-soft); }

.sidebar-foot {
    border-top: 1px solid var(--border);
    padding: 14px;
    display: flex; align-items: center; gap: 10px;
}
.user-chip { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.avatar {
    width: 38px; height: 38px; flex: none;
    border-radius: 50%;
    background: var(--blue-soft); color: var(--blue);
    display: grid; place-items: center;
    font-weight: 600;
}
.user-meta { min-width: 0; display: flex; flex-direction: column; }
.user-meta strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 11px; color: var(--ink-soft); }

.main { flex: 1; margin-left: 268px; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    position: sticky; top: 0; z-index: 30;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px;
    padding: 14px 26px;
}
.page-title { font-size: 17px; font-weight: 600; flex: 1; }
.topbar-date { font-size: 12.5px; color: var(--ink-soft); }
.menu-btn { display: none; }

.icon-btn {
    width: 38px; height: 38px;
    border: 1px solid var(--border); border-radius: 10px;
    background: var(--card); color: var(--ink);
    display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 19px; height: 19px; }

.content { padding: 24px 26px 90px; max-width: 1240px; width: 100%; }

.scrim {
    display: none;
    position: fixed; inset: 0; z-index: 45;
    background: rgba(13, 63, 119, .35);
}

/* ============ Kartu, alert, badge ============ */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 22px;
    overflow: hidden;
}
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.card-head h2 { font-size: 16px; font-weight: 600; }
.card-head h3 { font-size: 14.5px; font-weight: 600; }

.count-pill {
    display: inline-block;
    background: var(--blue-soft); color: var(--blue);
    font-size: 12px; font-weight: 600;
    border-radius: 99px; padding: 2px 10px;
    vertical-align: 2px;
}

.alert { border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-size: 13.5px; }
.alert-success { background: var(--green-soft); color: var(--green); }
.alert-danger  { background: var(--red-soft); color: var(--red); }
.alert-info    { background: var(--blue-soft); color: var(--blue); }

.badge {
    display: inline-block;
    font-size: 11.5px; font-weight: 600;
    border-radius: 99px; padding: 3px 11px;
    white-space: nowrap;
}
.badge-upcoming { background: var(--amber-soft); color: var(--amber); }
.badge-ongoing  { background: var(--green-soft); color: var(--green); }
.badge-done     { background: #EDF1F6; color: var(--ink-soft); }
.badge-neutral  { background: var(--blue-soft); color: var(--blue); }

.muted { color: var(--ink-soft); }

/* ============ Tombol ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 9px 18px;
    font: inherit; font-size: 13.5px; font-weight: 500;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-bright); color: #fff; }
.btn-ghost { background: var(--card); border-color: var(--border); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--blue-line); color: var(--blue); }
.btn-sm { padding: 7px 13px; font-size: 12.5px; }

/* ============ Tabel ============ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 640px; }
.table th {
    text-align: left;
    font-size: 11px; font-weight: 600;
    letter-spacing: .7px; text-transform: uppercase;
    color: var(--ink-soft);
    background: #FAFCFE;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #FAFCFE; }
.th-act, .td-act { text-align: right; white-space: nowrap; }

.act {
    display: inline-grid; place-items: center;
    width: 31px; height: 31px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--ink-soft);
    cursor: pointer;
    margin-left: 5px;
}
.act svg { width: 15px; height: 15px; }
.act-view:hover { color: var(--blue); border-color: var(--blue-line); }
.act-edit:hover { color: var(--green); border-color: var(--green); }
.act-del:hover  { color: var(--red); border-color: var(--red); }
.inline-form { display: inline; }

.empty-state { text-align: center; padding: 38px 16px; }
.empty-state h3 { font-size: 15px; margin-bottom: 5px; }
.empty-state p { color: var(--ink-soft); font-size: 13px; margin-bottom: 14px; }

.pagination { display: flex; gap: 6px; padding: 14px 16px; flex-wrap: wrap; }
.page-btn {
    min-width: 33px; height: 33px;
    display: grid; place-items: center;
    border: 1px solid var(--border); border-radius: 9px;
    font-size: 13px; color: var(--ink-soft);
}
.page-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ============ Filter & pencarian ============ */
.list-head { gap: 10px; }
.list-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-form input {
    width: 220px;
    border: 1px solid var(--border); border-radius: 10px;
    padding: 9px 14px;
    font: inherit; font-size: 13.5px;
    background: #FAFCFE;
}
.search-form input:focus { outline: 2px solid var(--blue-line); border-color: var(--blue); }

.chips { display: flex; gap: 8px; padding: 13px 20px 0; flex-wrap: wrap; }
.chip {
    border: 1px solid var(--border); border-radius: 99px;
    padding: 5px 15px;
    font-size: 12.5px; font-weight: 500;
    color: var(--ink-soft); background: var(--card);
}
.chip.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ============ Form ============ */
.form-card { max-width: 980px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
    padding: 22px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.req { color: var(--red); }
.help { color: var(--ink-soft); font-size: 11.5px; }

.field input[type="text"], .field input[type="email"], .field input[type="number"],
.field input[type="password"], .field input[type="date"], .field input[type="time"],
.field input[type="search"], .field select, .field textarea {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 13px;
    font: inherit; font-size: 13.5px;
    background: #FAFCFE;
    color: var(--ink);
    width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid var(--blue-line);
    border-color: var(--blue);
    background: #fff;
}
.field textarea { resize: vertical; }
.field textarea.big { min-height: 190px; }
.field input[type="file"] { font-size: 13px; padding: 9px 4px; }

.current-file { font-size: 12.5px; padding-top: 3px; display: flex; flex-direction: column; gap: 3px; }
.file-link { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; }
.file-link svg { width: 13px; height: 13px; }

.form-actions { display: flex; gap: 10px; padding-top: 6px; }

.check-list {
    max-height: 230px; overflow-y: auto;
    border: 1px solid var(--border); border-radius: 10px;
    padding: 10px 13px;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px;
    background: #FAFCFE;
}
.check-item { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 2px; cursor: pointer; }
.check-item input { accent-color: var(--blue); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { display: none; }
.switch .slider {
    width: 42px; height: 24px;
    border-radius: 99px;
    background: #D6DEE9;
    position: relative;
    transition: background .2s;
    flex: none;
}
.switch .slider::after {
    content: '';
    position: absolute; top: 3px; left: 3px;
    width: 18px; height: 18px;
    border-radius: 50%; background: #fff;
    transition: left .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--blue); }
.switch input:checked + .slider::after { left: 21px; }
.switch-label { font-size: 13px; font-weight: 500; }

/* ============ Detail ============ */
.detail-list {
    display: grid;
    grid-template-columns: 230px 1fr;
    gap: 0;
    padding: 8px 0;
}
.detail-list dt {
    padding: 11px 20px;
    font-size: 12.5px; font-weight: 600;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--border);
}
.detail-list dd { padding: 11px 20px 11px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.detail-list dt:last-of-type, .detail-list dd:last-of-type { border-bottom: 0; }

/* ============ Dashboard ============ */
.hero {
    position: relative;
    border-radius: var(--radius);
    background: linear-gradient(140deg, var(--blue-deep), var(--blue) 60%, var(--blue-bright));
    color: #fff;
    padding: 30px 28px;
    margin-bottom: 22px;
    overflow: hidden;
}
.hero::before {
    content: '';
    position: absolute; inset: 0;
    background-image: var(--motif);
    background-size: 240px 120px;
}
.hero > * { position: relative; }
.hero h2 { font-size: 21px; font-weight: 600; margin-bottom: 4px; }
.hero p { font-size: 13.5px; font-weight: 300; opacity: .9; max-width: 560px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    display: flex; gap: 14px; align-items: center;
}
.stat-ic {
    width: 46px; height: 46px; flex: none;
    border-radius: 13px;
    background: var(--blue-soft); color: var(--blue);
    display: grid; place-items: center;
}
.stat-ic svg { width: 22px; height: 22px; }
.stat-val { font-size: 21px; font-weight: 700; line-height: 1.1; }
.stat-lbl { font-size: 12px; color: var(--ink-soft); }

.two-col { display: grid; grid-template-columns: 1.2fr .8fr; gap: 22px; align-items: start; }

.event-row { display: flex; gap: 13px; padding: 13px 20px; border-bottom: 1px solid var(--border); align-items: center; }
.event-row:last-child { border-bottom: 0; }
.event-date {
    flex: none; width: 50px; height: 54px;
    border-radius: 11px;
    background: var(--blue-soft); color: var(--blue);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.event-date b { font-size: 18px; line-height: 1; }
.event-date span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; }
.event-info { flex: 1; min-width: 0; }
.event-info strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-info span { font-size: 12px; color: var(--ink-soft); }

/* ============ Kalender COE ============ */
.cal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.cal-title { font-weight: 600; font-size: 15px; }
.cal-nav { display: flex; gap: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dow {
    padding: 9px 6px;
    text-align: center;
    font-size: 11px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--border);
}
.cal-cell {
    min-height: 86px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    padding: 6px;
    font-size: 12px;
}
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.other { background: #FAFBFD; color: #B9C3D1; }
.cal-cell .d { font-weight: 600; font-size: 12px; }
.cal-cell.today .d {
    display: inline-grid; place-items: center;
    width: 23px; height: 23px;
    background: var(--blue); color: #fff; border-radius: 50%;
}
.cal-ev {
    display: block;
    margin-top: 4px;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 10.5px; font-weight: 500;
    color: #fff; background: var(--blue);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-ev.pembinaan { background: var(--green); }

.legend { display: flex; gap: 16px; padding: 12px 20px; font-size: 12px; color: var(--ink-soft); }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ============ Login ============ */
.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.login-side {
    position: relative;
    background: linear-gradient(155deg, var(--blue-deep), var(--blue) 55%, var(--blue-bright));
    color: #fff;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 48px;
    overflow: hidden;
}
.login-side::before {
    content: '';
    position: absolute; inset: 0;
    background-image: var(--motif);
    background-size: 240px 120px;
}
.login-side > * { position: relative; }
.login-side .ls-brand { font-size: 26px; font-weight: 700; }
.login-side .ls-brand em { font-style: normal; font-weight: 300; opacity: .85; }
.login-side h1 { font-size: 30px; font-weight: 600; line-height: 1.3; max-width: 420px; }
.login-side p { font-weight: 300; opacity: .88; margin-top: 12px; max-width: 400px; font-size: 14px; }
.login-form-side { display: grid; place-items: center; padding: 32px 20px; background: var(--bg); }
.login-box { width: 100%; max-width: 390px; }
.login-box .login-logo { width: 220px; max-width: 70%; height: auto; display: block; margin-bottom: 20px; }
.login-box h2 { font-size: 21px; font-weight: 600; margin-bottom: 4px; }
.login-box > p { color: var(--ink-soft); font-size: 13px; margin-bottom: 22px; }
.login-box .field { margin-bottom: 15px; }
.login-box .btn { width: 100%; padding: 12px; margin-top: 6px; }

/* ============ Pengguna / matriks hak akses ============ */
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.perm-table input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--blue); }
.role-pill { font-size: 11px; font-weight: 600; border-radius: 99px; padding: 2px 10px; background: var(--blue-soft); color: var(--blue); }

/* ============ Bottom nav (mobile) ============ */
.bottom-nav { display: none; }

/* ============ Responsif ============ */
@media (max-width: 1080px) {
    .two-col { grid-template-columns: 1fr; }
    .login-page { grid-template-columns: 1fr; }
    .login-side { display: none; }
}

@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(13,63,119,.25); }
    .sidebar.open { transform: translateX(0); }
    .scrim.show { display: block; }
    .main { margin-left: 0; }
    .menu-btn { display: grid; }
    .content { padding: 18px 16px 96px; }
    .topbar { padding: 12px 16px; }
    .topbar-date { display: none; }
    .form-grid { grid-template-columns: 1fr; padding: 18px 16px; }
    .detail-list { grid-template-columns: 1fr; }
    .detail-list dt { border-bottom: 0; padding-bottom: 2px; }
    .detail-list dd { padding-left: 20px; }
    .search-form input { width: 100%; }
    .list-tools { width: 100%; }
    .search-form { flex: 1; }

    /* Gaya aplikasi mobile: menu navigasi di bawah */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        z-index: 40;
        background: rgba(255,255,255,.96);
        backdrop-filter: blur(10px);
        border-top: 1px solid var(--border);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    }
    .bn-item {
        flex: 1;
        display: flex; flex-direction: column; align-items: center; gap: 3px;
        padding: 6px 2px;
        border: 0; background: none;
        font: inherit; font-size: 10.5px; font-weight: 500;
        color: var(--ink-soft);
        cursor: pointer;
        border-radius: 10px;
    }
    .bn-item svg { width: 21px; height: 21px; }
    .bn-item:active { color: var(--blue); background: var(--blue-soft); }
    .cal-cell { min-height: 62px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
