:root {
  color-scheme: light;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #182230;
  background: #edf2f5;
  letter-spacing: 0;
  --ink: #182230;
  --muted: #667085;
  --line: #d5dee6;
  --surface: #ffffff;
  --soft: #f6f8fa;
  --nav: #101b29;
  --teal: #087e78;
  --teal-dark: #086661;
  --blue: #2563eb;
  --danger: #a92323;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #edf2f5; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, .button-link {
  min-height: 40px;
  border: 1px solid #c4cfda;
  border-radius: 5px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--ink);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .button-link:hover { border-color: #8fa0b3; background: #f6f8fa; }
.primary { border-color: var(--teal); background: var(--teal); color: #fff; }
.primary:hover { border-color: var(--teal-dark); background: var(--teal-dark); }
.danger-subtle { border-color: #edc3c3; color: #9f2222; background: #fffafa; }
.danger-subtle:hover { border-color: #d99191; background: #fff1f1; }
.danger-solid { border-color: var(--danger); background: var(--danger); color: #fff; }
.danger-solid:hover { border-color: #861b1b; background: #861b1b; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 6px;
  background: var(--teal);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-lockup strong, .brand-lockup span { display: block; }
.brand-lockup strong { font-size: 17px; }
.brand-lockup span { margin-top: 2px; color: #9fb0c3; font-size: 11px; }
.eyebrow { margin: 0 0 5px; color: var(--teal); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.muted { color: var(--muted); }
.alert { margin: 18px 0; padding: 12px 14px; border: 1px solid; border-radius: 5px; }
.alert.error { border-color: #fecaca; background: #fff1f2; color: #991b1b; }
.alert.success { border-color: #9ce1c4; background: #ecfdf5; color: #065f46; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #b9c6d2;
  border-radius: 5px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 96px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(37,99,235,.22);
  outline-offset: 1px;
}
label { display: grid; align-content: start; gap: 7px; color: #475467; font-size: 12px; font-weight: 700; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #111c2a; }
.login-panel {
  width: min(440px, 100%);
  padding: 34px;
  border: 1px solid #d5dee8;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0,0,0,.28);
}
.login-panel .brand-lockup { margin-bottom: 38px; }
.login-panel .brand-lockup span { color: var(--muted); }
.login-panel h1 { margin: 0 0 7px; font-size: 30px; }
.form-stack { display: grid; gap: 16px; margin-top: 26px; }
.form-stack button { margin-top: 5px; }
.login-foot { margin: 24px 0 0; padding-top: 18px; border-top: 1px solid #e1e7ed; color: #8290a2; font-size: 11px; text-align: center; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px 18px;
  display: flex;
  flex-direction: column;
  background: var(--nav);
  color: #fff;
}
.sidebar nav { margin: 38px 0 20px; flex: 1; }
.sidebar nav p { margin: 0 11px 9px; color: #7f91a6; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.sidebar nav a {
  min-height: 43px;
  margin: 3px 0;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 5px;
  display: flex;
  align-items: center;
  color: #c8d2de;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
}
.sidebar nav a:hover { border-color: #304157; background: #17263a; color: #fff; }
.sidebar nav a.active { border-color: #24665f; background: #123a3a; color: #fff; box-shadow: inset 3px 0 var(--teal); }
.sidebar-account { margin-bottom: 10px; padding: 12px; border: 1px solid #304157; border-radius: 5px; background: #152336; }
.sidebar-account span, .sidebar-account small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-account span { font-size: 13px; font-weight: 700; }
.sidebar-account small { margin-top: 3px; color: #9fb0c3; }
.sidebar > form button { width: 100%; color: #fff; border-color: #34465d; background: transparent; }
.sidebar > form button:hover { background: #17263a; }

.workspace { min-width: 0; padding: 28px clamp(20px, 3vw, 46px) 44px; }
.topbar { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.topbar h1 { margin: 0; font-size: 30px; line-height: 1.1; }
.topbar p:last-child { margin: 6px 0 0; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.sync-state {
  min-width: 188px;
  min-height: 46px;
  padding: 7px 12px 7px 34px;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.sync-state i { width: 9px; height: 9px; position: absolute; left: 14px; top: 18px; border-radius: 50%; background: #0ea56f; box-shadow: 0 0 0 4px #dff8ee; }
.sync-state span, .sync-state strong { display: block; }
.sync-state span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.sync-state strong { margin-top: 2px; font-size: 11px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 25px 0 18px; }
.metrics article { min-height: 130px; padding: 20px; border: 1px solid var(--line); border-top: 4px solid; border-radius: 6px; background: #fff; }
.metrics span, .metrics strong, .metrics small { display: block; }
.metrics span { color: #475467; font-size: 13px; font-weight: 650; }
.metrics strong { margin-top: 8px; font-size: 31px; line-height: 1; }
.metrics small { margin-top: 10px; color: var(--muted); }
.metrics .metric-teal { border-top-color: #0f8a82; background: #f1fbfa; }
.metrics .metric-blue { border-top-color: #2e6dde; background: #f3f7ff; }
.metrics .metric-amber { border-top-color: #d38912; background: #fffbef; }
.metrics .metric-violet { border-top-color: #7556b3; background: #f8f5ff; }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(420px, .82fr); gap: 18px; }
.panel, .form-panel { border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.panel { overflow: hidden; }
.panel-heading { min-height: 74px; padding: 17px 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.panel-heading h2, .panel-heading p { margin: 0; }
.panel-heading h2 { font-size: 18px; }
.panel-heading a { color: var(--teal); font-size: 13px; font-weight: 700; text-decoration: none; }
.table-panel { margin-top: 25px; }
.table-toolbar { min-height: 86px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.table-toolbar h2, .table-toolbar p { margin: 0; }
.table-toolbar h2 { font-size: 19px; }
.table-toolbar span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.filters { display: grid; grid-template-columns: minmax(200px, 310px) 150px auto; gap: 8px; }
.filters.single-filter { grid-template-columns: minmax(240px, 360px) auto; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 14px; border-bottom: 1px solid #e1e7ed; text-align: left; white-space: nowrap; }
th { background: #f4f7f9; color: #475467; font-size: 11px; text-transform: uppercase; }
tbody tr:nth-child(even) { background: #f8fafb; }
tbody tr:hover { background: #eef8f7; }
td { font-size: 13px; }
td small { display: block; margin-top: 4px; color: var(--muted); }
.status { display: inline-flex; padding: 4px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.status.active { color: #065f46; background: #d1fae5; }
.status.expiring { color: #92400e; background: #fef3c7; }
.status.warning { color: #991b1b; background: #fee2e2; }
.status.neutral { color: #475467; background: #e2e8f0; }
.row-actions { display: flex; align-items: center; gap: 6px; }
.row-actions button, .row-actions .button-link { min-height: 33px; padding: 0 9px; font-size: 11px; }
.empty { height: 92px; text-align: center; color: var(--muted); }
.activity-dot { width: 8px; height: 8px; margin-right: 8px; display: inline-block; border-radius: 50%; background: var(--teal); }

.form-panel { width: min(850px, 100%); margin: 26px auto 0; padding: 26px; }
.form-intro { padding-bottom: 22px; display: flex; gap: 16px; border-bottom: 1px solid var(--line); }
.form-intro h2, .form-intro p { margin: 0; }
.form-intro h2 { font-size: 22px; }
.form-intro p:last-child { margin-top: 6px; color: var(--muted); }
.form-step { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border-radius: 50%; background: #dff6f3; color: #08746e; font-weight: 800; }
.danger-step { background: #fee2e2; color: #991b1b; }
.record-form { margin-top: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.span-2 { grid-column: 1 / -1; }
.form-actions { margin-top: 26px; padding-top: 18px; display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--line); }
.result-panel { text-align: center; }
.result-panel h2 { margin: 5px 0; font-size: 27px; }
.result-copy { max-width: 570px; margin: 10px auto 22px; color: var(--muted); }
.success-seal { width: 62px; height: 62px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 50%; background: #d1fae5; color: #08705b; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.one-time-key { padding: 22px; border: 1px dashed #5a9e98; border-radius: 6px; background: #f0faf9; text-align: left; }
.one-time-key span, .one-time-key strong { display: block; }
.one-time-key span { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.one-time-key strong { margin-top: 8px; overflow-wrap: anywhere; font-family: Consolas, monospace; font-size: 20px; }
.summary-list { margin: 22px 0 0; border-top: 1px solid var(--line); }
.summary-list div { min-height: 48px; display: grid; grid-template-columns: 170px 1fr; align-items: center; border-bottom: 1px solid var(--line); text-align: left; }
.summary-list dt { color: var(--muted); font-size: 12px; }
.summary-list dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.danger-zone { border-top: 4px solid #b42318; }
.danger-zone .record-form { padding-top: 4px; }

.person { display: flex; align-items: center; gap: 10px; }
.person > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 5px; background: #e1f4f2; color: #08746e; font-weight: 800; }
.person strong, .person small { display: block; }
.protected-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.role-guide { margin-top: 18px; display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.role-guide div { min-height: 84px; padding: 17px; border-right: 1px solid var(--line); }
.role-guide div:last-child { border-right: 0; }
.role-guide strong, .role-guide span { display: block; }
.role-guide span { margin-top: 5px; color: var(--muted); font-size: 12px; }

@media (max-width: 1180px) {
  .overview-grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 16px; display: grid; grid-template-columns: auto 1fr auto; gap: 16px; }
  .sidebar nav { margin: 0; display: flex; justify-content: center; }
  .sidebar nav p { display: none; }
  .sidebar nav a { margin: 0 2px; }
  .sidebar-account { display: none; }
  .sidebar > form { align-self: center; }
  .workspace { padding-top: 22px; }
  .table-toolbar { align-items: stretch; flex-direction: column; }
}

@media (max-width: 680px) {
  .workspace { padding: 18px 11px 30px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; }
  .sync-state { flex: 1; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics article { min-height: 116px; padding: 15px; }
  .overview-grid { display: block; }
  .overview-grid .panel + .panel { margin-top: 16px; }
  .filters, .filters.single-filter { grid-template-columns: 1fr; }
  .sidebar { display: flex; }
  .sidebar nav { overflow-x: auto; justify-content: flex-start; }
  .sidebar nav a { flex: 0 0 auto; }
  .sidebar > form button { width: auto; }
  .form-panel { padding: 19px 15px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .role-guide { grid-template-columns: 1fr; }
  .role-guide div { border-right: 0; border-bottom: 1px solid var(--line); }
  .role-guide div:last-child { border-bottom: 0; }
}
