:root {
  --bg: #f4f6f4;
  --surface: #ffffff;
  --surface-2: #eef3ef;
  --ink: #17211b;
  --muted: #657268;
  --line: #dce3de;
  --green: #1f7a53;
  --green-2: #e2f3ea;
  --gold: #b7791f;
  --gold-2: #fff4dc;
  --red: #b83232;
  --red-2: #fde8e8;
  --blue: #285f9f;
  --blue-2: #e7f0fb;
  --shadow: 0 18px 50px rgba(23, 33, 27, 0.08);
}

* {
  box-sizing: border-box;
}

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

.hidden {
  display: none !important;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  background: #16231b;
  color: #f7fbf8;
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #f2c14e;
  color: #18211b;
  font-weight: 800;
}

.brand span,
.sidebar-panel span,
.metric span,
.metric small,
.workflow-step small,
.role-card span {
  display: block;
  color: var(--muted);
}

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

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

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

.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #f2c14e;
}

.sidebar-panel {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.panel-label {
  color: #aebdb3;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-panel ol {
  margin: 10px 0 0;
  padding-left: 20px;
  color: #edf5ef;
  line-height: 1.8;
  font-size: 14px;
}

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

.topbar,
.section-toolbar,
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar {
  margin-bottom: 24px;
}

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

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

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
}

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

h3 {
  margin-bottom: 16px;
  font-size: 18px;
}

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

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

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: min(680px, 100%);
}

.user-chip {
  min-width: 230px;
  min-height: 44px;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.user-chip span {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.user-chip strong {
  font-size: 14px;
}

.search {
  height: 44px;
  min-width: min(320px, 34vw);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.search input {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border-radius: 8px;
  min-height: 40px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 700;
  white-space: nowrap;
}

.primary-button {
  color: #ffffff;
  background: var(--green);
}

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

.secondary-button {
  color: var(--green);
  background: var(--green-2);
  border-color: #c2e4d1;
}

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

.icon-button {
  width: 40px;
  padding: 0;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 22px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

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

.metric {
  padding: 18px;
}

.metric span {
  font-size: 13px;
  margin-bottom: 10px;
}

.metric strong {
  display: block;
  font-size: 30px;
  margin-bottom: 8px;
}

.metric small {
  font-size: 12px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.panel-header {
  margin-bottom: 14px;
}

.panel-header p,
.section-toolbar p {
  margin-bottom: 0;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.table-wrap.large {
  max-height: calc(100vh - 220px);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 800px;
  background: var(--surface);
}

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

th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: #f8faf8;
}

td {
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

.item-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
}

.item-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green);
}

.status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status.low,
.status.rejected {
  color: var(--red);
  background: var(--red-2);
}

.status.watch,
.status.manager {
  color: var(--gold);
  background: var(--gold-2);
}

.status.ok,
.status.approved {
  color: var(--green);
  background: var(--green-2);
}

.status.gm {
  color: var(--blue);
  background: var(--blue-2);
}

.approval-feed {
  display: grid;
  gap: 10px;
}

.feed-card,
.request-card,
.report-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfb;
}

.feed-card strong,
.request-card strong {
  display: block;
  margin-bottom: 4px;
}

.feed-meta,
.request-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.section-toolbar {
  margin-bottom: 18px;
}

select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  min-height: 40px;
  padding: 8px 10px;
}

.workflow-band {
  display: grid;
  grid-template-columns: 1fr 60px 1fr 60px 1fr;
  align-items: center;
  margin-bottom: 18px;
}

.workflow-step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-height: 120px;
}

.workflow-step span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  margin-bottom: 12px;
  font-weight: 800;
}

.workflow-step.done span,
.workflow-step.active span {
  background: var(--green);
  color: #ffffff;
}

.workflow-step small {
  margin-top: 5px;
  line-height: 1.45;
}

.workflow-line {
  height: 2px;
  background: var(--line);
}

.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 14px;
  overflow: auto;
  padding-bottom: 8px;
}

.kanban-column {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  padding: 12px;
  min-height: 420px;
}

.kanban-column h3 {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-column h3 span {
  color: var(--muted);
  font-size: 12px;
}

.request-card {
  margin-bottom: 10px;
  display: grid;
  gap: 10px;
  min-width: 0;
}

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

.request-actions button {
  flex: 1 1 88px;
  min-height: 34px;
  padding: 0 10px;
}

.quote-list {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}

.quote-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.quote-row strong {
  color: var(--ink);
  margin: 0;
  white-space: nowrap;
}

.price-alert {
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.price-alert.high {
  color: var(--red);
  background: var(--red-2);
}

.price-alert.low {
  color: var(--green);
  background: var(--green-2);
}

.price-alert.neutral {
  color: var(--blue);
  background: var(--blue-2);
}

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

.wide-report {
  grid-column: 1 / -1;
}

.bar-chart {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  gap: 6px;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

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

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

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

.role-card {
  padding: 22px;
}

.role-card span {
  margin-bottom: 12px;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 800;
}

.role-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: 20px;
}

.load-error {
  max-width: 720px;
  margin: 12vh auto;
  padding: 28px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #16231b;
}

.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
}

.login-brand {
  padding: 0;
  color: var(--ink);
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-weight: 800;
}

dialog {
  border: 0;
  border-radius: 8px;
  padding: 0;
  width: min(720px, calc(100vw - 28px));
  box-shadow: 0 24px 80px rgba(23, 33, 27, 0.24);
}

dialog::backdrop {
  background: rgba(18, 29, 22, 0.56);
}

.modal {
  padding: 22px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

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

.quotes-fieldset {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.quotes-fieldset legend {
  padding: 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.quote-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(110px, 0.6fr);
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

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

textarea {
  resize: vertical;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

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

  .nav-item {
    justify-content: center;
    padding: 0 8px;
  }

  .sidebar-panel {
    display: none;
  }

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

  .workflow-band {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .workflow-line {
    display: none;
  }
}

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

  .topbar,
  .section-toolbar,
  .panel-header,
  .topbar-actions,
  .toolbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    min-width: 100%;
  }

  .nav-list,
  .metric-grid,
  .content-grid,
  .report-grid,
  .role-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .nav-item {
    justify-content: flex-start;
  }

  .kanban {
    grid-template-columns: repeat(4, 86vw);
  }
}
