/* ContentFlow — app.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f172a;
  --surface:   #1e293b;
  --surface2:  #263248;
  --border:    #334155;
  --text:      #f1f5f9;
  --muted:     #94a3b8;
  --accent:    #2563eb;
  --teal:      #0d9488;
  --green:     #16a34a;
  --amber:     #d97706;
  --red:       #dc2626;
  --sb-width:  220px;
}

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Login Shell ──────────────────────────────────────────────────────────── */
.login-shell {
  display: flex;
  min-height: 100vh;
}

.login-hero {
  flex: 1;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f2942 100%);
  padding: 64px 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 48px;
}

.login-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
}

.login-brand-title { font-size: 18px; font-weight: 700; }
.login-brand-sub   { font-size: 13px; color: var(--muted); }

.hero-kicker {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 16px;
}

.hero-title {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 20px;
}
.hero-title span { color: var(--teal); }

.hero-copy { font-size: 15px; color: var(--muted); max-width: 480px; margin-bottom: 40px; }

.role-preview-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.role-preview-card {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  flex: 1;
  min-width: 200px;
}
.role-preview-card b { display: block; margin-bottom: 6px; font-size: 14px; }
.role-preview-card p { font-size: 13px; color: var(--muted); }

.login-panel-wrap {
  width: 420px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  padding: 40px 32px;
}

.login-panel { width: 100%; max-width: 340px; }
.login-panel-logo { width: 56px; height: 56px; border-radius: 14px; overflow: hidden; margin: 0 auto 24px; }
.login-panel h1 { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 24px; }

.login-role-grid { display: flex; gap: 10px; margin-bottom: 20px; }
.login-role {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 10px;
  text-align: center;
  cursor: pointer;
  color: var(--text);
  transition: border-color .15s, background .15s;
}
.login-role strong { display: block; font-size: 13px; margin-bottom: 2px; }
.login-role span   { font-size: 11px; color: var(--muted); }
.login-role.active { border-color: var(--accent); background: rgba(37,99,235,.12); }

.login-field { margin-bottom: 16px; }
.login-field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.login-field input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.login-field input:focus { border-color: var(--accent); }

.login-actions { display: flex; gap: 10px; margin-bottom: 16px; }
.login-actions button { flex: 1; }
.login-actions button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }

.login-foot { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.5; }

/* ── App Shell ─────────────────────────────────────────────────────────────── */
#app { display: none; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sb-width);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 10;
}

