:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-muted: #eef2f5;
  --ink: #19212a;
  --muted: #677280;
  --line: #d8e0e7;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --expired: #991b1b;
  --expired-bg: #fee2e2;
  --critical: #c2410c;
  --critical-bg: #fff1e8;
  --warning: #a16207;
  --warning-bg: #fff8db;
  --normal: #15803d;
  --normal-bg: #e9f8ef;
  --shadow: 0 20px 50px rgba(25, 33, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: #111827;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #2dd4bf;
  color: #0f172a;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 3px;
  color: #a7b1bf;
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #dbe4ee;
  text-decoration: none;
}

.nav a.active,
.nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.icon {
  width: 22px;
  text-align: center;
  font-weight: 700;
}

.side-panel {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.side-panel h2 {
  margin: 0 0 8px;
  font-size: 15px;
}

.side-panel p {
  margin: 0;
  color: #b8c4d1;
  font-size: 14px;
  line-height: 1.55;
}

main {
  min-width: 0;
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  font-size: 32px;
  line-height: 1.2;
}

.topbar-actions,
.dialog-actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button,
.ghost-button,
.icon-button,
.segmented button,
.row-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 12px;
  font-weight: 700;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button,
.row-button {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.ghost-button:hover,
.row-button:hover {
  border-color: #aab7c4;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric span,
.metric small,
.asset-meta,
.note {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 34px;
  line-height: 1;
}

.metric.expired strong {
  color: var(--expired);
}

.metric.critical strong {
  color: var(--critical);
}

.metric.warning strong {
  color: var(--warning);
}

.metric.normal strong {
  color: var(--normal);
}

.workbench,
.rules-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toolbar {
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.search-field {
  flex: 1;
  min-width: 240px;
  max-width: 520px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfc;
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.segmented button {
  min-height: 34px;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

.table-wrap {
  position: relative;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  padding: 15px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr {
  position: relative;
}

tbody tr.status-row {
  background: var(--row-bg, #ffffff);
  box-shadow: inset 4px 0 0 var(--row-accent, transparent);
}

tbody tr.status-row:hover {
  background: var(--row-hover-bg, #f8fafc);
}

tbody tr.status-row.expired {
  --row-bg: #fff7f7;
  --row-hover-bg: #feecec;
  --row-accent: var(--expired);
}

tbody tr.status-row.critical {
  --row-bg: #fffaf6;
  --row-hover-bg: #fff1e8;
  --row-accent: var(--critical);
}

tbody tr.status-row.warning {
  --row-bg: #fffdf0;
  --row-hover-bg: #fff8db;
  --row-accent: var(--warning);
}

tbody tr.status-row.normal {
  --row-bg: #fbfffc;
  --row-hover-bg: #effaf3;
  --row-accent: var(--normal);
}

tbody tr.status-row.unknown {
  --row-bg: #f8fafc;
  --row-hover-bg: #eef2f5;
  --row-accent: #64748b;
}

.asset-name {
  display: grid;
  gap: 4px;
  font-weight: 800;
}

.asset-meta {
  font-size: 13px;
  font-weight: 500;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 800;
}

.badge.expired {
  background: var(--expired-bg);
  color: var(--expired);
}

.badge.critical {
  background: var(--critical-bg);
  color: var(--critical);
}

.badge.warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge.normal {
  background: var(--normal-bg);
  color: var(--normal);
}

.badge.unknown {
  background: #eef2f5;
  color: #475569;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row-button {
  white-space: nowrap;
}

.empty-state {
  padding: 54px 24px;
  text-align: center;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state span {
  margin-top: 6px;
  color: var(--muted);
}

.rules-section {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 22px;
  margin-top: 18px;
  padding: 20px;
}

.rule-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.rule-list article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.rule-list strong,
.rule-list span {
  display: block;
}

.rule-list span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

dialog {
  width: min(720px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.26);
}

.wide-dialog {
  width: min(1040px, calc(100vw - 28px));
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.52);
}

form {
  padding: 22px;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.icon-button {
  width: 38px;
  padding: 0;
  background: #f1f5f9;
  color: var(--ink);
  font-size: 22px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: #344150;
  font-size: 14px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  background: #ffffff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

code {
  display: block;
  overflow-x: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
}

fieldset {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 8px;
  color: #344150;
  font-size: 14px;
  font-weight: 800;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  font-weight: 700;
}

.checkbox-grid input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 18px;
}

.bulk-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
}

.bulk-help {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.bulk-help span,
.bulk-message {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.eos-help {
  margin-bottom: 14px;
}

.bulk-actions {
  display: flex;
  gap: 10px;
  margin: 4px 0 14px;
}

.bulk-message {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.bulk-message.error {
  border-color: #fed7aa;
  background: var(--critical-bg);
  color: var(--critical);
}

.bulk-message.success {
  border-color: #bbf7d0;
  background: var(--normal-bg);
  color: var(--normal);
}

.bulk-preview {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bulk-preview table {
  min-width: 760px;
}

.eos-preview table {
  min-width: 980px;
}

.bulk-preview td,
.bulk-preview th {
  padding: 10px;
}

.status-text {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.status-text.error {
  color: var(--critical);
}

.status-text.success {
  color: var(--normal);
}

.table-check {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .side-panel {
    display: none;
  }

  main {
    padding: 18px;
  }

  .metrics-grid,
  .rule-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rules-section {
    grid-template-columns: 1fr;
  }

  .bulk-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar,
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  h1 {
    font-size: 25px;
  }

  .topbar-actions,
  .segmented {
    width: 100%;
  }

  .topbar-actions button,
  .segmented button {
    flex: 1;
  }

  .metrics-grid,
  .rule-list,
  .form-grid,
  .checkbox-grid,
  .nav {
    grid-template-columns: 1fr;
  }
}
