/* ============================================
   Chief Scaler Client Portal — Shared Styles
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  --navy:   #1B2D4F;
  --navy2:  #2A4270;
  --teal:   #1E8C6E;
  --green:  #27B88F;
  --slate:  #4A5568;
  --mist:   #EDF2F7;
  --border: #D1DCE8;
  --white:  #FFFFFF;
  --red:    #E05555;
  --amber:  #F59E0B;
  --font-head: "DM Serif Display", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --radius: 10px;
  --shadow: 0 2px 16px rgba(27,45,79,.09);
  --shadow-lg: 0 8px 40px rgba(27,45,79,.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: var(--font-body); background: #f0f4f8; color: var(--navy); min-height: 100vh; }
a { color: var(--teal); text-decoration: none; }
button { cursor: pointer; font-family: var(--font-body); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1.3rem; border-radius: var(--radius); font-size: .875rem; font-weight: 600; border: none; transition: all .15s; }
.btn-primary { background: linear-gradient(135deg, var(--teal), var(--green)); color: white; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(30,140,110,.35); }
.btn-secondary { background: white; color: var(--navy); border: 1.5px solid var(--border); }
.btn-secondary:hover { border-color: var(--teal); color: var(--teal); }
.btn-danger { background: #fef2f2; color: var(--red); border: 1.5px solid #fecaca; }
.btn-danger:hover { background: var(--red); color: white; }
.btn-sm { padding: .4rem .9rem; font-size: .8rem; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 8px; }

/* ── Cards ── */
.card { background: white; border-radius: 14px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.card-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card-body { padding: 1.5rem; }
.card-title { font-size: 1rem; font-weight: 700; color: var(--navy); }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .82rem; font-weight: 600; color: var(--slate); margin-bottom: .35rem; text-transform: uppercase; letter-spacing: .05em; }
.form-control { width: 100%; padding: .65rem .9rem; border: 1.5px solid var(--border); border-radius: var(--radius); font-size: .9rem; font-family: var(--font-body); color: var(--navy); background: white; transition: border-color .15s; outline: none; }
.form-control:focus { border-color: var(--teal); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234A5568' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: .25rem .65rem; border-radius: 20px; font-size: .74rem; font-weight: 700; letter-spacing: .04em; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-slate { background: var(--mist); color: var(--slate); }

/* ── Modal ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(10,20,40,.55); backdrop-filter: blur(4px); z-index: 1000; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal { background: white; border-radius: 16px; padding: 2rem; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); position: relative; animation: modalIn .2s ease; max-height: 90vh; overflow-y: auto; }
@keyframes modalIn { from { opacity:0; transform: scale(.95) translateY(12px); } }
.modal-close { position: absolute; top: 1rem; right: 1rem; width: 30px; height: 30px; border-radius: 50%; background: var(--mist); border: none; font-size: 1rem; color: var(--slate); display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--border); }
.modal h3 { font-size: 1.15rem; margin-bottom: 1.5rem; color: var(--navy); }

/* ── Toast ── */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--navy); color: white; padding: .75rem 1.5rem; border-radius: 10px; font-size: .875rem; font-weight: 500; z-index: 9999; transition: transform .25s cubic-bezier(.22,.68,0,1.2); pointer-events: none; white-space: nowrap; }
#toast.show { transform: translateX(-50%) translateY(0); }
#toast.success { background: var(--teal); }
#toast.error { background: var(--red); }

