/* ============================================================
   DecTrust Attorney — Admin Panel v4
   Red / black / white "System Dashboard" theme
   ============================================================ */

:root {
  --adm-red: #e11d2a;
  --adm-red-dark: #b91420;
  --adm-red-light: #fde8e9;
  --adm-black: #101114;
  --adm-black-soft: #16181d;
  --adm-ink: #0f172a;
  --adm-muted: #6b7280;
  --adm-muted-2: #9aa1ae;
  --adm-line: #e9eaed;
  --adm-bg: #f4f5f7;
  --adm-card: #ffffff;
  --adm-radius: 16px;
  --adm-radius-sm: 10px;
  --adm-shadow: 0 1px 2px rgba(16, 17, 20, .04), 0 8px 24px rgba(16, 17, 20, .06);
  --adm-green: #15803d;
  --adm-green-bg: #dcfce7;
  --adm-amber: #b45309;
  --adm-amber-bg: #fef3c7;
  --adm-blue: #1d4ed8;
  --adm-blue-bg: #dbeafe;
}

.adm * { box-sizing: border-box; }
.adm { font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; color: var(--adm-ink); }
.adm h1, .adm h2, .adm h3, .adm h4 { font-family: inherit; margin: 0; color: var(--adm-ink); font-weight: 700; }
.adm a { text-decoration: none; color: inherit; }
.adm button { font-family: inherit; }
body.adm-body { margin: 0; background: var(--adm-bg); }

/* ---------- shell layout ---------- */
.adm-shell { display: flex; min-height: 100vh; }

.adm-sidebar {
  width: 250px; flex-shrink: 0; background: var(--adm-card); border-right: 1px solid var(--adm-line);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
  transform: translateX(0); transition: transform .2s ease;
}
.adm-sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 14px; }
.adm-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; color: var(--adm-ink); }
.adm-brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--adm-red); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.adm-sidebar-close { display: none; border: none; background: transparent; font-size: 20px; line-height: 1; color: var(--adm-muted); cursor: pointer; padding: 4px; }

.adm-nav { padding: 6px 12px; overflow-y: auto; flex: 1; }
.adm-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px;
  font-size: 14.5px; font-weight: 600; color: #384152; margin-bottom: 2px;
}
.adm-nav a .ic { width: 20px; text-align: center; flex-shrink: 0; font-size: 16px; opacity: .8; }
.adm-nav a:hover { background: #f6f7f9; }
.adm-nav a.active { background: var(--adm-red); color: #fff; }
.adm-nav a.active .ic { opacity: 1; }
.adm-nav .adm-nav-logout { margin-top: 14px; color: var(--adm-red); border-top: 1px solid var(--adm-line); padding-top: 16px; border-radius: 0; }

.adm-sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,17,21,.5); z-index: 35; }

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

