:root {
  --sand-50: #FDFCFA;
  --sand-100: #F7F5F0;
  --sand-200: #EFECE4;
  --sand-300: #E6E2D8;
  --sage-50: #F2F5F2;
  --sage-100: #E3EAE4;
  --sage-500: #788E7D;
  --sage-600: #5E7463;
  --sage-700: #495B4D;
  --ink-900: #242824;
  --ink-600: #5C635C;
  --ink-400: #8B918B;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background: var(--sand-100);
  color: var(--ink-900);
  line-height: 1.45;
  overflow-x: hidden;
}
.hidden { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* Login Screen */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--sand-50);
  border: 1px solid var(--sand-300);
  border-radius: 26px;
  padding: 28px;
  text-align: center;
}
.login-logo { margin-bottom: 10px; }
.login-card h1 { font-size: 22px; font-weight: 700; }
.login-sub { font-size: 11px; letter-spacing: 0.1em; color: var(--ink-400); margin: 4px 0 20px; }
.stack-md { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--ink-600); }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: 12px;
  border: 1px solid var(--sand-300);
  background: var(--sand-100);
  font-size: 14px;
  color: var(--ink-900);
}
.error-box {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #991B1B;
  font-size: 12px;
  padding: 9px 12px;
  border-radius: 10px;
}
.login-hint { font-size: 11px; color: var(--ink-400); margin-top: 16px; }

/* Buttons */
.btn-primary {
  background: var(--sage-600);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-primary:hover { background: var(--sage-700); }
.btn-primary.sm { padding: 7px 13px; font-size: 12px; }
.btn-primary.full { width: 100%; padding: 12px; }
.btn-ghost {
  background: var(--sand-100);
  border: 1px solid var(--sand-300);
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--sand-50);
  border: 1px solid var(--sand-300);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* App Shell */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 270px;
  background: var(--sand-50);
  border-right: 1px solid var(--sand-300);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
}
.brand-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.brand-left { display: flex; align-items: center; gap: 10px; }
.brand-title { font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 10px; letter-spacing: 0.12em; color: var(--ink-400); }
.workspace-pill {
  background: var(--sand-100);
  border: 1px solid var(--sand-300);
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 16px;
}
.ws-name { font-size: 12px; font-weight: 700; }
.ws-meta { font-size: 11px; color: var(--ink-400); }
.nav-groups { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-400);
  padding: 10px 10px 4px;
}
.nav-item {
  text-align: left;
  padding: 9px 12px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-600);
}
.nav-item:hover { background: var(--sand-200); }
.nav-item.active { background: var(--sage-100); color: var(--sage-700); font-weight: 600; }
.sidebar-footer {
  border-top: 1px solid var(--sand-300);
  padding-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--sage-100);
  color: var(--sage-700);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-name { font-size: 12px; font-weight: 700; }
.user-role { font-size: 11px; color: var(--ink-400); }

/* Main Column */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px;
  background: rgba(247, 245, 240, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--sand-300);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.crumb { font-size: 13px; color: var(--ink-400); }
.crumb strong { color: var(--ink-900); }
.sync-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--sage-50);
  border: 1px solid var(--sage-100);
  color: var(--sage-700);
}
.content-area { padding: 20px; max-width: 1040px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

/* Cards & Grids */
.card {
  background: var(--sand-50);
  border: 1px solid var(--sand-300);
  border-radius: 22px;
  padding: 18px;
}
.hero-banner {
  background: var(--sage-100);
  border: 1px solid #D3DFD5;
  border-radius: 24px;
  padding: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-400); }
.page-title { font-size: 22px; font-weight: 700; }
.sub-text { font-size: 13px; color: var(--ink-600); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.kpi-num { font-size: 24px; font-weight: 700; margin: 6px 0 2px; }
.progress-track { height: 7px; background: var(--sand-200); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: var(--sage-600); border-radius: 999px; }

/* Lists, Pills & Forms */
.row-item {
  background: var(--sand-50);
  border: 1px solid var(--sand-300);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.sub-row {
  background: var(--sand-100);
  border-radius: 13px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form input, .inline-form select {
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid var(--sand-300);
  background: var(--sand-100);
  font-size: 13px;
}
.inline-form input.grow { flex: 1; min-width: 170px; }
.pill-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-tab {
  padding: 6px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--sand-50);
  border: 1px solid var(--sand-300);
  color: var(--ink-600);
}
.pill-tab.active { background: var(--sage-600); color: #fff; border-color: var(--sage-600); }
.badge { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--sage-100); color: var(--sage-700); }
.alert-card { background: #FFFBEB; border: 1px solid #FDE68A; border-radius: 20px; padding: 16px; }
.cam-box { background: #1F2420; color: #F7F5F0; border-radius: 18px; padding: 18px; min-height: 150px; display: flex; flex-direction: column; justify-content: space-between; }
.strike { text-decoration: line-through; color: var(--ink-400); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(36, 40, 36, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 80;
}
.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--sand-50);
  border: 1px solid var(--sand-300);
  border-radius: 22px;
  padding: 22px;
}

.mobile-only { display: none; }
@media (max-width: 900px) {
  .mobile-only { display: inline-flex; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); transition: transform 0.2s ease; }
  .sidebar.open { transform: translateX(0); }
  .backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3); z-index: 40; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
}
