:root {
  --background: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --surface-green: #f5fbf5;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --nav: #131b2e;
  --nav-muted: #bec6e0;
  --primary: #006948;
  --primary-bright: #00855d;
  --primary-soft: #dff8ec;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --error: #ba1a1a;
  --error-soft: #fee2e2;
  --success: #059669;
  --success-soft: #dcfce7;
  --radius: 8px;
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

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

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

button {
  cursor: pointer;
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 440px) 1fr;
  background:
    radial-gradient(circle at 80% 20%, rgba(104, 219, 169, 0.32), transparent 28%),
    linear-gradient(135deg, #f5fbf5, #eef6f0 45%, #ffffff);
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px;
  background: rgba(255, 255, 255, 0.84);
  border-right: 1px solid var(--border);
}

.login-art {
  padding: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: min(520px, 100%);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
}

.login-panel h1,
.page-title h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: 0;
}

.login-panel p,
.page-title p {
  color: var(--muted);
  margin: 8px 0 0;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  background: var(--nav);
  color: white;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.sidebar h1 {
  font-size: 18px;
  margin: 0;
}

.sidebar small {
  color: var(--nav-muted);
}

.nav {
  margin-top: 32px;
  display: grid;
  gap: 4px;
}

.nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  color: var(--nav-muted);
  background: transparent;
  padding: 12px 14px;
  border-left: 4px solid transparent;
  border-radius: 4px;
  text-align: left;
  font-weight: 600;
}

.nav button.active {
  color: #85f8c4;
  background: rgba(255, 255, 255, 0.08);
  border-left-color: #68dba9;
}

.nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.main {
  margin-left: 240px;
  min-height: 100vh;
}

.topbar {
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.search {
  max-width: 440px;
  flex: 1;
  position: relative;
}

.search span {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}

.search input {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 11px 12px 11px 42px;
  outline: none;
}

.content {
  padding: 32px;
  max-width: 1440px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

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

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

.quick-button {
  min-height: 96px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 6px;
  padding: 16px;
  text-align: left;
  box-shadow: var(--shadow);
}

.quick-button .material-symbols-outlined {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
}

.quick-button strong {
  font-size: 18px;
}

.quick-button span:not(.material-symbols-outlined) {
  color: var(--muted);
  font-size: 12px;
}

.inventory-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.inventory-action {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  min-height: 86px;
  padding: 14px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  column-gap: 12px;
  align-items: center;
  text-align: left;
  box-shadow: var(--shadow);
}

.inventory-action .material-symbols-outlined {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  grid-row: span 2;
}

.inventory-action strong {
  font-size: 16px;
}

.inventory-action span:not(.material-symbols-outlined) {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
}

.btn.primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.btn.danger {
  color: var(--error);
  border-color: var(--error-soft);
  background: var(--error-soft);
}

.btn.ghost {
  background: transparent;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

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

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

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

.metric-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}

.metric label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 26px 0 12px;
}

.section-title h2 {
  margin: 0;
  font-size: 18px;
}

.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.table-tools {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.input,
.select,
.textarea {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  min-height: 40px;
  padding: 9px 11px;
  outline: none;
  width: 100%;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 105, 72, 0.14);
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

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

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

td.num,
th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tr:hover td {
  background: #fbfdfb;
}

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

.customer-table table {
  table-layout: fixed;
}

.customer-table th:nth-child(1),
.customer-table td:nth-child(1) {
  width: 24%;
}

.customer-table th:nth-child(2),
.customer-table td:nth-child(2) {
  width: 28%;
}

.customer-table th:nth-child(3),
.customer-table td:nth-child(3) {
  width: 16%;
}

.customer-table th:nth-child(4),
.customer-table td:nth-child(4) {
  width: 12%;
}

.customer-table th:nth-child(5),
.customer-table td:nth-child(5) {
  width: 10%;
}

.customer-table th:nth-child(6),
.customer-table td:nth-child(6) {
  width: 10%;
}

.customer-table td {
  overflow-wrap: anywhere;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
}

.chip.success {
  background: var(--success-soft);
  color: #047857;
}

.chip.warn {
  background: var(--warning-soft);
  color: #92400e;
}

.chip.error {
  background: var(--error-soft);
  color: var(--error);
}

.empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.38);
  z-index: 50;
  display: none;
}