/* ── Sidebar Layout ── */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--navy); flex-shrink: 0; display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; }
.sidebar-logo { padding: 1.5rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: .75rem; }
.sidebar-logo .logo-mark { width: 32px; height: 32px; background: linear-gradient(135deg, var(--teal), var(--green)); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; color: white; flex-shrink: 0; }
.sidebar-logo .logo-text { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: white; line-height: 1.3; }
.sidebar-logo .logo-sub { font-size: .65rem; color: rgba(255,255,255,.45); letter-spacing: .08em; text-transform: uppercase; }
.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.nav-section { padding: .5rem 1.25rem .25rem; font-size: .65rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.3); }
.nav-item { display: flex; align-items: center; gap: .75rem; padding: .65rem 1.25rem; color: rgba(255,255,255,.65); font-size: .875rem; font-weight: 500; transition: all .15s; border-left: 3px solid transparent; }
.nav-item:hover { color: white; background: rgba(255,255,255,.06); }
.nav-item.active { color: white; background: rgba(255,255,255,.08); border-left-color: var(--green); }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { display: flex; align-items: center; gap: .75rem; }
.sidebar-user .avatar { width: 32px; height: 32px; background: linear-gradient(135deg, var(--teal), var(--green)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; color: white; flex-shrink: 0; }
.sidebar-user .user-info { flex: 1; }
.sidebar-user .user-name { font-size: .82rem; font-weight: 600; color: white; }
.sidebar-user .user-role { font-size: .72rem; color: rgba(255,255,255,.4); }
.sidebar-user .logout-btn { background: none; border: none; color: rgba(255,255,255,.4); padding: .25rem; border-radius: 6px; }
.sidebar-user .logout-btn:hover { color: white; background: rgba(255,255,255,.1); }

.main-content { margin-left: 240px; flex: 1; padding: 2rem; min-width: 0; }
.page-header { margin-bottom: 2rem; }
.page-title { font-family: var(--font-head); font-size: 1.9rem; color: var(--navy); }
.page-subtitle { color: var(--slate); font-size: .9rem; margin-top: .25rem; }

/* ── KPI Grid ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.kpi-card { background: white; border-radius: 14px; border: 1px solid var(--border); padding: 1.25rem; box-shadow: var(--shadow); }
.kpi-label { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--slate); margin-bottom: .5rem; }
.kpi-value { font-size: 1.9rem; font-weight: 700; color: var(--navy); line-height: 1; }
.kpi-unit { font-size: .85rem; font-weight: 500; color: var(--slate); margin-left: .2rem; }
.kpi-trend { display: flex; align-items: center; gap: .3rem; margin-top: .5rem; font-size: .78rem; font-weight: 600; }
.kpi-trend.up { color: var(--teal); }
.kpi-trend.down { color: var(--red); }
.kpi-trend.neutral { color: var(--slate); }
.kpi-target { font-size: .72rem; color: var(--slate); margin-top: .25rem; }

/* ── Kanban ── */
.kanban-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; align-items: start; }
.kanban-lane { background: var(--mist); border-radius: 12px; padding: .75rem; min-height: 400px; }
.lane-header { display: flex; align-items: center; justify-content: space-between; padding: .5rem .25rem .75rem; }
.lane-title { font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--slate); display: flex; align-items: center; gap: .5rem; }
.lane-count { background: white; color: var(--slate); border: 1px solid var(--border); border-radius: 20px; font-size: .72rem; font-weight: 700; padding: .1rem .5rem; }
.lane-backlog .lane-title { color: var(--slate); }
.lane-in_progress .lane-title { color: var(--navy2); }
.lane-review .lane-title { color: #92400e; }
.lane-done .lane-title { color: #065f46; }

.kanban-card { background: white; border-radius: 10px; border: 1px solid var(--border); padding: .9rem 1rem; margin-bottom: .6rem; box-shadow: 0 1px 4px rgba(27,45,79,.06); cursor: default; }
.kanban-card:last-child { margin-bottom: 0; }
.card-title-text { font-size: .875rem; font-weight: 600; color: var(--navy); margin-bottom: .4rem; line-height: 1.4; }
.card-desc { font-size: .78rem; color: var(--slate); line-height: 1.5; margin-bottom: .6rem; }
.card-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.priority-high { background: var(--red); }
.priority-medium { background: var(--amber); }
.priority-low { background: var(--teal); }
.card-due { font-size: .72rem; color: var(--slate); }
.card-due.overdue { color: var(--red); font-weight: 600; }
.card-actions { display: flex; gap: .35rem; margin-left: auto; }

/* ── Table ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: .75rem 1rem; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); border-bottom: 2px solid var(--border); }
.data-table td { padding: .85rem 1rem; font-size: .875rem; border-bottom: 1px solid var(--mist); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--slate); }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .4; }
.empty-state p { font-size: .9rem; }

/* ── Tabs ── */
.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--border); margin-bottom: 1.5rem; }
.tab-btn { padding: .65rem 1.1rem; border: none; background: none; font-family: var(--font-body); font-size: .875rem; font-weight: 600; color: var(--slate); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; }
.tab-btn:hover { color: var(--navy); }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Responsive ── */
@media (max-width: 1024px) { .kanban-board { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
  .sidebar { width: 100%; height: auto; position: relative; }
  .main-content { margin-left: 0; padding: 1rem; }
  .kanban-board { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
