/* ── Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f8f7f5;
  --bg2:       #ffffff;
  --bg3:       #f2f1ef;
  --bg4:       #eae9e6;
  --border:    #e8e7e3;
  --border2:   #d8d7d2;
  --text:      #1a1917;
  --text2:     #6b6860;
  --text3:     #a8a69f;
  --accent:    #2563eb;
  --accent2:   #1d4ed8;
  --accent-bg: rgba(37,99,235,0.06);
  --accent-light: rgba(37,99,235,0.1);
  --red:       #dc2626;
  --green:     #16a34a;
  --blue:      #2563eb;
  --sidebar-w: 230px;
  --radius:    8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:    0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --font-display: 'Open Sans', sans-serif;
  --font-body: 'Open Sans', sans-serif;
  --font-mono: 'Open Sans', monospace;
  font-size: 15px;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Open Sans', sans-serif;
  letter-spacing: -0.01em;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* ── App Shell ───────────────────────────────── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  width: 30px;
  height: 30px;
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}

.logo-text {
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  --font-display: 'Open Sans', sans-serif;
  --font-body: 'Open Sans', sans-serif;
  --font-mono: 'Open Sans', monospace;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-bottom {
  padding: 8px 8px 16px;
  border-top: 1px solid var(--border);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--text2);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--bg3);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

/* ── Mobile nav toggle ───────────────────────── */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  z-index: 200;
  cursor: pointer;
}

.mobile-nav-toggle svg { width: 20px; height: 20px; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 150;
}

/* ── Bottom nav for mobile ───────────────────── */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  z-index: 100;
  justify-content: space-around;
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 12px;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s;
  text-decoration: none;
  font-family: 'Open Sans', sans-serif;
  letter-spacing: -0.01em;
}

.mobile-nav-btn svg { width: 20px; height: 20px; }
.mobile-nav-btn.active { color: var(--accent); }
.mobile-nav-btn:hover { color: var(--text); }

/* ── Main Content ────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

/* ── Dashboard Home ──────────────────────────── */
.dashboard-home {
  padding: 40px 40px 40px;
  max-width: 860px;
}

.home-header {
  margin-bottom: 32px;
}

.home-header h1 {
  font-family: 'Open Sans', sans-serif;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.04em;
  color: var(--text);
  margin-bottom: 4px;
}

.home-header p {
  color: var(--text2);
  font-size: 14px;
}

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

.home-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.home-card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.home-card-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-bg);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.home-card-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--accent);
}

.home-card h3 {
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  --font-display: 'Open Sans', sans-serif;
  --font-body: 'Open Sans', sans-serif;
  --font-mono: 'Open Sans', monospace;
  font-size: 15px;
  color: var(--text);
}

.home-card p {
  font-size: 12.5px;
  color: var(--text2);
  line-height: 1.6;
}

.card-arrow {
  position: absolute;
  bottom: 22px;
  right: 22px;
  color: var(--text3);
  font-size: 16px;
  transition: all 0.2s;
}

.home-card:hover .card-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* ── Page Header ─────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-header h1 {
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.page-header p {
  font-size: 13px;
  color: var(--text2);
  margin-top: 1px;
}

.page-body {
  padding: 28px;
}

/* ── Buttons ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

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

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg3); color: var(--text); border-color: var(--border2); }

.btn-danger {
  background: rgba(220,38,38,0.06);
  color: var(--red);
  border: 1px solid rgba(220,38,38,0.15);
}
.btn-danger:hover { background: rgba(220,38,38,0.12); }

.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-icon { padding: 7px; border-radius: 7px; }

/* ── Form Elements ───────────────────────────── */
.input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.input::placeholder { color: var(--text3); }

.label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
  display: block;
}

.field { margin-bottom: 14px; }

/* ── Modal ───────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  padding: 16px;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 400px;
  max-width: 100%;
  box-shadow: var(--shadow);
  transform: translateY(8px);
  transition: transform 0.2s;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-title {
  font-family: 'Open Sans', sans-serif;
  font-weight: 600;
  font-size: 17px;
  margin-bottom: 18px;
  color: var(--text);
}

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

/* ── Toast ───────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 16px;
  font-size: 13.5px;
  color: var(--text);
  animation: toastIn 0.2s ease;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 300px;
  box-shadow: var(--shadow);
}

.toast.success { border-color: rgba(22,163,74,0.25); }
.toast.error { border-color: rgba(220,38,38,0.25); }
.toast-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.toast.success .toast-dot { background: var(--green); }
.toast.error .toast-dot { background: var(--red); }
.toast.info .toast-dot { background: var(--blue); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ── Tag ─────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.tag-accent { background: var(--accent-bg); color: var(--accent); }
.tag-blue { background: rgba(37,99,235,0.08); color: var(--blue); }

/* ── Empty State ─────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 32px;
  text-align: center;
  color: var(--text3);
  gap: 10px;
}

.empty-state svg { width: 40px; height: 40px; opacity: 0.25; }
.empty-state h3 { font-family: 'Open Sans', sans-serif; font-size: 15px; font-weight: 600; color: var(--text2); }
.empty-state p { font-size: 13px; max-width: 260px; line-height: 1.6; color: var(--text3); }

/* ── Scrollbar ───────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; }

/* ── Divider ─────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 18px 0; }

/* ── Mobile Responsive ───────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    bottom: 0;
    z-index: 160;
    transition: left 0.25s ease;
    box-shadow: var(--shadow);
    width: 260px;
  }

  .sidebar.mobile-open { left: 0; }
  .sidebar-overlay.active { display: block; }
  .mobile-bottom-nav { display: flex; }
  .mobile-nav-toggle { display: flex; }

  .main-content { padding-bottom: 70px; }

  .dashboard-home {
    padding: 24px 16px;
  }

  .home-header h1 { font-size: 22px; }

  .home-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .page-header {
    padding: 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .page-header h1 { font-size: 18px; }

  .page-body { padding: 16px; }

  .toast-container {
    bottom: 80px;
    right: 12px;
    left: 12px;
  }

  .toast { max-width: 100%; }

  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; width: 100%; max-width: 100%; padding: 24px 20px; }
}

