:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #18263a;
  background: #f6f8fa;
  font-synthesis: none;
  --canvas: #f6f8fa;
  --surface: #fff;
  --ink: #18263a;
  --muted: #536278;
  --line: #e2e8ef;
  --navy: #132134;
  --navy-line: #304056;
  --teal: #08755d;
  --teal-dark: #065b49;
  --mint: #a9f1d5;
  --focus: #128b72;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(22 38 59 / 4%);
}

*, *::before, *::after { box-sizing: border-box; }
body { min-width: 280px; margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
svg { display: block; flex: none; }
.icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 5;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  transform: translateY(-200%);
  color: #fff;
  background: var(--teal-dark);
  border-radius: 8px;
}

.skip-link:focus { transform: translateY(0); }

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-self: start;
  height: 100vh;
  height: 100svh;
  padding: 27px 17px 19px;
  background: var(--navy);
  color: #f2f7fc;
}

.sidebar :focus-visible { outline-color: var(--mint); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  margin: 0 7px;
  border-radius: 9px;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  flex: none;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  color: #0b5949;
  background: var(--mint);
  box-shadow: 0 3px 10px rgb(0 0 0 / 12%);
}

.brand-mark svg { width: 23px; height: 23px; }
.brand-name { display: block; font-size: 18px; font-weight: 740; letter-spacing: -.055em; }
.brand-label { display: block; margin-top: 2px; color: #b3c1d2; font-size: 11px; }

.sidebar-nav { display: grid; gap: 5px; margin-top: 39px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 43px;
  padding: 0 12px;
  border-radius: 8px;
  color: #c2cedd;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.nav-link svg { width: 18px; height: 18px; }
.nav-link:hover { color: #fff; background: #20324a; }
.nav-link.is-current { color: #d6faed; background: #213b44; }
.nav-link.is-current svg { color: var(--mint); }

.sidebar-footer {
  display: grid;
  gap: 11px;
  margin-top: auto;
  padding: 15px 0 0;
  border-top: 1px solid var(--navy-line);
}

.storage-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 3px 9px;
  color: #bfccdb;
  font-size: 12px;
  line-height: 1.45;
}

.storage-note svg { width: 15px; height: 15px; margin-top: 1px; color: #98dbc6; }

.sidebar .reset-button {
  justify-content: flex-start;
  min-height: 39px;
  padding: 0 9px;
  border-color: transparent;
  color: #d8e2ed;
  background: transparent;
  font-size: 12px;
}

.sidebar .reset-button:hover { background: #24364e; color: #fff; }
.workspace { min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  padding: 10px clamp(24px, 3.1vw, 48px);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}

.topbar-brand { display: none; }
.topbar-context, .topbar-actions { display: flex; align-items: center; gap: 9px; }
.topbar-context > :last-child { color: var(--ink); font-weight: 650; }
.topbar-context svg { width: 13px; height: 13px; color: #718096; }
.topbar-actions { margin-left: auto; }

.main-content {
  width: min(100%, 1450px);
  margin: 0 auto;
  padding: 32px clamp(24px, 3.1vw, 48px) 36px;
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.page-intro-copy { min-width: 0; }

.page-intro h1 {
  font-size: clamp(29px, 3.1vw, 43px);
  font-weight: 750;
  letter-spacing: -.058em;
  line-height: 1.08;
}

.page-description { margin-top: 9px; color: var(--muted); font-size: 14px; line-height: 1.55; }

.button, .reset-button {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}

.button svg, .reset-button svg { width: 16px; height: 16px; }
.button-primary { padding-inline: 15px; background: var(--teal); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--teal-dark); }
.button-secondary { border-color: #dce4ec; background: var(--surface); }
.button-secondary:hover:not(:disabled), .button-quiet:hover:not(:disabled) { background: #eef3f7; }
.button-danger { color: #fff; background: #b52d44; }
.button-danger:hover:not(:disabled) { background: #972139; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 24px;
}

.metric-card {
  min-width: 0;
  padding: 15px 16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 630;
  line-height: 1.25;
}

.metric-heading h2, .metric-heading h3 { font: inherit; }

.metric-icon {
  display: grid;
  flex: none;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
}

.metric-icon svg { width: 18px; height: 18px; }
.metric-icon-mint { color: #087058; background: #e0f4ed; }
.metric-icon-amber { color: #925008; background: #fff1d7; }
.metric-icon-red { color: #a72a44; background: #fde8ec; }
.metric-icon-blue { color: #245da0; background: #e7f0fd; }

.metric-value {
  margin-top: 11px;
  font-size: clamp(23px, 2.6vw, 34px);
  font-weight: 740;
  letter-spacing: -.05em;
  line-height: 1.08;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.metric-detail { margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }

.licenses-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  scroll-margin-top: 16px;
}

.panel-heading {
  padding: 17px 18px;
}

.panel-heading h2 { font-size: 19px; font-weight: 720; letter-spacing: -.035em; line-height: 1.25; }
.panel-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; padding: 14px 18px 14px 0; }

.search-field, .filter-field, .sort-field {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 38px;
  border: 1px solid #dce4ec;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

.search-field { width: clamp(155px, 18vw, 266px); }
.search-field svg, .sort-icon { width: 15px; height: 15px; margin-left: 10px; }
.filter-field, .sort-field { position: relative; }
.filter-field > svg, .sort-chevron { position: absolute; right: 8px; width: 14px; height: 14px; pointer-events: none; }

.search-field :is(input, select), .filter-field select, .sort-field select {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 0 9px;
  border: 0;
  border-radius: inherit;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
}

.search-field input::placeholder { color: #657389; }
.filter-field select, .sort-field select { appearance: none; padding-right: 26px; cursor: pointer; }
.search-field:focus-within, .filter-field:focus-within, .sort-field:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px rgb(18 139 114 / 20%);
}

.table-scroll, .table-footer, .empty-state { grid-column: 1 / -1; min-width: 0; }
.table-scroll { overflow-x: auto; }
.table-scroll:focus-visible { outline-offset: -2px; }
.license-table { width: 100%; border-collapse: collapse; text-align: left; }

.license-table thead th {
  padding: 11px 13px;
  border-block: 1px solid var(--line);
  color: #4a5970;
  background: #f6f8fb;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .035em;
  text-transform: uppercase;
  white-space: nowrap;
}

.license-table tbody :is(th, td) {
  padding: 13px;
  border-bottom: 1px solid #eaf0f5;
  text-align: left;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  vertical-align: middle;
}

.license-table tr > :first-child { width: 34%; padding-left: 18px; }
.license-table tr > :last-child { padding-right: 16px; text-align: right; }
.license-table tbody tr:hover { background: #fafcfd; }
.license-table tbody tr:last-child :is(th, td) { border-bottom: 0; }

.license-cell { display: flex; align-items: center; gap: 11px; min-width: 0; }
.license-cell > :last-child { min-width: 0; }

.vendor-mark {
  display: grid;
  flex: none;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 9px;
  color: #17594b;
  background: #e4f3ee;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: -.025em;
}

.vendor-mark.tone-0 { color: #17594b; background: #e2f5ed; }
.vendor-mark.tone-1 { color: #3b559a; background: #eaf0ff; }
.vendor-mark.tone-2 { color: #805112; background: #fcf0d8; }
.vendor-mark.tone-3 { color: #78488f; background: #f4e8f8; }
.vendor-mark.tone-4 { color: #9b3653; background: #fbe8ed; }
.vendor-mark.tone-5 { color: #315c76; background: #e8f2f8; }

.license-name, .cost-main, .renewal-date { display: block; color: var(--ink); font-weight: 650; }
.license-name, .license-vendor { overflow-wrap: anywhere; }
.cost-main, .renewal-date { font-variant-numeric: tabular-nums; white-space: nowrap; }

.license-vendor, .cost-detail, .days-detail {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.status-pill::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status-pill.is-active { border-color: #ceeadf; color: #17664f; background: #e9f8f1; }
.status-pill.is-soon { border-color: #f3dfb6; color: #80500e; background: #fff3dc; }
.status-pill.is-expired { border-color: #f0d4de; color: #99334c; background: #fbeaf0; }

.row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 3px; }

.icon-button {
  display: inline-grid;
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #526178;
  background: transparent;
}

.icon-button svg { width: 16px; height: 16px; }
.icon-button:hover { border-color: #e0e8f0; color: #21354c; background: #eef3f7; }
.icon-button.delete-license:hover { border-color: #f4d7df; color: #9b2c47; background: #fcedf2; }

.table-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.empty-state { padding: 32px 18px; text-align: center; }
.empty-state .metric-icon { margin: 0 auto 9px; }
.empty-state h3 { color: var(--ink); font-size: 16px; font-weight: 700; }
.empty-state p { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.empty-state .button { margin-top: 14px; }

.dialog {
  width: min(100% - 32px, 510px);
  max-height: calc(100% - 32px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 24px 85px rgb(17 29 43 / 24%);
}

.dialog::backdrop { background: rgb(12 24 39 / 55%); }

.dialog-header, .dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
}

.dialog-header { border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: 20px; font-weight: 720; letter-spacing: -.035em; }
.dialog-header p { margin-top: 5px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.dialog-body { padding: 20px; }
.dialog-body p { color: var(--muted); font-size: 14px; line-height: 1.55; }
.dialog-footer { justify-content: flex-end; border-top: 1px solid var(--line); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.form-field-wide { grid-column: 1 / -1; }

.form-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  font-weight: 650;
}

.form-field :is(input, select) {
  width: 100%;
  min-width: 0;
  min-height: 41px;
  padding: 8px 10px;
  border: 1px solid #d7e0ea;
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  font-weight: 450;
}

.form-field :is(input, select):focus { border-color: var(--focus); }
.form-field input::placeholder { color: #68788c; }
.form-field :is(small, .field-hint) { color: var(--muted); font-size: 12px; font-weight: 450; line-height: 1.4; }

.storage-message {
  margin: 0 0 16px;
  padding: 10px 13px;
  border: 1px solid #f0dfb9;
  border-radius: 8px;
  background: #fff5df;
  color: #76500e;
  font-size: 13px;
}

.activity-message:not(:empty) {
  position: fixed;
  z-index: 3;
  right: 20px;
  bottom: 20px;
  max-width: min(380px, 100% - 40px);
  padding: 11px 14px;
  border: 1px solid #366555;
  border-radius: 10px;
  background: #163b30;
  box-shadow: 0 6px 26px rgb(15 34 27 / 18%);
  color: #f0fbf6;
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 198px minmax(0, 1fr); }
  .sidebar { padding-inline: 13px; }
  .metric-card { padding-inline: 13px; }
  .licenses-panel { grid-template-columns: minmax(0, 1fr); }
  .panel-heading { padding-bottom: 11px; }
  .panel-controls { justify-content: flex-start; padding: 0 18px 14px; }
}

@media (min-width: 901px) and (max-width: 970px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .license-table { min-width: 610px; }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: static; flex-direction: row; align-items: center; justify-content: space-between; gap: 12px; height: auto; padding: 12px 20px; }
  .brand { margin: 0; }
  .sidebar-nav { display: flex; gap: 4px; margin: 0 auto; }
  .nav-link { min-height: 36px; padding-inline: 9px; font-size: 13px; }
  .nav-link svg { width: 15px; height: 15px; }
  .sidebar-footer { display: block; margin: 0; padding: 0; border: 0; }
  .storage-note { display: none; }
  .sidebar .reset-button { min-height: 42px; }
  .topbar { min-height: 56px; padding-inline: 20px; }
  .main-content { padding: 26px 20px 30px; }
  .metric-heading { gap: 7px; }
}

@media (max-width: 660px) {
  .sidebar { padding: 10px 16px; }
  .sidebar-nav { display: none; }
  .brand-mark { width: 34px; height: 34px; }
  .brand-label { display: none; }
  .topbar { padding-inline: 16px; }
  .main-content { padding-inline: 16px; }
  .page-intro { align-items: flex-start; }
  .page-intro .button { min-height: 44px; }
  .page-intro h1 { font-size: clamp(26px, 5.8vw, 36px); }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 17px; }
  .metric-value { font-size: clamp(23px, 5vw, 32px); }
  .metric-icon { width: 31px; height: 31px; }
  .metric-icon svg { width: 17px; height: 17px; }
  .panel-heading { padding: 15px 15px 12px; }
  .panel-controls { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); padding: 0 15px 14px; }
  .search-field { grid-column: 1 / -1; width: 100%; }
  .search-field, .filter-field, .sort-field { min-height: 41px; }
  .search-field input, .filter-field select, .sort-field select { font-size: 16px; }
  .sort-icon { display: none; }
  .license-table, .license-table tbody { display: block; }
  .license-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .license-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto); gap: 11px 8px; padding: 14px 15px; border-top: 1px solid var(--line); }
  .license-table tbody :is(th, td) { min-width: 0; padding: 0; border: 0; }
  .license-table tbody th:first-child { grid-area: 1 / 1; align-self: center; width: auto; padding: 0; }
  .license-table tbody td:last-child { grid-area: 1 / 2; padding: 0; }
  .license-table tbody td:nth-child(2) { grid-area: 2 / 1; }
  .license-table tbody td:nth-child(3) { grid-area: 2 / 2; text-align: right; }
  .license-table tbody td:nth-child(4) { grid-area: 3 / 1 / 4 / -1; }
  .vendor-mark { width: 32px; height: 32px; }
  .row-actions .icon-button { width: 42px; height: 42px; }
  .table-footer { padding-inline: 15px; }
  .form-field :is(input, select) { font-size: 16px; }
}

@media (max-width: 440px) {
  .page-intro { flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
  .topbar-context { gap: 5px; }
  .metric-card { padding: 12px; }
  .metric-heading { font-size: 12px; }
  .metric-detail { font-size: 11px; }
  .form-grid { gap: 12px; }
  .dialog-header, .dialog-body, .dialog-footer { padding-inline: 16px; }
}

@media (max-width: 365px) {
  .sidebar, .topbar { gap: 8px; padding-inline: 12px; }
  .brand { gap: 7px; }
  .brand-name { font-size: 17px; }
  .brand-mark { width: 30px; height: 30px; }
  .sidebar .reset-button { gap: 5px; padding-inline: 5px; font-size: 11px; }
  .topbar-context > :not(:last-child) { display: none; }
  .panel-controls { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
