/* ===== Semesta LKD — tema modern ===== */
:root {
  --sb-w: 264px; --nav-h: 64px;
  --brand: #1d4ed8; --brand-600: #1e3a8a; --brand-soft: #dbeafe; --teal: #0f9d9a; --violet: #7c3aed; --gold: #f2b21b;
  --ink: #0f172a; --ink-2: #334155; --muted: #64748b;
  --bg: #f1f5f9; --line: #e2e8f0; --surface: #ffffff;
  --sb-bg: #0f172a; --sb-bg-2: #1e293b; --sb-text: #cbd5e1; --sb-hover: rgba(255,255,255,.06); --sb-active: rgba(59,130,246,.18);
  --radius: 14px; --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.06);
  --bs-primary: #2563eb; --bs-primary-rgb: 37,99,235; --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-color: #1e293b; --bs-link-color: #2563eb;
}
html { scroll-behavior: smooth; }
body { background: var(--bg); padding-top: var(--nav-h); font-size: .925rem; letter-spacing: -.005em; -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4,h5,h6,.h1,.h2,.h3 { letter-spacing: -.02em; color: var(--ink); }

/* ---- navbar ---- */
.app-navbar { height: var(--nav-h); background: rgba(255,255,255,.85); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(15,23,42,.02); }
.app-navbar .navbar-brand { color: var(--ink); display: flex; align-items: center; gap: .6rem; font-weight: 700; }
.brand-mark { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; background: #fff; padding: 2px; box-shadow: 0 2px 8px rgba(15,23,42,.08); }
.brand-sub { font-size: .68rem; font-weight: 500; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.nav-user { display: flex; align-items: center; gap: .75rem; }
.nav-user .meta { text-align: right; line-height: 1.15; }
.nav-user .meta .name { font-weight: 600; color: var(--ink); font-size: .875rem; }
.nav-user .meta .org { color: var(--muted); font-size: .75rem; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(135deg, #0ea5e9, #6366f1); box-shadow: 0 0 0 3px #fff, 0 0 0 4px var(--line); cursor: pointer; }
.btn-menu { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px; width: 40px; height: 40px; display: grid; place-items: center; }
.dropdown-menu { border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: .4rem; }
.dropdown-item { border-radius: 8px; font-size: .875rem; padding: .45rem .75rem; }

/* ---- layout ---- */
.app-wrapper { display: flex; min-height: calc(100vh - var(--nav-h)); }
.app-sidebar { width: var(--sb-w); background: linear-gradient(180deg, var(--sb-bg) 0%, var(--sb-bg-2) 100%); color: var(--sb-text); border-right: 0; }
@media (min-width: 992px) {
  .app-sidebar { position: fixed; top: var(--nav-h); bottom: 0; left: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
  .app-content { margin-left: var(--sb-w); }
}
.app-content { flex: 1; padding: 1.5rem 1.75rem 2rem; min-width: 0; max-width: 100%; overflow-x: hidden; }
html, body { max-width: 100%; overflow-x: hidden; }
@media (max-width: 767px) { .app-content { padding: 1rem; } }
.app-footer { background: transparent; border-top: 0; color: var(--muted); }
@media (min-width: 992px) { .app-footer { margin-left: var(--sb-w); } }
.offcanvas-lg.app-sidebar .offcanvas-header { background: var(--sb-bg); color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.offcanvas-lg.app-sidebar .btn-close { filter: invert(1); }

/* ---- sidebar ---- */
.sidebar-org { padding: 1rem 1.1rem .9rem; border-bottom: 1px solid rgba(255,255,255,.08) !important; }
.sidebar-org .fw-semibold { color: #fff; font-size: .85rem; }
.sidebar-org .text-muted { color: #94a3b8 !important; font-size: .72rem; }
.sidebar-org .chip { display: inline-block; font-size: .65rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; padding: .15rem .5rem; border-radius: 999px; background: rgba(59,130,246,.25); color: #bfdbfe; margin-top: .35rem; }
.sidebar-nav { padding: .75rem .7rem 1.5rem !important; }
.sidebar-nav .nav-link { color: var(--sb-text); padding: .55rem .8rem; border-radius: 10px; margin-bottom: 2px; font-size: .875rem; font-weight: 500; display: flex; align-items: center; transition: background .15s, color .15s; }
.sidebar-nav .nav-link .bi:first-child { width: 22px; font-size: 1.05rem; opacity: .85; }
.sidebar-nav .nav-link:hover { background: var(--sb-hover); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--sb-active); color: #fff; box-shadow: inset 3px 0 0 #3b82f6; }
.sidebar-nav .nav-link.active .bi:first-child { color: #60a5fa; opacity: 1; }
.sidebar-nav .sub { margin: 0 0 .4rem; padding-left: .25rem; }
.sidebar-nav .sub .nav-link { padding: .42rem .8rem .42rem 2.6rem; font-size: .83rem; font-weight: 400; color: #94a3b8; position: relative; }
.sidebar-nav .sub .nav-link::before { content: ""; position: absolute; left: 1.55rem; top: 50%; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .5; transform: translateY(-50%); }
.sidebar-nav .sub .nav-link.active { background: transparent; color: #fff; box-shadow: none; }
.sidebar-nav .sub .nav-link.active::before { background: #3b82f6; opacity: 1; box-shadow: 0 0 0 3px rgba(59,130,246,.25); }
.sidebar-nav .nav-link[data-bs-toggle] .bi-chevron-down { transition: transform .2s; font-size: .7rem; opacity: .6; }
.sidebar-nav .nav-link[data-bs-toggle]:not(.collapsed) .bi-chevron-down { transform: rotate(180deg); }

/* ---- page header ---- */
.page-header { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.45rem; font-weight: 700; margin: 0; display: flex; align-items: center; gap: .35rem; }
.page-header h1 .bi { color: var(--brand); font-size: 1.25rem; }
.page-header h1 .text-muted { font-weight: 500; }

/* ---- cards ---- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface); }
.card-body { padding: 1.25rem; }
.card-title { font-size: .95rem; font-weight: 600; color: var(--ink); }
.card-title.border-bottom { border-color: var(--line) !important; }
.card.border-primary { border-color: #93c5fd !important; box-shadow: 0 0 0 4px rgba(37,99,235,.08); }

/* stat card (dashboard) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
@media (max-width: 575px) { .stat-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; } .stat-card .card-body { padding: .85rem; gap: .6rem; } .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; } .stat-val { font-size: 1.3rem; } }
.stat-card .card-body { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.2rem; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0; }
.stat-icon.primary { background: #dbeafe; color: #1d4ed8; }
.stat-icon.info { background: #cffafe; color: #0e7490; }
.stat-icon.success { background: #dcfce7; color: #15803d; }
.stat-icon.warning { background: #fef3c7; color: #b45309; }
.stat-icon.danger { background: #fee2e2; color: #b91c1c; }
.stat-icon.secondary { background: #e2e8f0; color: #334155; }
.stat-val { font-size: 1.55rem; font-weight: 700; line-height: 1.1; color: var(--ink); letter-spacing: -.02em; }
.stat-label { font-size: .78rem; color: var(--muted); font-weight: 500; }
.stat-card { transition: transform .15s, box-shadow .15s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,23,42,.10); }

/* ---- tables ---- */
.table { --bs-table-striped-bg: #f8fafc; --bs-table-hover-bg: #f1f5f9; color: var(--ink-2); }
.table > :not(caption) > * > * { padding: .55rem .75rem; border-bottom-color: var(--line); }
.table thead th { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #f8fafc; border-bottom: 1px solid var(--line) !important; white-space: nowrap; }
.table-sm > :not(caption) > * > * { padding: .4rem .6rem; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-responsive { max-height: 72vh; border-radius: 10px; }
.table code { background: #f1f5f9; color: #334155; padding: .1rem .4rem; border-radius: 6px; font-size: .8rem; }
/* DataTables */
div.dt-container .dt-search input, div.dt-container .dt-length select { border-radius: 8px !important; border: 1px solid var(--line) !important; padding: .35rem .6rem; font-size: .85rem; }
div.dt-container .dt-info { color: var(--muted); font-size: .8rem; }
div.dt-container .pagination { --bs-pagination-border-radius: 8px; --bs-pagination-padding-y: .3rem; --bs-pagination-padding-x: .65rem; --bs-pagination-font-size: .85rem; }
div.dt-container .dt-search label, div.dt-container .dt-length label { color: var(--muted); font-size: .85rem; }

/* ---- forms ---- */
.form-label { font-size: .8rem; font-weight: 600; color: var(--ink-2); margin-bottom: .3rem; }
.form-control, .form-select { border-radius: 10px; border-color: var(--line); padding: .5rem .8rem; font-size: .9rem; }
.form-control:focus, .form-select:focus { border-color: #93c5fd; box-shadow: 0 0 0 4px rgba(37,99,235,.12); }
.form-control-sm { border-radius: 8px; padding: .3rem .6rem; }
.form-select-sm { border-radius: 8px; padding: .3rem 2rem .3rem .6rem; }
.form-select { padding-right: 2.4rem; }
.form-control[readonly], .form-control:disabled, .form-select:disabled { background: #f8fafc; color: #64748b; }
.form-text { color: var(--muted); }
.required::after { content: " *"; color: #ef4444; }
textarea.form-control { min-height: 60px; }

/* ---- buttons & badges ---- */
.btn { border-radius: 10px; font-weight: 500; padding: .5rem .95rem; font-size: .875rem; transition: all .15s; }
.btn-sm { border-radius: 8px; padding: .32rem .7rem; font-size: .8rem; }
.btn-primary { background: var(--brand); border-color: var(--brand); box-shadow: 0 2px 6px rgba(37,99,235,.25); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); box-shadow: 0 4px 12px rgba(37,99,235,.3); }
.btn-outline-primary { color: var(--brand); border-color: #bfdbfe; background: #fff; }
.btn-outline-primary:hover { background: var(--brand-soft); color: var(--brand-600); border-color: #93c5fd; }
.btn-outline-secondary { color: var(--ink-2); border-color: var(--line); background: #fff; }
.btn-outline-secondary:hover { background: #f1f5f9; color: var(--ink); border-color: #cbd5e1; }
.btn-outline-danger { border-color: #fecaca; background: #fff; }
.btn-outline-danger:hover { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.btn-outline-success { border-color: #bbf7d0; background: #fff; }
.btn-outline-success:hover { background: #dcfce7; color: #15803d; border-color: #86efac; }
td .btn-sm, .text-nowrap .btn-sm { padding: .25rem .5rem; }
.badge { border-radius: 999px; font-weight: 600; padding: .35em .7em; font-size: .72rem; letter-spacing: .01em; }
.badge.text-bg-success { background: #dcfce7 !important; color: #15803d !important; }
.badge.text-bg-warning { background: #fef3c7 !important; color: #b45309 !important; }
.badge.text-bg-danger { background: #fee2e2 !important; color: #b91c1c !important; }
.badge.text-bg-info { background: #e0f2fe !important; color: #0369a1 !important; }
.badge.text-bg-secondary { background: #e2e8f0 !important; color: #475569 !important; }
.badge.text-bg-primary { background: #dbeafe !important; color: #1d4ed8 !important; }
.badge.text-bg-dark { background: #0f172a !important; color: #fff !important; }
.badge.text-bg-light { background: #f8fafc !important; color: #64748b !important; }
.alert { border-radius: 12px; border: 1px solid transparent; font-size: .875rem; }
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.progress { border-radius: 999px; background: #e2e8f0; }
.progress-bar { font-size: .68rem; font-weight: 600; }
.list-group-item { border-color: var(--line); padding: .8rem 1rem; }
.list-group-item-action:hover { background: #f8fafc; }
.org-picker select { border-radius: 8px; }
.modal-content { border-radius: 16px; border: 0; box-shadow: 0 20px 60px rgba(15,23,42,.25); }
pre { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: .75rem; }
hr { border-color: var(--line); opacity: 1; }

/* ---- grid form engine ---- */
.grid-table input.form-control, .grid-table select.form-select, .grid-table textarea.form-control { min-width: 110px; font-size: .85rem; border-radius: 6px; }
.grid-table th { white-space: nowrap; vertical-align: middle; text-align: center; background: #f8fafc; font-size: .72rem; text-transform: none; letter-spacing: 0; color: var(--ink-2); }
.grid-table td.no { text-align: center; width: 40px; color: var(--muted); }
.grid-table input.num { text-align: right; }
.grid-table .row-actions { width: 44px; }
.grid-table tfoot td { background: #f8fafc; }

/* ---- login ---- */
.login-bg { min-height: 100vh; background: var(--bg); display: flex; align-items: stretch; }
.login-side { flex: 1; background: radial-gradient(1200px 600px at 20% 10%, rgba(99,102,241,.35), transparent 60%), radial-gradient(900px 500px at 90% 90%, rgba(14,165,233,.35), transparent 60%), linear-gradient(160deg, #0f172a, #1e3a8a); color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 3rem; position: relative; overflow: hidden; }
.login-side::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(to bottom, rgba(0,0,0,.6), transparent); pointer-events: none; }
.login-side h2 { font-size: 2rem; font-weight: 700; letter-spacing: -.03em; color: #fff; }
.login-side p { color: #cbd5e1; max-width: 460px; }
.login-side .feat { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: .9rem; color: #e2e8f0; font-size: .9rem; }
.login-side .feat .bi { color: #93c5fd; font-size: 1.1rem; }
.login-form { width: 100%; max-width: 480px; display: flex; align-items: center; justify-content: center; padding: 2rem 1.5rem; }
.login-logo { display: inline-block; background: #fff; border-radius: 18px; padding: 1rem 1.25rem; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.login-logo img { width: 240px; max-width: 100%; display: block; }
.login-logo-sm { width: 200px; max-width: 80%; }
.login-card { width: 100%; max-width: 380px; }
.login-card .form-control { padding: .7rem .9rem; }
.login-card .btn-primary { padding: .7rem; border-radius: 12px; font-weight: 600; }
.input-icon { position: relative; }
.input-icon .bi { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.input-icon .form-control { padding-left: 2.4rem; }
@media (max-width: 991px) { .login-side { display: none; } .login-form { max-width: none; } }

/* ---- print (halaman app) ---- */
@media print {
  body { background: #fff; padding: 0; }
  .app-navbar, .app-sidebar, .app-footer, .no-print, .btn, .dt-search, .dt-length, .dt-info, .dt-paging { display: none !important; }
  .app-content { margin: 0; padding: 0; }
  .card { box-shadow: none; border: 0; }
}
body.login-page { padding-top: 0; }
.app-sidebar .offcanvas-body { display: block !important; flex-grow: 1; overflow-y: auto; padding: 0 !important; }
table.dataTable td.dt-type-numeric, table.dataTable th.dt-type-numeric { text-align: left; }
table.dataTable thead > tr > th.dt-orderable-asc span.dt-column-order, table.dataTable thead > tr > th.dt-orderable-desc span.dt-column-order { opacity: .5; }

/* ---- monitoring LKD ---- */
.monev-card .card-header { background: #fff; border-bottom: 0; padding: 1rem 1.25rem .25rem; }
.monev-search { width: 280px; max-width: 100%; }
.monev-search .form-control { border-radius: 10px; }
.monev-card .dt-search { display: none; }
.monev-table { border: 1px solid #e5e7f0; font-size: .875rem; }
.monev-table thead th { background: #eef0fa; color: #1f2937; font-weight: 600; vertical-align: middle; border-bottom: 1px solid #e5e7f0; line-height: 1.25; }
.monev-table td, .monev-table th { border-right: 1px solid #e5e7f0; padding: .45rem .75rem; vertical-align: middle; }
.monev-table tbody tr:hover td { background: #f8f9fe; }
.mv-pill { display: inline-block; min-width: 72px; padding: .15rem .5rem; border-radius: 6px; font-size: .8rem; font-weight: 500; text-align: center; }
.mv-ok  { background: #d8f3dc; color: #1b6b35; }
.mv-mid { background: #fdecc8; color: #b7791f; }
.mv-low { background: #fde0e0; color: #c53030; }
.mv-na  { background: #f1f3f5; color: #9ca3af; }
