:root {
  color-scheme: dark;
  --bg: #081311;
  --surface: #101d1a;
  --surface-strong: #172824;
  --ink: #eef7f3;
  --muted: #94aaa4;
  --line: #263b35;
  --brand: #2dd4bf;
  --brand-strong: #5eead4;
  --accent: #fbbf24;
  --danger: #fb923c;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(45, 212, 191, 0.14), transparent 280px),
    var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 18px 14px 108px;
}

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

.login-panel {
  width: min(100%, 420px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 29, 26, 0.94);
  box-shadow: var(--shadow);
}

.login-copy {
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 0 14px;
}

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

.user-chip {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: none;
  align-items: center;
  color: var(--muted);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 800;
}

.user-chip.visible {
  display: inline-flex;
}

.tabbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 0 12px;
  background: linear-gradient(180deg, var(--bg), rgba(8, 19, 17, 0.9));
  backdrop-filter: blur(12px);
}

.tab-button {
  min-height: 42px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 850;
}

.tab-button.active {
  color: #06201b;
  border-color: transparent;
  background: var(--brand);
}

.tab-panel {
  display: none;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.8rem;
  line-height: 1.05;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.18rem;
  line-height: 1.2;
}

h3 {
  margin-bottom: 6px;
  font-size: 1rem;
  line-height: 1.2;
}

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

.metric {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(45, 212, 191, 0.16);
  border-radius: var(--radius);
  background: rgba(16, 29, 26, 0.82);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.metric-button {
  text-align: left;
}

.metric-button.active {
  border-color: rgba(45, 212, 191, 0.42);
  background: rgba(45, 212, 191, 0.12);
}

.metric-value {
  display: block;
  font-size: 1.35rem;
  font-weight: 850;
}

.metric-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 8px 0 12px;
  background: linear-gradient(180deg, var(--bg), rgba(8, 19, 17, 0.88));
  backdrop-filter: blur(12px);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

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

.notice {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: var(--radius);
  color: #fde68a;
  background: rgba(120, 74, 0, 0.22);
  font-size: 0.88rem;
  line-height: 1.4;
}

.project-procurement-list,
.request-list,
.item-list {
  display: grid;
  gap: 10px;
}

.project-procurement-card,
.saved-request,
.request-panel,
.vendor-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.project-procurement-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
}

.project-procurement-card p,
.project-context p,
.saved-request p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.primary-button,
.secondary-button,
.text-button,
.icon-button {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  font-weight: 800;
}

.primary-button {
  padding: 0 16px;
  color: #06201b;
  background: var(--brand);
  box-shadow: 0 10px 22px rgba(45, 212, 191, 0.18);
}

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

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  color: var(--brand-strong);
  border: 1px solid rgba(45, 212, 191, 0.24);
  background: var(--surface-strong);
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  color: var(--brand-strong);
  background: transparent;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  flex: 0 0 44px;
  color: var(--brand-strong);
  border: 1px solid var(--line);
  background: var(--surface);
}

.compact {
  min-height: 40px;
  padding: 0 12px;
  font-size: 0.88rem;
}

.small {
  width: 36px;
  min-height: 36px;
  flex-basis: 36px;
  color: var(--danger);
}

.request-panel,
.vendor-panel {
  margin: 0 0 18px;
  padding: 14px;
}

.panel-header,
.section-title,
.items-header,
.item-title-row,
.request-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.project-context {
  margin: 12px 0 16px;
  padding: 13px;
  border-radius: var(--radius);
  background: rgba(23, 40, 36, 0.72);
}

.project-total {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 9px 11px;
  border: 1px solid rgba(45, 212, 191, 0.18);
  border-radius: var(--radius);
  color: var(--brand-strong);
  background: rgba(45, 212, 191, 0.08);
  font-weight: 850;
}

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

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

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

.field-grid {
  display: grid;
  gap: 12px;
}

.field-grid.tight {
  grid-template-columns: minmax(0, 1fr) minmax(90px, 0.6fr);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  outline: none;
}

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

textarea {
  resize: vertical;
  padding: 12px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(45, 212, 191, 0.68);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.14);
}

.item-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px dashed rgba(45, 212, 191, 0.28);
  border-radius: var(--radius);
  background: rgba(12, 24, 21, 0.72);
}

.vendor-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.vendor-toolbar {
  position: static;
  margin-bottom: 14px;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
}

.vendor-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(12, 24, 21, 0.72);
}

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

.vendor-card h3 {
  margin-bottom: 4px;
}

.vendor-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.vendor-balance {
  padding: 10px 12px;
  border: 1px solid rgba(45, 212, 191, 0.18);
  border-radius: var(--radius);
  color: var(--brand-strong);
  background: rgba(45, 212, 191, 0.08);
  font-weight: 850;
}

.vendor-pending-summary {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.assigned-projects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.assigned-projects span {
  display: inline-flex;
  max-width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
}

.item-index {
  color: var(--brand-strong);
  font-size: 0.82rem;
  font-weight: 850;
}

.sticky-actions {
  position: sticky;
  bottom: 10px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 0.75fr;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(16, 29, 26, 0.92);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(12px);
}

.inline-actions {
  position: static;
}

.saved-section {
  margin-top: 18px;
}

.section-title {
  margin-bottom: 10px;
}

.section-title h2 {
  margin-bottom: 0;
}

.saved-request {
  display: grid;
  gap: 10px;
  padding: 12px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.2);
}

.request-line {
  gap: 0;
  cursor: pointer;
}

.request-main {
  align-items: center;
}

.request-main h3 {
  margin-bottom: 4px;
  font-size: 0.96rem;
}

.saved-request select {
  width: 100%;
  min-height: 40px;
  font-size: 0.82rem;
}

.list-heading {
  margin-bottom: 10px;
}

.request-stage-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-strong);
  font-size: 0.8rem;
  font-weight: 850;
}

.request-stage-pill.is-pending {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.34);
  background: rgba(127, 29, 29, 0.32);
}

.request-stage-pill.is-pending-amount {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.32);
  background: rgba(120, 74, 0, 0.24);
}

.request-stage-pill.is-completed {
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.3);
  background: rgba(20, 83, 45, 0.28);
}

.request-detail {
  margin-bottom: 12px;
}

.request-detail-card {
  gap: 14px;
  border-color: rgba(45, 212, 191, 0.32);
}

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

.danger-button {
  color: #fecaca;
  border: 1px solid rgba(248, 113, 113, 0.32);
  background: rgba(127, 29, 29, 0.24);
}

.empty-state {
  padding: 22px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(16, 29, 26, 0.58);
  text-align: center;
}

.hidden {
  display: none !important;
}

@media (min-width: 720px) {
  .app-shell {
    padding: 28px 24px 90px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .summary-grid {
    max-width: 760px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  main {
    display: block;
  }

  .request-panel,
  .vendor-panel,
  .project-procurement-list {
    max-width: 760px;
  }

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

  .field-grid.tight {
    grid-template-columns: minmax(0, 1fr) minmax(100px, 0.6fr);
  }
}
