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

:root {
  --navy-950: #0b1220;
  --navy-900: #10192e;
  --navy-800: #16213d;
  --navy-700: #1e2c4d;
  --accent: #c9a24b;
  --accent-soft: #f4e8cb;
  --ink: #1c2333;
  --muted: #6b7488;
  --bg: #f5f6fa;
  --card: #ffffff;
  --border: #e6e8f0;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20,25,45,.05);
  --shadow-md: 0 1px 3px rgba(20,25,45,.05), 0 8px 24px rgba(20,25,45,.05);
  --shadow-lg: 0 20px 60px rgba(15,20,35,.35);
  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

html[data-theme="dark"] {
  --navy-950: #05070c;
  --navy-900: #0c1424;
  --navy-800: #121b30;
  --navy-700: #1a2740;
  --accent: #e0b862;
  --accent-soft: #3a331c;
  --ink: #e6e9f2;
  --muted: #8993ab;
  --bg: #0b0f18;
  --card: #131a29;
  --border: #232d42;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 1px 3px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.25);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.55);
}

html[data-theme="dark"] .kanban-col { background: #182031; }
html[data-theme="dark"] .table { color: var(--ink); }
html[data-theme="dark"] .table thead { color: var(--muted); }
html[data-theme="dark"] .form-control, html[data-theme="dark"] .form-select {
  background-color: var(--card); color: var(--ink); border-color: var(--border);
}
html[data-theme="dark"] .form-control:focus, html[data-theme="dark"] .form-select:focus {
  background-color: var(--card); color: var(--ink);
}
html[data-theme="dark"] .modal-content { background-color: var(--card); color: var(--ink); }
html[data-theme="dark"] .bg-light { background-color: var(--navy-800) !important; color: var(--ink); }
html[data-theme="dark"] .text-dark { color: var(--ink) !important; }
html[data-theme="dark"] .btn-outline-secondary { color: var(--muted); border-color: var(--border); }
html[data-theme="dark"] .btn-outline-dark { color: var(--ink); border-color: var(--border); }
html[data-theme="dark"] a { color: #8fb4ff; }
html[data-theme="dark"] .dropdown-menu { background-color: var(--card); color: var(--ink); }
html[data-theme="dark"] .alert-light { background-color: var(--navy-800); color: var(--ink); border-color: var(--border); }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.94rem;
  transition: background .15s, color .15s;
}

a { text-decoration: none; }

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ink);
}
.card-header { font-weight: 600; letter-spacing: -.005em; }

/* ---------- Layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy-950), var(--navy-800));
  color: #d8dced;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 1030;
  transition: transform .2s;
}
html.sidebar-hidden .sidebar { transform: translateX(-100%); }
html.sidebar-hidden .main-wrap { margin-left: 0; }
html.sidebar-hidden .sidebar-reopen-btn { display: flex !important; }
.sidebar-reopen-btn {
  display: none; position: fixed; top: 14px; left: 14px; z-index: 1031;
  width: 38px; height: 38px; border-radius: var(--radius-sm); align-items: center; justify-content: center;
  background: var(--navy-900); color: var(--accent); border: none; cursor: pointer;
  box-shadow: var(--shadow-md);
}

.sidebar .brand {
  padding: 1.4rem 1.3rem 1rem;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -.01em;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: .6rem;
}
.sidebar .brand i { color: var(--accent); font-size: 1.4rem; }

.sidebar .nav-section-title {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #6d7a99;
  padding: 1rem 1.3rem .3rem;
}

.sidebar .nav-link {
  color: #b9c1d9;
  padding: .55rem 1.3rem;
  display: flex;
  align-items: center;
  gap: .7rem;
  font-size: .88rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: background .12s, color .12s;
}
.sidebar .nav-link i { width: 18px; text-align: center; color: #7c88a8; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: #fff;
  font-weight: 600;
  border-left-color: var(--accent);
}
.sidebar .nav-link.active i { color: var(--accent); }
.sidebar .nav-children { padding-left: 2.1rem; }
.sidebar .nav-children .nav-link { padding: .4rem 1.3rem .4rem 0; font-size: .84rem; }

.main-wrap { margin-left: 260px; width: 100%; min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .2s; }

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.topbar .page-title { font-weight: 700; font-size: 1.15rem; letter-spacing: -.01em; color: var(--ink); }
.topbar .user-chip { display: flex; align-items: center; gap: .6rem; }
.topbar .user-chip > .text-end {
  border-left: 1px solid var(--border);
  padding-left: .8rem;
  margin-left: .1rem;
}
.topbar .user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--navy-800); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.topbar .btn.btn-outline-secondary,
.topbar .btn.btn-outline-danger {
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.content { padding: 1.6rem; flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  border-radius: var(--radius-sm);
  font-weight: 600;
  letter-spacing: -.005em;
}
.btn-dark {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: #fff;
}
.btn-dark:hover, .btn-dark:focus {
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: #fff;
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--accent) 35%, transparent);
}
.btn-outline-dark {
  color: var(--navy-900);
  border-color: var(--navy-700);
}
.btn-outline-dark:hover {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: #fff;
}
.btn-outline-secondary {
  color: var(--muted);
  border-color: var(--border);
}
.btn-outline-secondary:hover {
  background: var(--bg);
  border-color: var(--muted);
  color: var(--ink);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--accent) 40%, transparent);
}

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.card-header { background: transparent; border-bottom: 1px solid var(--border); font-weight: 600; }

.stat-card { padding: 1.2rem 1.4rem; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; color: var(--navy-900); }
html[data-theme="dark"] .stat-card .stat-value { color: var(--ink); }
.stat-card .stat-label { color: var(--muted); font-size: .82rem; }
.stat-card .stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-size: 1.2rem;
}
.stat-icon-blue { background: #dbe4ff !important; color: #3b5bdb !important; }
.stat-icon-orange { background: #ffe8cc !important; color: #e8590c !important; }
.stat-icon-green { background: #d3f9d8 !important; color: #2f9e44 !important; }
.stat-icon-red { background: #ffe3e3 !important; color: #e03131 !important; }
.stat-icon-purple { background: #eadcfb !important; color: #9c36b5 !important; }
html[data-theme="dark"] .stat-icon-blue { background: #1c2a4d !important; color: #7c9cff !important; }
html[data-theme="dark"] .stat-icon-orange { background: #402c14 !important; color: #ffa94d !important; }
html[data-theme="dark"] .stat-icon-green { background: #163a1f !important; color: #69db7c !important; }
html[data-theme="dark"] .stat-icon-red { background: #401818 !important; color: #ff8787 !important; }
html[data-theme="dark"] .stat-icon-purple { background: #331a45 !important; color: #d0a6f0 !important; }

/* ---------- Badges ---------- */
.badge { font-weight: 600; padding: .38em .7em; border-radius: var(--radius-sm); letter-spacing: -.005em; }

