/* Zenitelecom Compliance — application styles.
 * Same visual family as the production ZT-OPS platform (dark shell, dark-grey
 * workspace, Zenitelecom red accents), while remaining the specialist Compliance
 * application. Full-width responsive workspace across the whole app. */
:root {
  --nav: #171719;
  --bg: #202022;
  --card: #29292c;
  --panel: #222225;          /* inputs, table heads */
  --ink: #f0f0f2;
  --muted: #b1b1ba;
  --line: #414146;
  --line-2: #34343a;
  --blue: #9ebfe9;
  --red: #c92c40;
  --red-dark: #b12337;
  --green: #8dceb1;
  --ok: #a2dfc0;
  --ok-bg: #253e34;
  --warn: #edd39b;
  --warn-bg: #463b26;
  --danger: #ffb4c1;
  --danger-bg: #492a32;
  --info: #bed5f7;
  --info-bg: #2b384a;
  /* Status / severity language (same hierarchy as ZT-OPS). */
  --attention: #e29a2f;
  --critical: #ff4055;
  --resolved: #79b99c;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.35);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.45);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 14px; }
::selection { background: rgba(201,44,64,.4); }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; align-items: stretch; }
.sidebar { width: 244px; flex: 0 0 244px; background: var(--nav); color: var(--muted); border-right: 1px solid #000; }
.sidebar-inner { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.sidebar .brand { padding: 22px 20px 16px; border-bottom: 1px solid #2a2a2e; }
.sidebar .brand img { width: 156px; height: auto; max-width: 100%; display: block; }
.sidebar .brand .sub { color: #8f8f99; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; margin-top: 8px; font-weight: 700; }
.sidebar nav { padding: 12px 12px; flex: 1; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; color: #c8c8cf; padding: 10px 12px; border-radius: 8px; font-weight: 500; font-size: 14px; margin-bottom: 2px; transition: background-color .16s ease, color .16s ease, box-shadow .16s ease; }
.sidebar nav a:hover { background: #2b2b2f; color: #fff; text-decoration: none; box-shadow: inset 3px 0 var(--red); }
.sidebar nav a.active { background: var(--red); color: #fff; box-shadow: inset 3px 0 #f17786; }
.sidebar nav a svg { width: 18px; height: 18px; flex: 0 0 18px; }
.sidebar .tagline { padding: 16px 20px; border-top: 1px solid #2a2a2e; color: #8f8f99; font-size: 12px; font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 62px; background: #29292c; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 18px; padding: 0 26px; position: sticky; top: 0; z-index: 10; }
.topbar .search { flex: 1; max-width: 520px; }
.topbar .search input { width: 100%; padding: 9px 14px 9px 36px; border: 1px solid #444449; border-radius: 8px; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23b1b1ba' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4-4'/%3E%3C/svg%3E") no-repeat 12px center; color: var(--ink); }
.topbar .search input::placeholder { color: #9a9aa4; }
.topbar .trust { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.topbar .trust .dot { color: var(--green); }
.topbar .usermenu { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 8px; background: #171719; color: var(--red); display: grid; place-items: center; font-weight: 800; font-size: 13px; border: 1px solid rgba(255,255,255,.14); }
.usermenu .who { line-height: 1.2; }
.usermenu .who .n { font-weight: 600; font-size: 13px; }
.usermenu .who .r { color: var(--muted); font-size: 11px; text-transform: capitalize; }

/* Full-width workspace: fills the viewport, with a generous guard on ultra-wide
   displays so line lengths stay readable. */
.content { padding: 26px 30px; width: 100%; max-width: 2100px; margin: 0 auto; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.subtle { color: var(--muted); }

/* ---------- Cards & KPI ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.card > h2 { display: flex; align-items: center; justify-content: space-between; }
.grid { display: grid; gap: 16px; }
/* Responsive column groups — fill the available width, wrap intelligently. */
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.kpi .top { display: flex; align-items: center; justify-content: space-between; }
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi .icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; }
.kpi .icon svg { width: 18px; height: 18px; }
.kpi .n { font-size: 30px; font-weight: 800; letter-spacing: -.01em; line-height: 1; }
.kpi .foot { font-size: 12px; color: var(--muted); }
.i-blue { background: var(--info-bg); color: var(--info); }
.i-amber { background: var(--warn-bg); color: var(--warn); }
.i-green { background: var(--ok-bg); color: var(--ok); }
.i-red { background: var(--danger-bg); color: var(--danger); }

/* ---------- Tables ---------- */
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
table.data thead th { color: #c4c4ce; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; background: var(--panel); }
table.data tbody tr:hover td { background: #303034; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data.flush { margin: -4px 0; }
.tablewrap { width: 100%; overflow-x: auto; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.plain::before { display: none; }
.badge.green, .badge.low, .badge.approved, .badge.cleared, .badge.up, .badge.resolved { color: var(--ok); background: var(--ok-bg); }
.badge.amber, .badge.medium, .badge.submitted, .badge.under_review, .badge.pending, .badge.escalated, .badge.attention { color: var(--warn); background: var(--warn-bg); }
.badge.red, .badge.high, .badge.rejected, .badge.blocked, .badge.down, .badge.critical { color: var(--danger); background: var(--danger-bg); }
.badge.blue, .badge.info { color: var(--info); background: var(--info-bg); }
.badge.draft, .badge.neutral, .badge.normal { color: #d6d6de; background: #414147; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea { width: 100%; padding: 9px 11px; border: 1px solid #595960; border-radius: 8px; font-size: 14px; font-family: inherit; background: var(--panel); color: var(--ink); }
input::placeholder, textarea::placeholder { color: #9a9aa4; }
input:focus, select:focus, textarea:focus { outline: 2px solid #f29baa; outline-offset: 1px; border-color: var(--red); }
textarea { min-height: 84px; resize: vertical; }
/* Multi-column forms that use the workspace on wider screens. */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 6px 16px; }
.help { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--red); padding: 9px 16px; border-radius: 8px; font-weight: 600; font-size: 14px; cursor: pointer; background: var(--red); color: #fff; line-height: 1; }
.btn:hover { background: var(--red-dark); border-color: var(--red-dark); text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn.block { width: 100%; justify-content: center; }
.btn.secondary { background: #343438; color: var(--ink); border-color: #505058; }
.btn.secondary:hover { background: #404046; border-color: #74747e; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.danger { background: transparent; color: var(--danger); border-color: #7a3a44; }
.btn.danger:hover { background: var(--danger-bg); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { background: none; border: none; padding: 11px 14px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { color: #f0bec6; border-bottom-color: var(--red); }
.tab-panel[hidden] { display: none; }

/* ---------- Misc ---------- */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; border: 1px solid; }
.alert.error { color: var(--danger); background: var(--danger-bg); border-color: #7a3a44; }
.alert.ok { color: var(--ok); background: var(--ok-bg); border-color: #2f5a49; }
.alert.info { color: var(--info); background: var(--info-bg); border-color: #395067; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 13px; }
.checklist li svg { width: 16px; height: 16px; flex: 0 0 16px; }
.check-ok { color: var(--resolved); }
.check-pending { color: var(--attention); }
.dl { display: grid; grid-template-columns: 34% 66%; gap: 0; }
.dl dt { color: var(--muted); font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.dl dd { margin: 0; padding: 8px 0; font-size: 13px; border-bottom: 1px solid var(--line-2); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.right { text-align: right; }
.muted-note { color: var(--muted); font-size: 12px; }
hr.sep { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.actrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 10px; }
.empty { color: var(--muted); padding: 8px 0; }

/* ---------- Donut ---------- */
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut { --p: 0; width: 128px; height: 128px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 128px;
  background: conic-gradient(var(--resolved) 0 calc(var(--a) * 1%), var(--attention) 0 calc((var(--a) + var(--b)) * 1%), var(--critical) 0 100%); }
.donut .hole { width: 92px; height: 92px; border-radius: 50%; background: var(--card); display: grid; place-items: center; text-align: center; }
.donut .hole .n { font-size: 24px; font-weight: 800; }
.donut .hole .l { font-size: 11px; color: var(--muted); }
.legend { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- Auth screens ---------- */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 500px at 50% -10%, #2a2a2e, var(--bg)); }
.auth-card { width: 100%; max-width: 410px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 32px; }
.auth-card .brand { text-align: center; margin-bottom: 6px; }
.auth-card .brand img { width: 190px; max-width: 70%; height: auto; margin: 0 auto; }
.auth-card .brand .sub { color: var(--muted); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; margin-top: 8px; font-weight: 700; }
.auth-card h1 { font-size: 18px; text-align: center; margin: 14px 0 20px; }

/* ---------- Focus / accessibility ---------- */
:focus-visible { outline: 2px solid #f29baa; outline-offset: 2px; }

@media (max-width: 900px) {
  .sidebar { position: fixed; z-index: 40; height: 100vh; transform: translateX(-100%); transition: transform .2s; }
  .sidebar-inner { height: 100vh; }
  .sidebar.open { transform: none; }
  .sidebar .brand img { width: 140px; }
  .dl { grid-template-columns: 1fr; }
  .content { padding: 18px; }
  .topbar { padding: 0 16px; gap: 12px; }
  .topbar .trust { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar nav a { transition: none; }
  * { scroll-behavior: auto; }
}