.sb-top { padding: 16px 14px 8px; }
.sb-brand-wrap { display: flex; align-items: center; gap: 10px; }
.sb-brand-icon { width: 32px; height: 32px; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.sb-brand-icon img { width: 100%; height: 100%; object-fit: contain; }
.sb-brand { font-size: 13px; font-weight: 700; }
.sb-sub   { font-size: 11px; color: var(--muted); }

.nav { padding: 8px 8px; flex: 1; overflow-y: auto; }
.ns  { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px 8px 4px; }
.ni  {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  transition: background .12s, color .12s;
  margin-bottom: 1px;
}
.ni:hover  { background: var(--surface2); color: var(--text); }
.ni.active { background: rgba(37,99,235,.15); color: var(--accent); font-weight: 600; }

.sb-badge {
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 99px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.sb-foot { padding: 12px 14px; border-top: 1px solid var(--border); }
.sb-cl-lbl { font-size: 10px; color: var(--muted); margin-bottom: 4px; }
.sb-cl-sel {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--text);
  font-size: 12px;
  margin-bottom: 10px;
}

.sb-user { display: flex; align-items: center; gap: 8px; }
.sb-av   {
  width: 28px; height: 28px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.sb-un { font-size: 12px; font-weight: 600; }
.sb-ur { font-size: 10px; color: var(--muted); }

/* ── Main ─────────────────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sb-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: 56px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
}
.tb-title { font-size: 15px; font-weight: 700; }
.tb-sub   { font-size: 12px; color: var(--muted); }
.tb-right { display: flex; align-items: center; gap: 10px; }

.cf-ai-bar {
  background: rgba(37,99,235,.1);
  border-bottom: 1px solid var(--accent);
  padding: 8px 24px;
  font-size: 13px;
  color: var(--accent);
}

.pc { flex: 1; padding: 24px; overflow-y: auto; }

/* ── Notifications ─────────────────────────────────────────────────────────── */
.notif-bell-wrap { position: relative; }
.notif-bell {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.notif-bell svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
.notif-bell:hover { color: var(--text); background: var(--surface2); }
.notif-bell-dot {
  position: absolute;
  top: 4px; right: 4px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 99px;
  min-width: 16px;
  height: 16px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.notif-panel {
  position: absolute;
  right: 0; top: 44px;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,.5);
  display: none;
  z-index: 100;
  overflow: hidden;
}
.notif-panel.open { display: block; }
.notif-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.notif-panel-title { font-size: 13px; font-weight: 600; }
.notif-panel-clear { background: none; border: none; cursor: pointer; font-size: 12px; color: var(--muted); }
.notif-list { max-height: 300px; overflow-y: auto; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 12px; }
.notif-item time { display: block; color: var(--muted); margin-top: 2px; }
.notif-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }

.notif {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 1000;
  max-width: 360px;
}
.notif.notif-show { opacity: 1; transform: translateY(0); }
.notif.notif-success { border-color: var(--green); }
.notif.notif-error   { border-color: var(--red); }
.notif.notif-warn    { border-color: var(--amber); }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.ov {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7);
  display: none;
  align-items: center; justify-content: center;
  z-index: 200;
}
.mbox {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 90%;
  max-width: 780px;
  max-height: 92vh;
  overflow: hidden;
  box-shadow: 0 40px 80px rgba(0,0,0,.6);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  transition: background .12s, border-color .12s, opacity .12s;
  white-space: nowrap;
  font-family: inherit;
}
.btn:hover:not(:disabled)  { background: #2d3f56; border-color: #475569; }
.btn:disabled              { opacity: .45; cursor: not-allowed; }
.btn-sm                    { padding: 5px 10px; font-size: 12px; }
.btn-teal                  { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-teal:hover:not(:disabled) { background: #0f766e; }

/* ── Page layout ──────────────────────────────────────────────────────────── */
.page-section  { max-width: 900px; }
.page-load     { color: var(--muted); padding: 40px; text-align: center; font-size: 15px; }
.page-error    { color: var(--red); padding: 20px; }
.empty-state   { color: var(--muted); font-size: 14px; padding: 20px 0; }

.cf-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 16px;
}
.cf-card-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.field     { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; min-height: 72px; }

/* ── Tables ────────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 8px 12px; text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); }
.data-table td { padding: 11px 12px; border-bottom: 1px solid rgba(255,255,255,.04); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,.02); }

.cell-title { font-weight: 600; font-size: 13px; }
.cell-sub   { font-size: 11px; color: var(--muted); margin-top: 1px; }
.cell-muted { color: var(--muted); font-size: 12px; }

.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(100,116,139,.15);
  color: var(--muted);
}

.progress-mini {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  width: 80px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
}
.progress-mini div {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width .4s;
}

/* ── Dashboard ─────────────────────────────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; max-width: 1100px; }
.dash-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 20px 24px; }
.dash-card-title { font-size: 14px; font-weight: 700; margin-bottom: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-size: 11px; }

.review-list { display: flex; flex-direction: column; gap: 8px; }
.review-item { padding: 12px 14px; background: var(--surface2); border-radius: 8px; cursor: pointer; transition: background .12s; }
.review-item:hover { background: #2d3f56; }
.ri-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.ri-meta  { font-size: 11px; color: var(--muted); }

/* ── Client/User rows ─────────────────────────────────────────────────────── */
.client-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); }
.client-row:last-child { border-bottom: none; }

.user-role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.user-role-card { background: var(--surface2); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .login-hero   { display: none; }
  .login-panel-wrap { width: 100%; }
  .dash-grid    { grid-template-columns: 1fr; }
  .form-grid    { grid-template-columns: 1fr; }
  .user-role-grid { grid-template-columns: 1fr; }
  .sidebar { width: 56px; }
  .sb-brand-wrap > div, .nav .ns, .ni span, .sb-foot .sb-cl-lbl, .sb-user > div { display: none; }
  .ni { justify-content: center; padding: 10px; }
  .main { margin-left: 56px; }
}
