:root {
  color-scheme: light;
  --ink: #18202f;
  --muted: #667085;
  --line: #d9dee8;
  --surface: #ffffff;
  --soft: #f4f7fb;
  --nav: #111827;
  --nav-soft: #1f2937;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --gold: #b7791f;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--soft);
  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;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(15, 23, 42, 0.06)),
    var(--soft);
}

.login-panel {
  display: grid;
  gap: 24px;
  width: min(100%, 420px);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

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

.login-brand strong {
  display: block;
  font-size: 1.1rem;
}

.login-brand span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.86rem;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-title {
  font-size: 2rem;
}

.login-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.88rem;
  font-weight: 700;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px 18px;
  color: #f9fafb;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.18), rgba(15, 118, 110, 0) 38%),
    var(--nav);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 6px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 8px;
}

.brand svg,
.nav-item svg,
.topbar svg,
.button-row svg,
.empty-state svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex: 0 0 auto;
}

.brand strong {
  display: block;
  font-size: 1rem;
}

.brand span {
  display: block;
  margin-top: 2px;
  color: #cbd5e1;
  font-size: 0.84rem;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: #d1d5db;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: white;
  background: var(--nav-soft);
  border-color: rgba(255, 255, 255, 0.08);
}

.sidebar-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: auto;
  padding: 14px;
  color: #d1d5db;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
}

.sidebar-note p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
}

.status-dot {
  width: 9px;
  height: 9px;
  margin-top: 5px;
  background: #34d399;
  border-radius: 999px;
}

.main {
  min-width: 0;
  padding: 28px;
}

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

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

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

h1 {
  font-size: 2.7rem;
  line-height: 1;
}

h2 {
  font-size: 1.2rem;
}

.topbar-actions,
.button-row,
.panel-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-actions,
.button-row {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.reference-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.profile-badge {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  color: #0f172a;
  background: #ecfdf3;
  border: 1px solid #b7ebc6;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 800;
}

.helper-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.45;
}

.photo-preview,
.card-photo {
  overflow: hidden;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.photo-preview {
  max-width: 280px;
}

.photo-preview img,
.card-photo img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.card-photo img {
  max-height: 220px;
}

.panel-heading {
  justify-content: space-between;
  margin-bottom: 18px;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
}

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

.calculation-panel div {
  padding: 12px;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.calculation-panel span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.calculation-panel strong {
  display: block;
  margin-top: 6px;
  font-size: 1.05rem;
}

.primary-button {
  padding: 0 16px;
  color: white;
  background: var(--accent);
}

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

.secondary-button {
  padding: 0 14px;
  color: var(--ink);
  background: #eef2f7;
  border-color: var(--line);
}

.text-button {
  padding: 0 2px;
  color: var(--accent-strong);
  background: transparent;
}

.icon-button {
  width: 42px;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.icon-button.quiet {
  color: var(--muted);
  background: transparent;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.metric-card,
.panel,
.editor-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 18px;
}

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
}

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

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel,
.editor-panel {
  padding: 20px;
}

.editor-panel {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 0.88rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  color: var(--ink);
  background: white;
  border: 1px solid #cfd6e2;
  border-radius: 8px;
  outline: none;
}

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 11px 12px;
  line-height: 1.45;
}

small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

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

.policy-list,
.template-list {
  display: grid;
  gap: 12px;
}

.policy-card,
.template-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.policy-card-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.policy-title {
  display: grid;
  gap: 5px;
}

.policy-title strong {
  font-size: 1rem;
}

.policy-title span,
.policy-card p,
.template-card p {
  color: var(--muted);
  font-size: 0.9rem;
}

.policy-card p,
.template-card p {
  margin: 0;
  line-height: 1.5;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  color: #344054;
  background: #eef2f7;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.pill.live {
  color: #05603a;
  background: #d1fadf;
}

.pill.draft {
  color: #92400e;
  background: #fef3c7;
}

.pill.paused,
.pill.review {
  color: #93370d;
  background: #ffead5;
}

.pill.generated {
  color: #075985;
  background: #dff3ff;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mini-button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
}

.mini-button.danger {
  color: var(--danger);
}

.process-list {
  display: grid;
  gap: 12px;
}

.process-list div {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.process-list span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: white;
  background: var(--accent);
  border-radius: 999px;
  font-weight: 900;
}

.process-list p {
  margin: 0;
  color: #344054;
}

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

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

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

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

td {
  color: #344054;
}

.empty-state {
  display: grid;
  gap: 10px;
  min-height: 170px;
  place-items: center;
  color: var(--muted);
  background: #fbfcfe;
  border: 1px dashed #b9c2d0;
  border-radius: 8px;
  text-align: center;
}

.empty-state svg {
  width: 34px;
  height: 34px;
}

.empty-state p {
  margin: 0;
  font-weight: 800;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: 1fr;
    padding: 14px;
  }

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

  .nav-item {
    justify-content: center;
  }

  .nav-item span,
  .sidebar-note {
    display: none;
  }

  .dashboard-grid,
  .workspace-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .main {
    padding: 18px;
  }

  h1 {
    font-size: 2.1rem;
  }

  .topbar,
  .panel-heading,
  .policy-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .reference-row {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions,
  .button-row {
    justify-content: stretch;
  }

  .primary-button,
  .secondary-button,
  .login-form .primary-button,
  .login-form .secondary-button {
    width: 100%;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .calculation-panel {
    grid-template-columns: 1fr;
  }
}
