/* @import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap'); */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

/* ===== Design tokens ===== */
:root {
  --color-bg: #FAFAF8;
  --color-surface: #FFFFFF;
  --color-border: #E6E4DC;
  --color-border-strong: #D8D5C9;

  --color-sidebar: #1B1F27;
  --color-sidebar-hover: #262B36;
  --color-sidebar-text: #A9AEBB;
  --color-sidebar-text-active: #FFFFFF;

  --color-text: #1C1F26;
  --color-text-muted: #6B7280;
  --color-text-faint: #9AA0AC;

  --color-accent: #C2760F;
  --color-accent-dark: #9C5D0A;
  --color-accent-tint: #FDF1DC;

  --color-teal: #0E7490;
  --color-teal-tint: #E0F2FE;

  --color-success: #166534;
  --color-success-tint: #DCFCE7;

  --color-danger: #991B1B;
  --color-danger-tint: #FEE2E2;

  --color-warning: #92400E;
  --color-warning-tint: #FDF1DC;

  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow-card: 0 1px 2px rgba(20,20,20,0.04), 0 4px 16px rgba(20,20,20,0.03);
  --shadow-pop: 0 8px 24px rgba(20,20,20,0.10);

  --sidebar-width: 232px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.01em; }

a { color: inherit; text-decoration: none; }

::selection { background: var(--color-accent-tint); color: var(--color-accent-dark); }

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ===== App shell / sidebar nav ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-sidebar);
  color: var(--color-sidebar-text);
  padding: 22px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 22px 8px;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.brand-text { line-height: 1.15; }
.brand-text .name { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: #fff; }
.brand-text .sub { font-size: 11px; color: var(--color-sidebar-text); letter-spacing: 0.04em; text-transform: uppercase; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-sidebar-text);
  transition: background-color 0.12s ease, color 0.12s ease;
}

.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.85; }

.nav-item:hover { background: var(--color-sidebar-hover); color: #fff; }

.nav-item.active {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  color: #fff;
}
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding: 10px 8px 2px 8px;
  font-size: 11px;
  color: #565C6B;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 34px 40px 60px 40px;
  max-width: 1180px;
}

/* Mobile: sidebar collapses to a horizontal top bar */
@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    align-items: center;
    padding: 12px 14px;
    overflow-x: auto;
  }
  .brand { padding: 0 14px 0 2px; }
  .sidebar-nav { flex-direction: row; margin-top: 0; }
  .nav-item span { display: none; }
  .nav-item { padding: 9px; }
  .sidebar-footer { display: none; }
  .main { padding: 22px 18px 40px 18px; }
}

/* ===== Page header ===== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.page-header h1 { font-size: 24px; font-weight: 700; color: var(--color-text); }
.page-header p { margin: 4px 0 0 0; color: var(--color-text-muted); font-size: 13.5px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.05s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-dark); }

.btn-secondary { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border-strong); }
.btn-secondary:hover { background: #F2F1EC; }

.btn-ghost { background: transparent; color: var(--color-text-muted); border: 1px solid transparent; }
.btn-ghost:hover { background: #F2F1EC; color: var(--color-text); }

.btn-sm { padding: 6px 11px; font-size: 12.5px; }

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

/* ===== Cards ===== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 22px 22px;
  margin-bottom: 22px;
}

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

.card-header h2 { font-size: 15px; font-weight: 600; color: var(--color-text); }
.card-header .hint { font-size: 12.5px; color: var(--color-text-faint); }

/* ===== KPI stat cards ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}
.stat-card.teal { border-left-color: var(--color-teal); }
.stat-card.ink { border-left-color: #1B1F27; }

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--color-text);
}

.stat-value .unit { font-size: 14px; font-weight: 600; color: var(--color-text-muted); margin-left: 3px; }

/* ===== Forms ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 11px;
  font-family: var(--font-body);
  font-size: 13.5px;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-tint);
  outline: none;
}

.field input::placeholder { color: var(--color-text-faint); }

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

/* ===== Feedback banner ===== */
.msg-banner {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  display: none;
}
.msg-banner.visible { display: block; }
.msg-banner.success { background: var(--color-success-tint); color: var(--color-success); }
.msg-banner.error { background: var(--color-danger-tint); color: var(--color-danger); }

/* ===== Table ===== */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-faint);
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border-strong);
  white-space: nowrap;
}

tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: middle;
}

tbody tr:hover { background: #FBFAF7; }
tbody tr:last-child td { border-bottom: none; }

.cell-muted { color: var(--color-text-muted); }
.cell-strong { font-weight: 600; }

.table-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  font-family: var(--font-body);
  color: var(--color-text);
}
.table-input:hover { border-color: var(--color-border-strong); }
.table-input:focus {
  border-color: var(--color-accent);
  background: var(--color-surface);
  box-shadow: 0 0 0 3px var(--color-accent-tint);
  outline: none;
}

/* ===== Status badge + select ===== */
.status-select {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-body);
  appearance: none;
  -webkit-appearance: none;
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236B7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.status-select[data-status="Pending"] { background-color: #F1F0EC; color: #6B7280; }
.status-select[data-status="DP Paid"] { background-color: var(--color-accent-tint); color: var(--color-warning); }
.status-select[data-status="Delivered"] { background-color: var(--color-teal-tint); color: var(--color-teal); }
.status-select[data-status="Completed"] { background-color: var(--color-success-tint); color: var(--color-success); }
.status-select[data-status="Canceled"] { background-color: var(--color-danger-tint); color: var(--color-danger); }

/* ===== Toolbar / filters ===== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 18px;
}
.toolbar .field { flex: 1 1 160px; min-width: 140px; margin-bottom: 0; }
.toolbar .field-actions { display: flex; gap: 8px; }

/* ===== Pagination ===== */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--color-text-muted);
}
.pagination-controls { display: flex; gap: 8px; }

/* ===== Empty state ===== */
.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--color-text-faint);
  font-size: 13.5px;
}

/* ===== Utility ===== */
.text-right { text-align: right; }
.mt-0 { margin-top: 0 !important; }
.w-auto { width: auto !important; }
