:root {
  --teal: #2f9c91;
  --teal-dark: #21746c;
  --orange: #e73d1c;
  --green: #4daf6e;
  --ink: #191919;
  --panel: #ffffff;
  --line: #e8e8e8;
  --muted: #74777a;
  --canvas: #f3f3f3;
  --sidebar: #151616;
  --sidebar-soft: #202020;
  --text: #2d3033;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  margin: 0;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar);
  color: white;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 26px 18px;
  position: sticky;
  top: 0;
}

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

.brand-mark {
  align-items: center;
  background: var(--teal);
  border-radius: 6px;
  display: grid;
  font-size: 12px;
  font-weight: 800;
  height: 42px;
  letter-spacing: 0;
  place-items: center;
  width: 42px;
}

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

.brand span {
  color: #a7a7a7;
  font-size: 12px;
  margin-top: 2px;
}

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

.nav-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #d7d7d7;
  display: flex;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  text-align: left;
}

.nav-item span {
  align-items: center;
  background: var(--sidebar-soft);
  border-radius: 4px;
  color: #f3f3f3;
  display: grid;
  font-size: 11px;
  font-weight: 800;
  height: 22px;
  place-items: center;
  width: 22px;
}

.nav-item:hover,
.nav-item.active {
  background: var(--teal);
  color: #fff;
}

.nav-item:hover span,
.nav-item.active span {
  background: rgba(255, 255, 255, 0.18);
}

.sidebar-footer {
  border-top: 1px solid #2a2a2a;
  color: #bfbfbf;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 20px;
}

.text-button {
  background: transparent;
  border: 0;
  color: inherit;
  flex-basis: 100%;
  padding: 0;
  text-align: left;
}

.auth-screen {
  background: var(--canvas);
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.auth-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(25, 37, 54, 0.08);
  display: grid;
  gap: 18px;
  padding: 28px;
  width: min(420px, 100%);
}

.auth-panel h1,
.auth-panel p {
  margin: 0;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}

.notice.danger {
  background: #fff1ed;
  border-color: #f5b29f;
  color: #922b14;
}

.notice.success {
  background: #eef8f6;
  border-color: #9bcfc4;
  color: #175b4e;
}

.brand.compact {
  color: var(--ink);
  margin-bottom: 0;
}

.workspace {
  min-width: 0;
  padding: 34px;
}

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

.page-header h1 {
  color: var(--ink);
  font-size: clamp(30px, 5vw, 48px);
  letter-spacing: 0;
  line-height: 1;
  margin: 0 0 10px;
}

.page-header p {
  color: var(--muted);
  margin: 0;
  max-width: 720px;
}

.eyebrow {
  color: var(--teal) !important;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  margin-bottom: 8px !important;
  text-transform: uppercase;
}

.header-actions {
  flex: 0 0 auto;
}

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

.metric-card,
.panel,
.export-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 35px rgba(25, 25, 25, 0.05);
}

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 18px;
}

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

.metric-card strong {
  color: var(--ink);
  font-size: 28px;
  letter-spacing: 0;
  line-height: 1;
}

.two-column,
.split-form {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  margin-bottom: 20px;
}

.split-form.wide {
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
}

.panel {
  padding: 20px;
}

.panel h2 {
  color: var(--ink);
  font-size: 18px;
  letter-spacing: 0;
  margin: 0 0 18px;
}

.panel-title {
  align-items: start;
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-title h2 {
  margin: 0;
}

.panel-title span {
  color: var(--muted);
  font-size: 13px;
}

.stack {
  display: grid;
  gap: 10px;
}

.list-row {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px;
}

.list-row span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-top: 4px;
}

.alert-list {
  display: grid;
  gap: 10px;
}

.alert {
  align-items: center;
  border-radius: 6px;
  display: flex;
  gap: 12px;
  padding: 14px;
}