/* ---------- Kanban ---------- */
.kanban-board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: .5rem; }
.kanban-col {
  min-width: 270px; max-width: 270px;
  background: #eef0f6;
  border-radius: var(--radius-md);
  padding: .8rem;
  flex-shrink: 0;
}
.kanban-col-title {
  font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); margin-bottom: .6rem; display: flex; justify-content: space-between;
}
.kanban-card {
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: .7rem .8rem;
  margin-bottom: .6rem;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  border: 1px solid var(--border);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .4; }
.kanban-card .title { font-weight: 600; font-size: .88rem; margin-bottom: .3rem; }
.kanban-card .meta { font-size: .76rem; color: var(--muted); }
.kanban-col.drag-over { outline: 2px dashed var(--accent); outline-offset: -4px; }
.stage-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .4rem; }
.avatar-chip {
  width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: .7rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-left: .4rem;
}
.kanban-card.card-overdue { border-left: 3px solid #e03131; }
.kanban-card.card-stale { border-left: 3px solid #f08c00; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at top left, var(--navy-800), var(--navy-950));
}
.login-card {
  background: var(--card); border-radius: var(--radius-lg); padding: 2.4rem;
  width: 100%; max-width: 400px; box-shadow: var(--shadow-lg);
}
.login-card .brand-icon {
  width: 56px; height: 56px; border-radius: var(--radius-sm);
  background: var(--navy-900); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 1.6rem; margin-bottom: 1rem;
}

.checklist-item { display: flex; align-items: center; gap: .6rem; padding: .5rem .2rem; border-bottom: 1px dashed var(--border); }
.checklist-item:last-child { border-bottom: none; }
.checklist-item.done .title { text-decoration: line-through; color: var(--muted); }
.category-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.table thead th { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom-width: 1px; }

.photo-lightbox-img.zoomed { max-width: none !important; max-height: none !important; cursor: zoom-out; }

@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
}

.help-modal-body h6 { font-weight: 700; color: var(--navy-900); margin-top: 1rem; }
.help-modal-body h6:first-child { margin-top: 0; }
.help-modal-body ol, .help-modal-body ul { padding-left: 1.2rem; }
.help-modal-body li { margin-bottom: .35rem; }
.help-modal-body p { font-size: .9rem; }
.help-scenario-step { display: flex; gap: .9rem; padding: .9rem 0; border-bottom: 1px dashed var(--border); }
.help-scenario-step:last-child { border-bottom: none; }
.help-scenario-num {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
  background: var(--navy-900); color: var(--accent); font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: .85rem;
}
