:root {
    --bg: #f6f7f4;
    --panel: #ffffff;
    --ink: #17211b;
    --muted: #667169;
    --line: #dfe6dd;
    --green: #247a4b;
    --green-strong: #145b35;
    --teal: #0f766e;
    --amber: #b7791f;
    --red: #b42318;
    --blue: #2764b0;
    --sidebar: #13241c;
    --sidebar-soft: #21382d;
    --shadow: 0 18px 48px rgba(30, 45, 35, 0.12);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 25px; letter-spacing: 0; }
h2 { margin-bottom: 8px; font-size: 18px; }
h3 { margin-bottom: 8px; font-size: 15px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; }
.sidebar {
    position: sticky; top: 0; height: 100vh; padding: 22px 18px; background: var(--sidebar);
    color: #f7fbf8; display: flex; flex-direction: column; gap: 24px;
}
.brand { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center; }
.brand.compact { grid-template-columns: 54px 1fr; margin-bottom: 22px; }
.brand-mark {
    width: 48px; height: 48px; display: grid; place-items: center; border-radius: 8px;
    background: #e3f5dc; color: var(--green-strong); font-weight: 800;
}
.brand strong, .brand span, .sidebar-card strong, .sidebar-card span { display: block; }
.brand span, .sidebar-card span { color: #b9c8bd; font-size: 12px; margin-top: 3px; }
.nav { display: grid; gap: 5px; }
.nav a {
    min-height: 42px; border-radius: 8px; color: #dce8df; display: grid;
    grid-template-columns: 28px 1fr; align-items: center; padding: 0 12px;
}
.nav a:hover, .nav a.active { background: var(--sidebar-soft); color: #ffffff; }
.sidebar-card {
    margin-top: auto; padding: 14px; border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px; background: rgba(255, 255, 255, 0.05);
}
.main { min-width: 0; }
.topbar {
    min-height: 86px; padding: 22px 30px; border-bottom: 1px solid var(--line);
    background: rgba(246, 247, 244, 0.92); display: flex; justify-content: space-between;
    gap: 18px; align-items: center; position: sticky; top: 0; z-index: 5; backdrop-filter: blur(14px);
}
.eyebrow { margin: 0 0 4px; color: var(--green); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.view { padding: 28px 30px 44px; }
.muted { color: var(--muted); }
.mt { margin-top: 18px; }
.mb { margin-bottom: 18px; }

.primary-button, .secondary-button, .ghost-button {
    min-height: 38px; border-radius: 8px; border: 1px solid transparent; padding: 0 14px;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.primary-button { background: var(--green); color: #fff; }
.secondary-button { background: #eaf4ee; color: var(--green-strong); border-color: #c8dfd1; }
.ghost-button { background: #fff; color: var(--ink); border-color: var(--line); }
.alert {
    margin-bottom: 16px; padding: 12px 14px; border-radius: 8px; background: #eaf4ee;
    border: 1px solid #c8dfd1; color: var(--green-strong);
}
.alert.error { background: #ffe2df; border-color: #ffc5bf; color: var(--red); }

.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card, .panel, .record-card, .login-card {
    background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
}
.stat-card { padding: 16px; }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin-top: 7px; font-size: 22px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr); gap: 18px; }
.panel { padding: 18px; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.panel-head h2, .panel-head p { margin-bottom: 0; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.single { grid-template-columns: 1fr; }
.field { display: grid; gap: 6px; }
.field span, .field label { color: var(--muted); font-size: 12px; font-weight: 800; }
.field input, .field select, .field textarea {
    width: 100%; min-height: 40px; border-radius: 8px; border: 1px solid var(--line); padding: 8px 10px; background: #fff;
}
.field.actions { align-content: end; }
.check { display: flex; gap: 8px; align-items: center; color: var(--muted); }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
td { font-size: 14px; }
.badge {
    display: inline-flex; min-height: 24px; align-items: center; border-radius: 999px;
    padding: 0 9px; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.badge.green { background: #ddf5e7; color: var(--green-strong); }
.badge.amber { background: #fff2d8; color: #86520f; }
.badge.red { background: #ffe2df; color: var(--red); }
.badge.blue { background: #e1edff; color: var(--blue); }

.records-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 14px; }
.record-card { padding: 16px; }
.record-card strong { font-size: 20px; }
.mini-list { display: grid; gap: 10px; }
.mini-item { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.mini-item:last-child { border-bottom: 0; }
.progress { height: 10px; overflow: hidden; background: #e7eee8; border-radius: 999px; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--teal)); }
.chart-bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 120px; align-items: center; gap: 12px; font-size: 13px; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--sidebar); }
.login-card { width: min(430px, 100%); padding: 24px; }
.login-card .brand span { color: var(--muted); }

@media (max-width: 1180px) {
    .stats-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
}
@media (max-width: 860px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; }
    .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .topbar, .grid-2 { grid-template-columns: 1fr; flex-direction: column; align-items: stretch; }
    .stats-grid, .records-grid, .form-grid { grid-template-columns: 1fr; }
    .bar-row { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .topbar, .view { padding-left: 18px; padding-right: 18px; }
    .nav { grid-template-columns: 1fr; }
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px 18px;
    background: radial-gradient(circle at 50% 0%, rgba(36, 122, 75, 0.18), transparent 34%), linear-gradient(145deg, #0c2118 0%, #18324a 100%);
}
.login-wrap { width: min(460px, 100%); display: grid; gap: 18px; }
.login-identity { display: grid; justify-items: center; gap: 14px; color: #fff; text-align: center; }
.login-identity h1 { margin-bottom: 4px; font-size: 28px; font-weight: 800; }
.login-identity p { margin-bottom: 0; color: rgba(255,255,255,.78); }
.login-logo { width: 96px; height: 96px; position: relative; display: grid; place-items: center; align-content: center; border-radius: 50%; background: #fff; color: var(--green-strong); box-shadow: 0 18px 42px rgba(0,0,0,.28); }
.login-logo strong { margin-top: 10px; font-size: 22px; line-height: 1; }
.login-logo small { margin-top: 2px; color: var(--teal); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.logo-roof { position: absolute; top: 20px; left: 24px; width: 48px; height: 16px; border-radius: 8px 8px 4px 4px; background: linear-gradient(90deg, var(--green) 0 25%, #fff 25% 32%, var(--teal) 32% 58%, #fff 58% 65%, var(--blue) 65% 100%); border: 2px solid #123826; }
.login-card { width: 100%; padding: 30px 26px 26px; border-radius: 8px; }
.login-card h2 { margin-bottom: 6px; text-align: center; font-size: 25px; }
.login-card .muted { margin-bottom: 20px; text-align: center; }
.login-card .field input { min-height: 44px; }
.login-submit { width: 100%; min-height: 44px; }
.login-footer { color: rgba(255,255,255,.72); font-size: 13px; text-align: center; }
.login-footer a { color: #fff; font-weight: 700; }


/* Sidebar grouped menu */
.nav {
    gap: 16px;
}

.nav-group {
    display: grid;
    gap: 5px;
}

.nav-label {
    margin: 0 0 4px;
    padding: 0 12px;
    color: #9fb4a8;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    background: rgba(255,255,255,.07);
    color: #dff4d7;
    font-size: 12px;
    font-weight: 900;
}

.nav a {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
}

.nav a.active .nav-icon {
    background: #e3f5dc;
    color: #145b35;
}

@media (max-width: 860px) {
    .nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
}

@media (max-width: 620px) {
    .nav {
        grid-template-columns: 1fr;
    }
}

.nav-label {
    margin: 14px 0 4px;
    padding: 0 12px;
    color: #9fb4a8;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}
.nav-label:first-child {
    margin-top: 0;
}

.nav-label {
    margin: 16px 0 5px;
    padding: 0 12px;
    color: #9fb4a8;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
}

.nav-label:first-child {
    margin-top: 0;
}

.danger-button { background: #fff0ee; color: #b42318; border: 1px solid #ffc5bf; }
.small-button { min-height: 32px; padding: 0 10px; font-size: 12px; }
.row-link { color: #145b35; font-weight: 800; }
.row-link:hover { text-decoration: underline; }
.action-cell { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.action-cell form { margin: 0; }
.edit-row { display: none; background: #f8fbf9; }
.edit-row:target { display: table-row; }
.inline-editor { margin-bottom: 18px; padding: 16px; border: 1px solid #dfe6dd; border-radius: 8px; background: #f8fbf9; }
.inline-editor:not(:target) { display: none; }
.edit-row .inline-editor { display: block; margin: 4px 0; }
.compact-head { padding-bottom: 10px; }
.business-form { grid-template-columns: repeat(4, minmax(160px, 1fr)); }
.app-footer { max-width: 1480px; width: 100%; padding: 0 30px 24px; color: #667169; display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.app-footer a { color: #145b35; font-weight: 800; }

@media (max-width: 860px) {
    .business-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .app-footer { padding: 0 20px 24px; flex-direction: column; }
}
@media (max-width: 620px) {
    .business-form { grid-template-columns: 1fr; }
}

/* NEP CRUD tempat usaha */
.danger-button { background: #fff0ee; color: #b42318; border: 1px solid #ffc5bf; }
.small-button { min-height: 32px; padding: 0 10px; font-size: 12px; }
.row-link { color: #145b35; font-weight: 800; }
.row-link:hover { text-decoration: underline; }
.action-cell { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.action-cell form { margin: 0; }
.edit-row { display: none; background: #f8fbf9; }
.edit-row:target { display: table-row; }
.inline-editor { margin-bottom: 18px; padding: 16px; border: 1px solid #dfe6dd; border-radius: 8px; background: #f8fbf9; }
.inline-editor:not(:target) { display: none; }
.edit-row .inline-editor { display: block; margin: 4px 0; }
.compact-head { padding-bottom: 10px; }
.business-form { grid-template-columns: repeat(4, minmax(160px, 1fr)); }
.app-footer { max-width: 1480px; width: 100%; padding: 0 30px 24px; color: #667169; display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.app-footer a { color: #145b35; font-weight: 800; }
@media (max-width: 860px) {
    .business-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .app-footer { padding: 0 20px 24px; flex-direction: column; }
}
@media (max-width: 620px) {
    .business-form { grid-template-columns: 1fr; }
}