.adm-topbar {
  position: sticky; top: 0; z-index: 20; background: rgba(244,245,247,.92); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 24px; border-bottom: 1px solid var(--adm-line);
}
.adm-topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.adm-hamburger { display: none; border: none; background: #fff; box-shadow: var(--adm-shadow); width: 38px; height: 38px; border-radius: 10px; align-items: center; justify-content: center; font-size: 17px; cursor: pointer; flex-shrink: 0; }
.adm-topbar h2 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-topbar-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.adm-topbar-right .who { font-size: 13.5px; color: var(--adm-muted); }
.adm-logout-link { color: var(--adm-red); font-weight: 700; font-size: 14px; }

.adm-content { padding: 22px 24px 60px; max-width: 1280px; width: 100%; margin: 0 auto; }

/* ---------- welcome banner ---------- */
.adm-welcome { margin-bottom: 20px; }
.adm-welcome h1 { font-size: 26px; margin-bottom: 4px; }
.adm-welcome p { margin: 0; color: var(--adm-muted); font-size: 14.5px; }

/* ---------- tabs ---------- */
.adm-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.adm-tabs a { padding: 9px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 700; background: #fff; border: 1px solid var(--adm-line); color: var(--adm-muted); display: inline-flex; align-items: center; gap: 6px; }
.adm-tabs a.active { background: var(--adm-red); border-color: var(--adm-red); color: #fff; }

/* ---------- cards / grid ---------- */
.adm-card { background: var(--adm-card); border-radius: var(--adm-radius); box-shadow: var(--adm-shadow); padding: 20px; }
.adm-card-dark { background: var(--adm-black); color: #fff; border-radius: var(--adm-radius); padding: 20px; }
.adm-card-dark .k { color: #9aa1ae; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.adm-card-dark .v { font-weight: 700; font-size: 15px; margin-top: 2px; }

.adm-grid { display: grid; gap: 16px; }
.adm-kpis { grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; }
.adm-2col { grid-template-columns: 2fr 1fr; align-items: start; }
.adm-3col { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 980px) { .adm-kpis { grid-template-columns: repeat(2, 1fr); } .adm-2col, .adm-3col { grid-template-columns: 1fr; } }

.adm-kpi { background: var(--adm-card); border-radius: var(--adm-radius); box-shadow: var(--adm-shadow); padding: 18px; }
.adm-kpi .top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.adm-kpi .label { font-size: 12.5px; color: var(--adm-muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.adm-kpi .icon { width: 34px; height: 34px; border-radius: 10px; background: var(--adm-red-light); color: var(--adm-red); display: flex; align-items: center; justify-content: center; font-size: 16px; }
.adm-kpi .num { font-size: 28px; font-weight: 800; }

.adm-live { display: flex; align-items: center; justify-content: space-between; }
.adm-live .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--adm-green); display: inline-block; margin-right: 6px; box-shadow: 0 0 0 3px var(--adm-green-bg); }

/* ---------- panel / section ---------- */
.adm-panel { background: var(--adm-card); border-radius: var(--adm-radius); box-shadow: var(--adm-shadow); padding: 20px; margin-bottom: 18px; }
.adm-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.adm-panel-head h3 { font-size: 16px; }
.adm-panel-head .sub { font-size: 13px; color: var(--adm-muted); margin-top: 2px; }
.adm-panel-head a.viewall { font-size: 13px; font-weight: 700; color: var(--adm-red); }

/* ---------- toolbar: search + filter ---------- */
.adm-toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.adm-search { flex: 1; min-width: 200px; position: relative; }
.adm-search input { width: 100%; padding: 10px 14px 10px 36px; border-radius: 10px; border: 1px solid var(--adm-line); background: #fafafb; font-size: 14px; }
.adm-search::before { content: '\1F50D'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .5; }
.adm-select { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--adm-line); background: #fff; font-size: 14px; font-weight: 600; color: var(--adm-ink); }

/* ---------- tables ---------- */
.adm-table-wrap { overflow-x: auto; }
table.adm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.adm-table th { text-align: left; padding: 10px 14px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--adm-muted); border-bottom: 1px solid var(--adm-line); white-space: nowrap; }
table.adm-table td { padding: 13px 14px; border-bottom: 1px solid var(--adm-line); vertical-align: middle; }
table.adm-table tr:last-child td { border-bottom: none; }
table.adm-table tr:hover td { background: #fafafb; }
.adm-cell-sub { color: var(--adm-muted); font-size: 12.5px; margin-top: 2px; }
.adm-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.adm-empty { padding: 40px 10px; text-align: center; color: var(--adm-muted); font-size: 14px; }

/* ---------- badges ---------- */
.adm-badge { display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.adm-badge-green { color: var(--adm-green); background: var(--adm-green-bg); }
.adm-badge-amber { color: var(--adm-amber); background: var(--adm-amber-bg); }
.adm-badge-red { color: var(--adm-red-dark); background: var(--adm-red-light); }
.adm-badge-blue { color: var(--adm-blue); background: var(--adm-blue-bg); }
.adm-badge-gray { color: var(--adm-muted); background: #eef0f2; }
.adm-amt-pos { color: var(--adm-green); font-weight: 700; }
.adm-amt-neg { color: var(--adm-red-dark); font-weight: 700; }

/* ---------- buttons ---------- */
.adm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 10px; font-size: 14px; font-weight: 700; border: 1px solid transparent; cursor: pointer; }
.adm-btn-primary { background: var(--adm-red); color: #fff; }
.adm-btn-primary:hover { background: var(--adm-red-dark); }
.adm-btn-primary:disabled { opacity: .6; cursor: default; }
.adm-btn-outline { background: #fff; color: var(--adm-ink); border-color: var(--adm-line); }
.adm-btn-outline:hover { background: #f6f7f9; }
.adm-btn-dark { background: var(--adm-black); color: #fff; }
.adm-btn-sm { padding: 6px 13px; font-size: 12.5px; }
.adm-btn-block { width: 100%; }
.adm-btn-danger-outline { background: #fff; color: var(--adm-red-dark); border-color: #f3c9cb; }

/* ---------- forms ---------- */
.adm-field { margin-bottom: 16px; }
.adm-field label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--adm-ink); }
.adm-field .req { color: var(--adm-red); }
.adm-field input[type=text], .adm-field input[type=number], .adm-field input[type=password], .adm-field input[type=email], .adm-field select, .adm-field textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--adm-line); font-size: 14.5px; background: #fff; font-family: inherit; color: var(--adm-ink);
}
.adm-field textarea { resize: vertical; min-height: 80px; }
.adm-field .hint { font-size: 12px; color: var(--adm-muted-2); margin-top: 5px; }
.adm-field .counter { font-size: 11.5px; color: var(--adm-muted-2); text-align: right; margin-top: 4px; }
.adm-balance-pill { display: flex; align-items: center; gap: 8px; background: var(--adm-black); color: #fff; padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 700; font-size: 15px; }
.adm-balance-pill .k { font-weight: 500; color: #b6bac3; font-size: 13px; margin-right: auto; }

/* ---------- toast ---------- */
.adm-toast { position: fixed; top: 18px; right: 18px; z-index: 100; background: var(--adm-black); color: #fff; padding: 13px 18px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,.25); display: flex; align-items: center; gap: 10px; max-width: 360px; animation: adm-toast-in .18s ease; }
.adm-toast.error { background: var(--adm-red-dark); }
.adm-toast .chk { width: 20px; height: 20px; border-radius: 50%; background: var(--adm-green); display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
@keyframes adm-toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.adm-alert { padding: 12px 16px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px; font-weight: 600; }
.adm-alert-success { background: var(--adm-green-bg); color: var(--adm-green); }
.adm-alert-error { background: var(--adm-red-light); color: var(--adm-red-dark); }
.adm-alert-info { background: var(--adm-blue-bg); color: var(--adm-blue); }

/* ---------- shortcuts list ---------- */
.adm-shortcut { display: flex; align-items: center; gap: 14px; padding: 14px 12px; border-radius: 12px; }
.adm-shortcut:hover { background: #fafafb; }
.adm-shortcut .icon { width: 38px; height: 38px; border-radius: 10px; background: var(--adm-red-light); color: var(--adm-red); display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.adm-shortcut .txt { flex: 1; }
.adm-shortcut .txt .t { font-weight: 700; font-size: 14.5px; }
.adm-shortcut .txt .s { font-size: 12.5px; color: var(--adm-muted); }
.adm-shortcut .arrow { color: var(--adm-muted-2); }

/* ---------- login page ---------- */
.adm-login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--adm-black); padding: 20px; }
.adm-login-card { width: 100%; max-width: 380px; background: #fff; border-radius: var(--adm-radius); padding: 32px 28px; box-shadow: var(--adm-shadow); }
.adm-login-card .adm-brand { justify-content: center; margin-bottom: 18px; font-size: 17px; }
.adm-login-card h2 { text-align: center; font-size: 20px; margin-bottom: 4px; }
.adm-login-card .sub { text-align: center; color: var(--adm-muted); font-size: 13.5px; margin-bottom: 22px; }
.adm-login-card .back { display: block; text-align: center; margin-top: 16px; font-size: 13.5px; color: var(--adm-muted); }

/* ---------- detail grid (kept from legacy views) ---------- */
.adm-detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 24px; }
@media (max-width: 700px) { .adm-detail-grid { grid-template-columns: 1fr; } }
.adm-detail-grid .k { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--adm-muted); margin-bottom: 3px; }
.adm-detail-grid .v { font-size: 14.5px; font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .adm-sidebar { transform: translateX(-100%); box-shadow: 0 0 0 transparent; }
  .adm-sidebar.open { transform: translateX(0); box-shadow: 20px 0 50px rgba(0,0,0,.15); }
  .adm-sidebar-close { display: block; }
  .adm-main { margin-left: 0; }
  .adm-hamburger { display: flex; }
  .adm-sidebar-backdrop.open { display: block; }
  .adm-topbar-right .who { display: none; }
  .adm-content { padding: 18px 14px 50px; }
}