.alert strong {
  align-items: center;
  border-radius: 4px;
  display: grid;
  height: 30px;
  place-items: center;
  width: 42px;
}

.alert.warning {
  background: #fff4ef;
}

.alert.warning strong {
  background: var(--orange);
  color: white;
}

.alert.review {
  background: #f3f1ff;
}

.alert.review strong {
  background: #525256;
  color: white;
}

.alert.info {
  background: #eef8f6;
}

.alert.info strong {
  background: var(--teal);
  color: white;
}

.primary,
.secondary,
.icon-button {
  border: 0;
  border-radius: 6px;
  min-height: 40px;
  padding: 0 14px;
}

.primary {
  background: var(--teal);
  color: white;
  font-weight: 800;
}

.primary:hover {
  background: var(--teal-dark);
}

.secondary,
.icon-button {
  background: #f7f7f7;
  border: 1px solid var(--line);
  color: var(--ink);
}

.permission-note {
  align-items: center;
  background: #f8f8f8;
  border: 1px solid var(--line);
  border-left: 4px solid #525256;
  border-radius: 8px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 14px 16px;
}

.permission-note strong {
  color: var(--ink);
}

.permission-note span {
  color: var(--muted);
  font-size: 14px;
}

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

.form-stack {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  background: #fbfbfb;
  border: 1px solid #d8d8d8;
  border-radius: 6px;
  color: var(--ink);
  min-height: 42px;
  padding: 0 12px;
  width: 100%;
}

textarea {
  min-height: 90px;
  padding: 12px;
  resize: vertical;
}

.full {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip,
.badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 7px 10px;
  white-space: nowrap;
}

.chip {
  background: #eef8f6;
  color: var(--teal-dark);
}

.badge.info {
  background: #eef8f6;
  color: var(--teal-dark);
}

.badge.success {
  background: #edf8f0;
  color: #286d40;
}

.badge.warning {
  background: #fff1eb;
  color: #a82a13;
}

.badge.review {
  background: #f0f0f0;
  color: #525256;
}

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

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

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

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

td {
  color: var(--ink);
  font-size: 14px;
}

.card-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.credit-card {
  background: var(--ink);
  border-radius: 8px;
  color: white;
  display: grid;
  gap: 14px;
  min-height: 210px;
  padding: 18px;
}

.credit-card span,
.credit-card p {
  color: #cfcfcf;
  margin: 0;
}

.credit-card strong {
  display: block;
  font-size: 20px;
  margin-top: 4px;
}

.credit-meta {
  display: flex;
  justify-content: space-between;
}

.progress {
  background: #e8e8e8;
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}

.progress span,
.bar i {
  background: var(--teal);
  display: block;
  height: 100%;
}

.bar i.negative {
  background: var(--orange);
}

.mini-bars {
  display: grid;
  gap: 13px;
}

.mini-bars > div {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 160px 1fr 70px;
}

.mini-bars span {
  color: var(--muted);
}

.bar {
  background: #eeeeee;
  border-radius: 99px;
  height: 10px;
  overflow: hidden;
}

.export-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.export-card {
  color: var(--ink);
  display: grid;
  gap: 8px;
  min-height: 120px;
  padding: 18px;
  text-align: left;
}

.export-card span {
  color: var(--muted);
}

.empty-state {
  background: #f7f7f7;
  border: 1px dashed #cfcfcf;
  border-radius: 6px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

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

  .two-column,
  .split-form,
  .split-form.wide {
    grid-template-columns: 1fr;
  }
}

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

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

  .brand {
    margin-bottom: 16px;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-item {
    flex: 0 0 auto;
  }

  .sidebar-footer {
    display: none;
  }

  .workspace {
    padding: 22px 16px;
  }

  .page-header {
    align-items: start;
    flex-direction: column;
  }

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

  .metric-card {
    min-height: 112px;
  }

  .mini-bars > div {
    grid-template-columns: 1fr;
  }
}
