/* ============================================================
   SHALIK FLOW — Production Management System
   Design language: dark navy studio, gold accent, timecode-style
   data labels, hairline film-strip dividers. Inspired by NLE
   (Resolve/Premiere) panel layouts — dense, legible, functional.
   ============================================================ */

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

:root {
  --navy-950: #0b0f1a;
  --navy-900: #0f1420;
  --navy-800: #161d2e;
  --navy-700: #1e273c;
  --navy-600: #2a3348;
  --line: #2a3348;
  --line-soft: #1e273c;
  --gold: #d4a73a;
  --gold-bright: #e6c565;
  --text: #e8e6de;
  --text-muted: #8b92a8;
  --text-dim: #5c6478;
  --green: #4caf7d;
  --amber: #e0a458;
  --red: #d9614f;
  --blue: #6c9bd1;
  --radius: 3px;
  --radius-lg: 6px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --font-body: 'Inter', -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--navy-950);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--gold); text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; margin: 0; color: var(--text); }
p { margin: 0 0 8px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
::selection { background: var(--gold); color: var(--navy-950); }

/* ---------- Film-strip divider (subject-matter motif) ---------- */
.filmstrip {
  height: 10px;
  background-image: repeating-linear-gradient(90deg, var(--navy-600) 0 6px, transparent 6px 14px);
  opacity: .55;
}

/* ---------- Timecode meta labels ---------- */
.tc {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

/* ---------- Layout shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--navy-900);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  padding: 20px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.sidebar-brand .mark { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--gold-bright); }
.sidebar-brand .role-tag { display: block; margin-top: 3px; }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13.5px;
  border-left: 2px solid transparent;
}
.nav-item:hover { background: var(--navy-800); color: var(--text); }
.nav-item.active { background: var(--navy-800); color: var(--gold-bright); border-left-color: var(--gold); }
.nav-item .badge-dot {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--red); color: #fff;
  font-size: 10px; font-family: var(--font-mono); display: none;
  align-items: center; justify-content: center;
}
.nav-item .badge-dot.show { display: inline-flex; }
.sidebar-foot { padding: 12px 14px; border-top: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 9px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy-700); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 13px; color: var(--gold-bright);
  flex-shrink: 0;
}
.user-chip .name { font-size: 13px; font-weight: 600; }
.user-chip .email { font-size: 11px; color: var(--text-dim); }
.logout-link { display: inline-block; margin-top: 8px; font-size: 12px; color: var(--text-muted); cursor: pointer; }
.logout-link:hover { color: var(--red); }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--line);
  background: var(--navy-950);
}
.topbar h1 { font-size: 19px; }
.topbar .sub { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.content { padding: 24px 28px 60px; max-width: 1180px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--navy-800);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--navy-700); border-color: var(--navy-600); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy-950); }
.btn-gold:hover { background: var(--gold-bright); border-color: var(--gold-bright); }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: rgba(217,97,79,.12); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--navy-800); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--navy-900);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.panel-head h3 { font-size: 15px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; }
.stat-box {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  background: var(--navy-800);
}
.stat-box .val { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--gold-bright); }
.stat-box .lbl { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-family: var(--font-mono); font-size: 11px;
  color: var(--text-dim); font-weight: 500; padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
td { padding: 10px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.015); }

/* ---------- Badges / status pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 100px;
  font-size: 11px; font-family: var(--font-mono); font-weight: 500;
  border: 1px solid var(--line);
  white-space: nowrap;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-pending { color: var(--text-muted); }
.pill-in_progress { color: var(--blue); }
.pill-delivered { color: var(--gold); }
.pill-revision_requested { color: var(--amber); }
.pill-completed { color: var(--green); }
.pill-active { color: var(--green); }
.pill-cancelled { color: var(--red); }
.pill-absent { color: var(--red); }
.pill-present { color: var(--green); }
.pill-half_day { color: var(--amber); }
.pill-leave { color: var(--blue); }

/* ---------- Forms ---------- */
label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; font-weight: 500; }
input, textarea, select {
  width: 100%; background: var(--navy-800); border: 1px solid var(--line);
  color: var(--text); padding: 9px 11px; border-radius: var(--radius);
  font-family: var(--font-body); font-size: 13.5px;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); }
