:root {
  --bg: #f4f7f2;
  --surface: #ffffff;
  --surface-soft: #eef5f1;
  --ink: #172026;
  --muted: #60707d;
  --line: #d8e0db;
  --green: #16835d;
  --green-dark: #0f6747;
  --blue: #1c5fa8;
  --amber: #b7791f;
  --red: #c33b36;
  --shadow: 0 16px 45px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  display: grid;
  width: min(100%, 560px);
  gap: 20px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 3vw, 36px);
  border-bottom: 1px solid rgba(216, 224, 219, 0.8);
  background: rgba(244, 247, 242, 0.92);
  backdrop-filter: blur(16px);
}

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

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
}

.brand-title {
  display: block;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
}

.brand-subtitle {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.mode-switch,
.tabs,
.quick-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.account-chip {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 260px;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
}

.account-chip div {
  display: grid;
  min-width: 0;
}

.account-chip strong,
.account-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-chip strong {
  font-size: 13px;
  line-height: 1.2;
}

.account-chip span {
  color: var(--muted);
  font-size: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.mode-switch {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mode-switch button,
.tabs button,
.quick-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  padding: 8px 12px;
}

.mode-switch button.active,
.tabs button.active,
.quick-tabs button.active {
  background: var(--ink);
  color: #fff;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  padding: 24px clamp(16px, 3vw, 36px) 36px;
}

.sidebar {
  align-self: start;
  position: sticky;
  top: 92px;
  display: grid;
  gap: 10px;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  padding: 12px 14px;
  text-align: left;
}

.nav-button:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.nav-button.active {
  border-color: rgba(22, 131, 93, 0.2);
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.icon {
  display: inline-grid;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  place-items: center;
}

.icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.content-area {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.screen-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 12px;
  font-size: 22px;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.lead {
  max-width: 780px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

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

.metric {
  padding: 16px;
}

.metric strong {
  display: block;
  font-size: 30px;
  line-height: 1;
}

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

.item-card,
.form-panel,
.detail-panel,
.table-panel,
.notice {
  padding: 16px;
}

.auth-panel .form-panel {
  gap: 18px;
}

.item-card {
  display: grid;
  gap: 10px;
}

.item-card.unread {
  border-color: rgba(183, 121, 31, 0.45);
  background: #fffaf0;
}

.item-card.compact {
  box-shadow: none;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.muted {
  color: var(--muted);
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 9px;
}

.pill.green {
  border-color: rgba(22, 131, 93, 0.28);
  background: #e7f4ed;
  color: var(--green-dark);
}

.pill.blue {
  border-color: rgba(28, 95, 168, 0.25);
  background: #e9f1fb;
  color: var(--blue);
}

.pill.amber {
  border-color: rgba(183, 121, 31, 0.28);
  background: #fff3dc;
  color: #7a4c0f;
}

.pill.red {
  border-color: rgba(195, 59, 54, 0.28);
  background: #fdeceb;
  color: var(--red);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  padding: 6px 10px;
  white-space: nowrap;
}

.status-chip.green {
  border-color: rgba(22, 131, 93, 0.28);
  background: #e7f4ed;
  color: var(--green-dark);
}

.status-chip.amber {
  border-color: rgba(183, 121, 31, 0.28);
  background: #fff3dc;
  color: #7a4c0f;
}

.primary,
.secondary,
.danger,
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 8px;
  font-weight: 800;
  padding: 10px 14px;
}

.primary {
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
}

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

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.danger {
  border: 1px solid var(--red);
  background: var(--red);
  color: #fff;
}

.ghost {
  border: 0;
  background: transparent;
  color: var(--muted);
}

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

.field {
  display: grid;
  gap: 6px;
}

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

.is-hidden {
  display: none !important;
}

.field label,
.radio-group legend {
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

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

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.search {
  max-width: 380px;
}

.radio-group {
  display: grid;
  gap: 10px;
  margin: 0;
  border: 0;
  padding: 0;
}

.radio-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.radio-line input {
  margin-top: 4px;
}

.timeline {
  display: grid;
  gap: 10px;
  border-left: 2px solid var(--line);
  padding-left: 14px;
}

.timeline p {
  margin: 0;
}

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

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

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

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

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
}

.list-button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  text-align: left;
}

.list-button.active {
  border-color: rgba(22, 131, 93, 0.45);
  background: #eef8f3;
}

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

.notice {
  border-color: rgba(28, 95, 168, 0.25);
  background: #f0f6fd;
  color: #143d69;
}

.mini-footer {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.file-meta {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-button {
  max-width: 100%;
  overflow-wrap: anywhere;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
}

.file-drop {
  display: grid;
  min-height: 92px;
  gap: 10px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  padding: 14px;
}

.file-drop span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.file-drop input {
  width: min(100%, 360px);
  color: var(--ink);
}

.quick-tabs {
  overflow-x: auto;
  padding-bottom: 2px;
}

@media (max-width: 960px) {
  .workspace,
  .split {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-button {
    width: auto;
    min-width: fit-content;
  }

  .grid.three {
    grid-template-columns: 1fr;
  }
}

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

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .account-chip {
    max-width: none;
    width: 100%;
  }

  .header-actions {
    align-items: stretch;
    justify-content: flex-start;
  }

  .mode-switch {
    width: 100%;
  }

  .mode-switch button {
    flex: 1;
  }

  .workspace {
    padding: 18px 14px 28px;
  }

  .screen-header,
  .row {
    align-items: flex-start;
    flex-direction: column;
  }

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

  h1 {
    font-size: 30px;
  }
}
