:root {
  color-scheme: light;
  --ink: #171915;
  --muted: #676b63;
  --line: #dfe2da;
  --surface: #ffffff;
  --soft: #f4f5f1;
  --yellow: #ffd400;
  --green: #18794e;
  --red: #b42318;
  --telegram: #2477c8;
  --whatsapp: #188654;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--soft); color: var(--ink); font-size: 14px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.brand { display: flex; align-items: center; gap: 11px; font-size: 16px; font-weight: 800; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; background: var(--ink); color: var(--yellow); border-radius: 6px; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #eceee8; }
.login-panel { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 30px; box-shadow: 0 16px 40px rgba(23,25,21,.08); }
.login-panel h1 { margin: 34px 0 8px; font-size: 25px; }
.login-panel p { color: var(--muted); line-height: 1.55; }
.login-panel form { display: grid; gap: 10px; margin-top: 24px; }
label { font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #cfd3c9; border-radius: 6px; background: white; color: var(--ink); padding: 11px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(23,25,21,.08); }
.status-text { min-height: 22px; margin-bottom: 0; color: var(--red) !important; }

.button { min-height: 40px; border: 1px solid transparent; border-radius: 6px; padding: 9px 15px; font-weight: 750; }
.button.primary { background: var(--ink); color: white; }
.button.primary:hover { background: #30332d; }
.button.secondary { border-color: var(--line); background: white; color: var(--ink); }
.button.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.button.danger { border-color: #efc5c1; background: #fff6f5; color: var(--red); }
.button.full { width: 100%; }
.button:disabled { opacity: .55; cursor: wait; }
.link-button { border: 0; background: none; padding: 0; color: var(--muted); text-align: left; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: #151713; color: white; padding: 20px 14px; border-right: 1px solid #292c26; }
.sidebar .brand { padding: 0 8px 26px; }
.sidebar .brand-mark { background: var(--yellow); color: var(--ink); }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 44px; border: 0; border-radius: 6px; padding: 10px; background: transparent; color: #bec2b9; text-align: left; transition: background .15s ease, color .15s ease; }
.nav-item:hover { background: #232620; color: white; }
.nav-item.active { background: #2b2e28; color: white; box-shadow: inset 3px 0 var(--yellow); }
.nav-label { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nav-label i { display: grid; place-items: center; width: 20px; height: 20px; color: #8f9489; font-style: normal; font-size: 15px; }
.nav-item.active .nav-label i { color: var(--yellow); }
.nav-item b { min-width: 24px; border-radius: 12px; padding: 2px 7px; background: #343831; color: #d9ddd4; text-align: center; font-size: 11px; }
.nav-item.active b { background: var(--yellow); color: var(--ink); }
.sidebar-footer { margin-top: auto; display: grid; gap: 4px; border-top: 1px solid #34372f; padding: 18px 8px 4px; }
.sidebar-footer span { color: #92968c; font-size: 12px; }
.sidebar-footer .link-button { margin-top: 12px; color: #cfd2ca; }

.workspace { min-width: 0; background: #f3f4f0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 86px; border-bottom: 1px solid var(--line); background: white; padding: 18px 28px; }
.topbar h1 { margin: 0; font-size: 23px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.sync-state { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.sync-state i { width: 7px; height: 7px; border-radius: 50%; background: #2d9b62; }
.refresh-button { font-size: 22px; font-weight: 500; }
.refresh-button.loading { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stats { display: grid; grid-template-columns: 1.55fr repeat(4, minmax(132px, 1fr)); gap: 10px; border-bottom: 1px solid var(--line); background: #eceee9; padding: 16px 28px; }
.stat-card { min-width: 0; min-height: 132px; border: 1px solid #d8dbd3; border-radius: 7px; background: #fff; padding: 16px 17px; color: var(--ink); text-align: left; }
button.stat-card { cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
button.stat-card:hover { border-color: #aaaea4; box-shadow: 0 7px 18px rgba(23,25,21,.07); transform: translateY(-2px); }
button.stat-card:focus-visible { outline: 3px solid rgba(255,215,0,.45); outline-offset: 2px; }
.stat-card strong { display: block; margin-top: 12px; font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-primary { display: grid; grid-template-rows: auto auto 6px auto; gap: 10px; border-color: #171914; background: #171914; color: white; }
.stat-primary:hover { border-color: #171914 !important; box-shadow: 0 9px 22px rgba(23,25,21,.18) !important; }
.stat-label { color: #c9cec3; font-size: 12px; font-weight: 700; }
.stat-main { display: flex; align-items: baseline; gap: 8px; }
.stat-main strong { display: inline; margin: 0; color: var(--yellow); font-size: 36px; }
.stat-main i { color: #aeb3a9; font-size: 12px; font-style: normal; }
.stat-composition { display: flex; overflow: hidden; height: 6px; border-radius: 3px; background: #343830; }
.stat-composition i { width: 0; transition: width .55s cubic-bezier(.2,.7,.2,1); }
.stat-composition i:first-child { background: var(--yellow); }
.stat-composition i:last-child { background: #f5f6f2; }
.stat-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; color: #aeb3a9; font-size: 11px; }
.stat-note i { overflow: hidden; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.stat-note b { color: white; font-size: 11px; white-space: nowrap; }
.stat-topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-topline i { color: var(--muted); font-size: 11px; font-style: normal; }
.stat-symbol { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; background: #fff5b8; color: #635100; font-size: 16px; font-weight: 800; }
.stat-symbol.success { background: #e3f3e9; color: #16814b; }
.stat-symbol.neutral { background: #eceee9; color: #5f645b; }
.stat-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; color: var(--muted); font-size: 11px; }
.stat-footer b { color: var(--ink); font-size: 15px; transition: transform .18s ease; }
button.stat-card:hover .stat-footer b { transform: translateX(3px); }
.stat-card.metric-pulse { animation: metricPulse .42s ease; }
@keyframes metricPulse { 50% { background-color: #fffbe6; } }

.queue-section { margin: 24px 28px 40px; border: 1px solid var(--line); border-radius: 8px; background: white; padding: 22px; box-shadow: 0 6px 18px rgba(23,25,21,.035); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-heading h2 { margin: 0 0 4px; font-size: 18px; }
.section-heading p { margin: 0; color: var(--muted); }
.result-count { border-left: 2px solid var(--yellow); padding-left: 9px; color: var(--muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
.toolbar { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; background: white; padding: 3px; }
.segmented button { border: 0; border-radius: 4px; background: transparent; padding: 8px 12px; color: var(--muted); font-weight: 700; }
.segmented button.active { background: var(--ink); color: white; }
.filters { display: flex; gap: 8px; }
.filters input { width: 230px; }
.filters select { width: 170px; }
.table-head, .request-row { display: grid; grid-template-columns: minmax(190px, 1.4fr) minmax(180px, 1.25fr) .7fr .75fr .75fr .7fr; align-items: center; gap: 16px; }
.table-head { padding: 10px 15px; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; }
.request-list { overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: white; }
.request-row { width: 100%; min-height: 76px; border: 0; border-bottom: 1px solid var(--line); background: white; padding: 12px 15px; color: var(--ink); text-align: left; }
.request-row:last-child { border-bottom: 0; }
.request-row:hover { background: #f8f9f5; box-shadow: inset 3px 0 var(--yellow); }
.request-row strong, .request-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person { display: grid; gap: 3px; }
.person small { color: var(--muted); }
.type-label { display: grid; gap: 3px; }
.type-label small { color: var(--muted); }
.channel { display: inline-flex; align-items: center; width: fit-content; min-height: 24px; border-radius: 4px; padding: 3px 7px; background: #f0f1ed; color: var(--muted); font-size: 12px; font-weight: 700; }
.channel.telegram { background: #eaf3fc; color: var(--telegram); }
.channel.whatsapp { background: #e8f6ef; color: var(--whatsapp); }
.channel.telegram_whatsapp { background: #edf1f4; color: #41505c; }
.badge { display: inline-flex; width: fit-content; align-items: center; min-height: 24px; border-radius: 12px; padding: 3px 9px; font-size: 12px; font-weight: 750; }
.badge.pending { background: #fff4c2; color: #725b00; }
.badge.approved { background: #e5f4eb; color: var(--green); }
.badge.rejected { background: #fde9e7; color: var(--red); }
.empty-state { display: grid; place-items: center; align-content: center; gap: 7px; min-height: 230px; border: 1px dashed #cfd3c9; border-radius: 7px; background: #fafbf8; color: var(--muted); }
.empty-state strong { color: var(--ink); }
.request-list.loading { min-height: 230px; opacity: .45; pointer-events: none; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(10,11,9,.35); }
.drawer { position: fixed; z-index: 21; inset: 0 0 0 auto; width: min(500px, 100%); display: grid; grid-template-rows: auto 1fr auto; background: white; box-shadow: -18px 0 50px rgba(0,0,0,.15); transform: translateX(105%); transition: transform .2s ease; }
.drawer.open { transform: translateX(0); }
.drawer header { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding: 22px 24px; }
.drawer h2 { margin: 0; font-size: 21px; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 6px; background: white; font-size: 24px; line-height: 1; }
.drawer-content { overflow: auto; padding: 22px 24px; }
.detail-section { margin-bottom: 26px; }
.detail-section h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: 145px 1fr; gap: 10px 14px; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.approval-impact { display: flex; gap: 12px; margin: 0 0 26px; border-left: 3px solid var(--yellow); background: #fff9dc; padding: 15px 16px; }
.approval-impact-icon { display: grid; place-items: center; flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--yellow); color: #111; font-weight: 900; }
.approval-impact h3 { margin: 1px 0 6px; font-size: 14px; }
.approval-impact p { margin: 0 0 7px; line-height: 1.45; }
.approval-impact small { color: var(--muted); line-height: 1.4; }
.decision-form { border-top: 1px solid var(--line); padding: 18px 24px 22px; }
.decision-form label { display: block; margin-bottom: 8px; }
.decision-form label span { color: var(--muted); font-weight: 400; }
.decision-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.toast { position: fixed; z-index: 30; right: 24px; bottom: 24px; max-width: 360px; border-radius: 6px; background: var(--ink); color: white; padding: 12px 16px; box-shadow: 0 8px 25px rgba(0,0,0,.22); }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 12px 16px; }
  .sidebar .brand { padding: 0 0 12px; }
  .sidebar nav { display: flex; overflow-x: auto; }
  .nav-item { width: auto; white-space: nowrap; }
  .sidebar-footer { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat-primary { grid-column: 1 / -1; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .filters input, .filters select { width: 100%; }
  .filters { display: grid; grid-template-columns: 1fr 180px; }
  .table-head { display: none; }
  .request-row { grid-template-columns: 1.35fr 1fr .7fr; }
  .request-row > :nth-child(4), .request-row > :nth-child(5), .request-row > :nth-child(6) { display: none; }
}

@media (max-width: 620px) {
  .topbar { padding: 16px; }
  .topbar h1 { font-size: 19px; }
  .stats { grid-template-columns: 1fr 1fr; padding: 12px 16px; }
  .stat-card { min-height: 118px; padding: 14px; }
  .stat-primary { min-height: 132px; }
  .queue-section { margin: 16px; padding: 16px; }
  .sync-state { display: none; }
  .section-heading { align-items: flex-end; }
  .segmented { display: grid; grid-template-columns: 1fr 1fr; }
  .filters { grid-template-columns: 1fr; }
  .request-row { grid-template-columns: 1fr auto; gap: 8px; }
  .request-row > :nth-child(2) { grid-column: 1; }
  .request-row > :nth-child(3) { grid-column: 2; grid-row: 1; }
  .login-panel { padding: 22px; }
}
