:root {
  --bg: #f4f7f2;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #64748b;
  --line: #d7dfdd;
  --teal: #0f766e;
  --teal-dark: #123b3a;
  --green: #2f855a;
  --amber: #b7791f;
  --red: #b42318;
  --blue: #2563eb;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

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

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

.login-panel {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 28px;
}

.login-brand h1 {
  margin: 0;
  font-size: 26px;
}

.login-brand p {
  margin: 4px 0 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 16px;
}

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

.sidebar {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  gap: 24px;
  background: #123b3a;
  color: #f8fafc;
  padding: 24px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #f7c948;
  color: #17202a;
  font-weight: 800;
}

.brand-name {
  font-size: 18px;
  font-weight: 750;
}

.brand-subtitle {
  margin-top: 4px;
  color: #bad5d0;
  font-size: 13px;
}

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

.nav-button {
  display: grid;
  min-height: 48px;
  width: 100%;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: transparent;
  color: #eef6f4;
  padding: 10px 12px;
  text-align: left;
}

.nav-button.is-active {
  background: #eef6f4;
  color: #123b3a;
}

.nav-icon,
.nav-count {
  display: inline-grid;
  place-items: center;
}

.nav-count {
  min-width: 26px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 12px;
  font-weight: 700;
}

.nav-button.is-active .nav-count {
  background: #d9ece7;
}

.nav-count-empty {
  visibility: hidden;
}

.account-box {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 18px;
}

.account-name {
  font-weight: 750;
}

.account-meta {
  margin: 4px 0 14px;
  color: #bad5d0;
  font-size: 13px;
}

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

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

.view-header.compact {
  margin-bottom: 14px;
}

.view-header h2,
.detail-header h2 {
  margin: 0;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.15;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 750;
  text-transform: uppercase;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.summary-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px 16px;
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.summary-item strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.filter-bar {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.filter-bar label {
  min-width: 150px;
}

.grow {
  flex: 1;
}

label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  min-height: 42px;
  width: 100%;
  border: 1px solid #cbd5d1;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 9px 11px;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  outline: 3px solid rgba(15, 118, 110, 0.18);
}

.button,
.icon-button {
  border: 0;
  border-radius: 8px;
  font-weight: 750;
}

.button {
  min-height: 42px;
  padding: 9px 14px;
}

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

.button-secondary {
  background: var(--blue);
  color: #ffffff;
}

.button-danger {
  background: var(--red);
  color: #ffffff;
}

.button-ghost {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.button-small {
  min-height: 34px;
  background: #e7f0ed;
  color: #123b3a;
  padding: 6px 10px;
}

.full-width {
  width: 100%;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  background: #e7f0ed;
  color: #123b3a;
  font-size: 20px;
}

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

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

th,
td {
  border-bottom: 1px solid #e6ecea;
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
}

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

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

.align-right {
  text-align: right;
}

.mobile-list {
  display: none;
}

.mobile-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  margin-bottom: 10px;
  padding: 14px;
  text-align: left;
}

.mobile-row span {
  display: grid;
  gap: 5px;
}

.mobile-row span:last-child {
  justify-items: end;
  text-align: right;
}

.mobile-row small {
  color: var(--muted);
  font-size: 12px;
}

.inventory-row {
  cursor: default;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
}

.status-approved {
  background: #dff4e8;
  color: var(--green);
}

.status-draft {
  background: #e2e8f0;
  color: #475569;
}

.status-rejected,
.status-voided {
  background: #fee4e2;
  color: var(--red);
}

.status-submitted {
  background: #fff4d6;
  color: var(--amber);
}

.notice,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  margin-bottom: 14px;
  padding: 12px 14px;
}

.notice-error {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--red);
}

.notice-warning {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.notice-success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.user-admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.form-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
}

.form-panel h3 {
  margin: 0;
  font-size: 18px;
}

.receipt-form-panel {
  max-width: 1040px;
}

.receipt-form-panel form {
  display: grid;
  gap: 18px;
}

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

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

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

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

.section-heading-row h3,
.section-heading-row h4 {
  margin: 0;
}

.quick-material-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quick-material-chip {
  display: grid;
  min-width: 180px;
  max-width: 240px;
  gap: 4px;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  background: #ecfeff;
  color: #155e75;
  padding: 10px 12px;
  text-align: left;
}

.quick-material-chip span {
  color: var(--teal);
  font-size: 13px;
}

.receipt-item-list {
  display: grid;
  gap: 12px;
}

.receipt-item-card {
  display: grid;
  gap: 12px;
  border: 1px solid #e6ecea;
  border-radius: 8px;
  background: #fbfdfc;
  padding: 14px;
}

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

.line-total-row {
  color: var(--muted);
  font-size: 13px;
}

.receipt-total-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}

.receipt-total-row strong {
  font-size: 22px;
}

.user-actions {
  white-space: nowrap;
}

.drawer-backdrop,
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(15, 23, 42, 0.36);
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(540px, 100vw);
  overflow: auto;
  background: #ffffff;
  padding: 26px;
  box-shadow: var(--shadow);
}

.drawer-close {
  position: sticky;
  top: 0;
  float: right;
}

.detail-header {
  margin-bottom: 18px;
  padding-right: 52px;
}

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

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

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

dd {
  margin: 6px 0 0;
  font-weight: 700;
}

.detail-note {
  border-left: 4px solid #f7c948;
  background: #fffbeb;
  margin: 0 0 16px;
  padding: 12px;
}

.line-items h3 {
  margin: 18px 0 10px;
}

.line-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #e6ecea;
  padding: 12px 0;
}

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

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.reason-modal {
  width: min(480px, calc(100vw - 32px));
  border-radius: 8px;
  background: #ffffff;
  margin: 10vh auto;
  padding: 22px;
  box-shadow: var(--shadow);
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: auto;
    gap: 16px;
    padding: 16px;
  }

  .nav-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  }

  .nav-button {
    min-height: 54px;
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    padding: 8px;
  }

  .nav-icon,
  .nav-count {
    display: none;
  }

  .account-box {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    margin-top: 0;
    padding-top: 12px;
  }

  .account-meta {
    margin-bottom: 0;
  }

  .account-box .button {
    width: auto;
  }

  .content {
    padding: 18px;
  }

  .filter-bar,
  .view-header {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .table-shell {
    display: none;
  }

  .user-admin-grid {
    grid-template-columns: 1fr;
  }

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

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

  .mobile-list {
    display: block;
  }

  .detail-drawer {
    padding: 20px;
  }
}

@media (max-width: 520px) {
  .login-panel {
    padding: 22px;
  }

  .brand-name {
    font-size: 16px;
  }

  .view-header h2,
  .detail-header h2 {
    font-size: 24px;
  }

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

  .line-item {
    align-items: flex-start;
    flex-direction: column;
  }
}
