:root {
  color-scheme: light;
  --bg: #f4f1eb;
  --surface: #fffaf2;
  --surface-strong: #ffffff;
  --ink: #202124;
  --muted: #63615b;
  --line: #d9d2c5;
  --teal: #087f72;
  --green: #2f7d32;
  --amber: #a86105;
  --red: #b3261e;
  --violet: #5f4b8b;
  --shadow: 0 18px 55px rgba(45, 39, 30, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  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: 320px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #27231d;
  color: #fffaf2;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand-row,
.topbar,
.panel-title,
.reply-toolbar,
.side-heading,
.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-row {
  justify-content: flex-start;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f1be49;
  color: #262119;
  font-weight: 900;
  font-size: 1.4rem;
}

.eyebrow {
  margin: 0 0 4px;
  color: inherit;
  opacity: 0.66;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: 1.25rem;
}

h2 {
  font-size: clamp(1.45rem, 2vw, 2rem);
}

.status-strip {
  justify-content: flex-start;
  padding: 10px 12px;
  border: 1px solid rgba(255, 250, 242, 0.18);
  border-radius: 8px;
  color: #efe6d2;
  background: rgba(255, 255, 255, 0.06);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f1be49;
}

.dot.ready {
  background: #60c17b;
}

.dot.warn {
  background: #e98676;
}

.side-heading {
  color: #efe6d2;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.ticket-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.ticket-item {
  width: 100%;
  border: 1px solid rgba(255, 250, 242, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #fffaf2;
  padding: 12px;
  text-align: left;
  min-height: 88px;
}

.ticket-item.active {
  border-color: #f1be49;
  background: rgba(241, 190, 73, 0.14);
}

.ticket-item strong,
.ticket-item span {
  display: block;
}

.ticket-item strong {
  font-size: 0.94rem;
  line-height: 1.3;
  margin-bottom: 8px;
}

.ticket-item span {
  color: #d8cdb9;
  font-size: 0.78rem;
}

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

.topbar {
  min-height: 70px;
  margin-bottom: 18px;
}

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

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 127, 114, 0.12);
}

.primary-button,
.ghost-button,
.tab-button {
  border-radius: 8px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
}

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

.primary-button:disabled {
  opacity: 0.64;
  cursor: wait;
}

.ghost-button {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
  font-weight: 750;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(480px, 1.38fr);
  grid-template-areas:
    "intake analysis"
    "metrics analysis";
  gap: 16px;
  align-items: start;
}

.intake-panel,
.analysis-panel,
.metrics-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.intake-panel {
  grid-area: intake;
  padding: 18px;
  display: grid;
  gap: 10px;
}

.analysis-panel {
  grid-area: analysis;
  padding: 18px;
}

.metrics-panel {
  grid-area: metrics;
  padding: 18px;
}

label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.panel-title {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 900;
}

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

.metric-tile {
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 13px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-tile span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
  text-transform: uppercase;
}

.metric-tile strong {
  font-size: 1.38rem;
  line-height: 1.05;
}

.summary-band {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #d7c7a8;
  border-radius: 8px;
  background: #fff4d8;
  padding: 16px;
  margin: 0 0 14px;
}

.summary-band p:last-child {
  margin: 0;
  line-height: 1.5;
}

.mode-badge {
  align-self: flex-start;
  white-space: nowrap;
  border-radius: 999px;
  padding: 6px 10px;
  background: #2f7d32;
  color: white;
  font-size: 0.75rem;
  font-weight: 900;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.tab-button {
  background: var(--surface-strong);
  border-color: var(--line);
  color: var(--muted);
  font-weight: 850;
}

.tab-button.active {
  background: #202124;
  color: white;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
  margin-bottom: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(95, 75, 139, 0.13);
  color: var(--violet);
  font-size: 0.76rem;
  font-weight: 850;
}

.action-list {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 10px;
}

.action-list li {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  line-height: 1.42;
}

.knowledge-list,
.audit-list,
.portfolio-grid {
  display: grid;
  gap: 10px;
}

.knowledge-item,
.audit-item,
.portfolio-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 13px;
}

.knowledge-item header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.knowledge-item strong,
.audit-item strong,
.portfolio-item strong {
  display: block;
  line-height: 1.35;
}

.knowledge-item p,
.audit-item p,
.portfolio-item p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.reply-toolbar {
  margin-bottom: 10px;
  font-weight: 900;
}

.draft-box {
  margin: 0;
  min-height: 310px;
  white-space: pre-wrap;
  line-height: 1.55;
  background: #202124;
  color: #fffaf2;
  border-radius: 8px;
  padding: 16px;
  overflow: auto;
}

.severity-p0 {
  color: var(--red);
}

.severity-p1 {
  color: var(--amber);
}

.severity-p2 {
  color: var(--teal);
}

.severity-p3 {
  color: var(--green);
}

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

  .sidebar {
    min-height: auto;
  }

  .ticket-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    max-height: none;
  }

  .content-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "intake"
      "analysis"
      "metrics";
  }
}

@media (max-width: 720px) {
  .workspace,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .summary-band {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .tabs,
  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .top-actions {
    display: grid;
  }

  .metric-grid {
    display: grid;
  }
}

@media (max-width: 460px) {
  .metric-grid,
  .tabs {
    grid-template-columns: 1fr;
  }
}