.drawer-backdrop.open {
  display: block;
}

.drawer {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: min(520px, 100%);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  box-shadow: -10px 0 30px rgba(15, 23, 42, 0.12);
}

.drawer-head,
.drawer-foot {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-foot {
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

.drawer-body {
  padding: 20px;
  overflow: auto;
}

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

.field label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.checkbox-field {
  display: flex;
  align-items: end;
}

.checkbox-field label {
  min-height: 42px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
}

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

.customer-table .row-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.customer-table .row-actions .btn {
  min-height: 34px;
  padding: 0 10px;
}

.line-list {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.line-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px 44px;
  gap: 8px;
  align-items: center;
}

.line-item .btn {
  min-height: 42px;
  padding: 0;
  justify-content: center;
}

.customer-summary {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  padding: 0 12px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-summary.selected {
  color: var(--text);
  font-weight: 700;
}

.customer-picker {
  position: fixed;
  left: 50%;
  top: 72px;
  transform: translateX(-50%);
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 120px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.22);
  padding: 14px;
  z-index: 75;
}

.picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.picker-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: 8px;
}

.icon-btn {
  min-height: 42px;
  padding: 0;
}

.customer-picker-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  margin-top: 10px;
}

.customer-option {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 10px 12px;
  text-align: left;
}

.customer-option strong,
.customer-option span {
  display: block;
}

.customer-option span {
  color: var(--muted);
  margin-top: 3px;
  font-size: 12px;
}

.quick-create {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.quick-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  padding: 13px 16px;
  background: var(--nav);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 80;
}

.bottom-nav {
  display: none;
}

.mobile-cards {
  display: none;
}

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

  .login-art {
    display: none;
  }

  .sidebar {
    display: none;
  }

  .main {
    margin-left: 0;
    padding-bottom: 68px;
  }

  .topbar {
    display: none;
  }

  .content {
    padding: 16px;
  }

  .dashboard-head {
    display: none;
  }

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

  .mobile-hidden {
    display: none;
  }

  .page-head {
    display: grid;
    margin-bottom: 14px;
  }

  .page-head .actions,
  .page-title p {
    display: none;
  }

  .page-title h1 {
    font-size: 22px;
  }

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

  .quick-button {
    min-height: 128px;
    padding: 16px;
  }

  .quick-button .material-symbols-outlined {
    width: 42px;
    height: 42px;
    font-size: 24px;
  }

  .quick-button strong {
    font-size: 20px;
  }

  .quick-button span:not(.material-symbols-outlined) {
    font-size: 12px;
    line-height: 1.35;
  }

  .inventory-actions {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }

  .inventory-action {
    min-height: 76px;
  }

  .desktop-table {
    display: none;
  }

  .mobile-cards {
    display: grid;
    gap: 12px;
  }

  .mobile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
  }

  .mobile-card strong {
    display: block;
    margin-bottom: 4px;
  }

  .mobile-card span {
    color: var(--muted);
  }

  .mobile-card .row-actions {
    margin-top: 12px;
    flex-wrap: wrap;
  }

  .bottom-nav {
    position: fixed;
    z-index: 30;
    left: 0;
    right: 0;
    bottom: 0;
    height: 58px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: #dee4de;
    border-top: 1px solid var(--border-strong);
  }

  .bottom-nav button {
    border: 0;
    background: transparent;
    color: var(--muted);
    display: grid;
    place-items: center;
    gap: 2px;
    font-size: 10px;
  }

  .bottom-nav button.active {
    color: var(--primary);
    font-weight: 800;
  }

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

  .line-item {
    grid-template-columns: 1fr;
  }
}
