/*
  Cenizas design system.
  Palette derived from the Cenizas mark: near-black background, a warm
  orange-to-red gradient on the robot glyph, and an amber arc. These
  tokens are also fed into the Tailwind CDN config in base.html so the
  same values are available as `bg-brand-500` etc. in templates.
*/

:root {
  --c-bg: #0a0a0f;
  --c-surface: #141420;
  --c-surface-raised: #1b1b29;
  --c-border: #2a2a3a;
  --c-border-light: #34344a;
  --c-text: #f4f4f5;
  --c-text-muted: #9a9aab;
  --c-text-faint: #6b6b7d;
  --c-brand-50: #fff3e8;
  --c-brand-300: #fbb36a;
  --c-brand-400: #fb923c;
  --c-brand-500: #f97316;
  --c-brand-600: #ea580c;
  --c-brand-700: #c2410c;
  --c-accent: #ef4444;
  --c-success: #22c55e;
  --c-warning: #eab308;
  --c-danger: #ef4444;
  --c-info: #38bdf8;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--c-brand-600); color: white; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c-border-light); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--c-brand-600); }

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

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  transition: transform .2s ease;
  z-index: 40;
}
.sidebar.collapsed { transform: translateX(-100%); }

.main-area { flex: 1; margin-left: 260px; min-height: 100vh; display: flex; flex-direction: column; }
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
}

.topbar {
  height: 64px;
  border-bottom: 1px solid var(--c-border);
  background: rgba(10,10,15,.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.content { padding: 28px; flex: 1; }

/* ---------- nav ---------- */
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; margin: 2px 12px;
  border-radius: var(--radius);
  color: var(--c-text-muted);
  font-size: 14px; font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--c-surface-raised); color: var(--c-text); }
.nav-link.active {
  background: linear-gradient(135deg, rgba(249,115,22,.18), rgba(234,88,12,.08));
  color: var(--c-brand-400);
  border: 1px solid rgba(249,115,22,.25);
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--c-text-faint); padding: 18px 24px 6px;
}

/* ---------- surfaces ---------- */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  padding: 20px;
}
.card-flush { padding: 0; overflow: hidden; }

.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  padding: 18px 20px;
}
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { font-size: 12.5px; color: var(--c-text-muted); font-weight: 500; }

/* ---------- form controls ---------- */
.input {
  width: 100%;
  background: var(--c-surface-raised);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--c-text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus {
  outline: none;
  border-color: var(--c-brand-500);
  box-shadow: 0 0 0 3px rgba(249,115,22,.15);
}
label.field-label { font-size: 13px; font-weight: 600; color: var(--c-text-muted); display: block; margin-bottom: 6px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; transition: all .15s;
  text-decoration: none;
}
.btn-primary { background: linear-gradient(135deg, var(--c-brand-500), var(--c-brand-600)); color: white; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--c-surface-raised); color: var(--c-text); border-color: var(--c-border-light); }
.btn-secondary:hover { border-color: var(--c-brand-500); }
.btn-danger { background: rgba(239,68,68,.12); color: #fca5a5; border-color: rgba(239,68,68,.35); }
.btn-danger:hover { background: rgba(239,68,68,.2); }
.btn-ghost { background: transparent; color: var(--c-text-muted); }
.btn-ghost:hover { color: var(--c-text); background: var(--c-surface-raised); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  border: 1px solid transparent;
}
.badge-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge-gray { background: rgba(154,154,171,.12); color: #c4c4d1; }
.badge-blue { background: rgba(56,189,248,.12); color: #7dd3fc; }
.badge-green { background: rgba(34,197,94,.12); color: #86efac; }
.badge-yellow { background: rgba(234,179,8,.12); color: #fde047; }
.badge-orange { background: rgba(249,115,22,.15); color: #fdba74; }
.badge-red { background: rgba(239,68,68,.12); color: #fca5a5; }
.badge-purple { background: rgba(168,85,247,.12); color: #d8b4fe; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--c-border); border-radius: 14px; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th {
  text-align: left; padding: 12px 16px; background: var(--c-surface);
  color: var(--c-text-muted); font-weight: 600; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
table.data-table td {
  padding: 12px 16px; border-bottom: 1px solid var(--c-border);
  color: var(--c-text); vertical-align: middle;
}
table.data-table tbody tr { background: var(--c-surface); transition: background .12s; }
table.data-table tbody tr:hover { background: var(--c-surface-raised); }
table.data-table tbody tr:last-child td { border-bottom: none; }

/* ---------- kanban ---------- */
.kanban-wrap { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; }
.kanban-column { flex: 0 0 280px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 14px; display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.kanban-column-header { padding: 14px 16px; border-bottom: 1px solid var(--c-border); font-size: 13px; font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.kanban-column-body { padding: 10px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kanban-column-body.drag-over { background: rgba(249,115,22,.06); outline: 2px dashed rgba(249,115,22,.4); outline-offset: -4px; }
.kanban-card {
  background: var(--c-surface-raised); border: 1px solid var(--c-border);
  border-radius: 10px; padding: 12px; cursor: grab; font-size: 13px;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .4; }
.kanban-card-title { font-weight: 600; margin-bottom: 6px; color: var(--c-text); text-decoration: none; display: block; }
.kanban-card-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }

/* ---------- avatar ---------- */
.avatar {
  width: 32px; height: 32px; border-radius: 999px;
  background: linear-gradient(135deg, var(--c-brand-500), var(--c-brand-700));
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 12.5px; flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 24px; height: 24px; font-size: 10.5px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }

/* ---------- progress ---------- */
.progress-track { height: 7px; border-radius: 999px; background: var(--c-border); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--c-brand-500), var(--c-brand-400)); transition: width .3s; }

/* ---------- modal / toast / dropdown ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(6,6,10,.7); backdrop-filter: blur(2px); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; }
.modal-panel { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 16px; width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0,0,0,.5); }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--c-border); display: flex; align-items: center; justify-content: space-between; }
.modal-body { padding: 22px; }

.dropdown-panel {
  position: absolute; right: 0; margin-top: 8px; width: 340px; max-height: 420px; overflow-y: auto;
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,.45); z-index: 50;
}

.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--c-surface-raised); border: 1px solid var(--c-border-light);
  border-left: 3px solid var(--c-brand-500); border-radius: 10px; padding: 12px 16px;
  min-width: 260px; font-size: 13.5px; box-shadow: 0 12px 30px rgba(0,0,0,.4);
  animation: toast-in .2s ease;
}
.toast.toast-success { border-left-color: var(--c-success); }
.toast.toast-error { border-left-color: var(--c-danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- empty state ---------- */
.empty-state { text-align: center; padding: 56px 20px; color: var(--c-text-muted); }
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 14px; color: var(--c-text-faint); }

/* ---------- misc ---------- */
.divider { border-top: 1px solid var(--c-border); }
.section-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.muted { color: var(--c-text-muted); }
.skeleton { background: linear-gradient(90deg, var(--c-surface) 25%, var(--c-surface-raised) 50%, var(--c-surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.brand-mark { display: flex; align-items: center; gap: 10px; }
.brand-mark img { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; }
.brand-mark span { font-weight: 800; font-size: 17px; letter-spacing: -0.01em; }

a.link-brand { color: var(--c-brand-400); text-decoration: none; }
a.link-brand:hover { text-decoration: underline; }