textarea { resize: vertical; min-height: 70px; }
.field { margin-bottom: 14px; }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; }
.hint { font-size: 11.5px; color: var(--text-dim); margin-top: 4px; }
.star-input { display: flex; gap: 4px; font-size: 22px; cursor: pointer; }
.star-input span { color: var(--navy-600); }
.star-input span.on { color: var(--gold); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(6,9,15,.72);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--navy-900); border: 1px solid var(--line-soft); border-radius: var(--radius-lg);
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  padding: 22px 24px;
}
.modal h3 { margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 40px 20px; color: var(--text-dim);
  border: 1px dashed var(--line); border-radius: var(--radius-lg);
}
.empty .big { font-family: var(--font-mono); font-size: 12px; margin-bottom: 6px; color: var(--text-muted); }

/* ---------- Login page ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at top, #131a2a 0%, var(--navy-950) 60%);
  padding: 20px;
}
.login-card { width: 100%; max-width: 380px; }
.login-mark { text-align: center; margin-bottom: 26px; }
.login-mark .m1 { font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--text); }
.login-mark .m1 span { color: var(--gold-bright); }
.login-mark .tc { display: block; margin-top: 6px; }
.role-toggle { display: flex; gap: 6px; margin-bottom: 20px; background: var(--navy-900); padding: 4px; border-radius: var(--radius-lg); border: 1px solid var(--line); }
.role-toggle button {
  flex: 1; padding: 8px; background: transparent; border: none; border-radius: var(--radius);
  color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; cursor: pointer;
}
.role-toggle button.active { background: var(--navy-800); color: var(--gold-bright); }
.error-box {
  background: rgba(217,97,79,.1); border: 1px solid rgba(217,97,79,.4);
  color: #f0a89e; padding: 9px 12px; border-radius: var(--radius); font-size: 12.5px; margin-bottom: 14px;
}
.demo-note { text-align: center; margin-top: 18px; color: var(--text-dim); font-size: 11.5px; }

/* ---------- Chat ---------- */
.chat-layout { display: flex; height: calc(100vh - 140px); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.chat-contacts { width: 220px; border-right: 1px solid var(--line); background: var(--navy-900); overflow-y: auto; flex-shrink: 0; }
.chat-contact { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.chat-contact:hover { background: var(--navy-800); }
.chat-contact.active { background: var(--navy-800); border-left: 2px solid var(--gold); }
.chat-contact .cname { font-size: 13px; font-weight: 600; }
.chat-contact .cpreview { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-main { flex: 1; display: flex; flex-direction: column; background: var(--navy-950); min-width: 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 70%; padding: 9px 13px; border-radius: 10px; font-size: 13.5px; }
.msg.mine { align-self: flex-end; background: var(--gold); color: var(--navy-950); border-bottom-right-radius: 2px; }
.msg.theirs { align-self: flex-start; background: var(--navy-800); border: 1px solid var(--line); border-bottom-left-radius: 2px; }
.msg .mtime { display: block; font-family: var(--font-mono); font-size: 9.5px; opacity: .65; margin-top: 4px; }
.chat-input-bar { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); }
.chat-input-bar input { flex: 1; }

/* ---------- Misc ---------- */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; align-items: center; gap: 8px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-0 { margin-bottom: 0; }
.muted { color: var(--text-muted); }
.dim { color: var(--text-dim); }
.progress-bar { height: 6px; background: var(--navy-700); border-radius: 3px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: var(--gold); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { padding: 9px 16px; font-size: 13px; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold-bright); border-bottom-color: var(--gold); }
.rating-stars { color: var(--gold); font-size: 14px; letter-spacing: 1px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--navy-800); border: 1px solid var(--line-soft); padding: 11px 16px;
  border-radius: var(--radius); font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.4);
  animation: toast-in .18s ease-out;
}
.toast.err { border-color: rgba(217,97,79,.5); color: #f0a89e; }
.toast.ok { border-color: rgba(76,175,125,.5); color: #a7e0c1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .content { padding: 18px 16px 60px; }
  .topbar { padding: 14px 16px; }
  .chat-layout { height: calc(100vh - 200px); flex-direction: column; }
  .chat-contacts { width: 100%; max-height: 140px; }
}
