/* Clarus Legal — static SPA styles */
:root {
  --navy: #142b46;
  --navy-light: #1a3655;
  --navy-dark: #10263e;
  --copper: #b57a43;
  --copper-light: #d69a62;
  --copper-text: #b06e34;
  --bg: #f4f6f8;
  --card: #ffffff;
  --border: #e5e5e5;
  --border-light: #f0f0f0;
  --text: #172033;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --red: #e7000b;
  --red-bg: #fef2f2;
  --red-text: #b91c1c;
  --red-border: #fecaca;
  --amber-bg: #fffbeb;
  --amber-text: #b45309;
  --amber-border: #fde68a;
  --blue-bg: #eff6ff;
  --blue-text: #1d4ed8;
  --blue-border: #bfdbfe;
  --emerald-bg: #ecfdf5;
  --emerald-text: #047857;
  --emerald-border: #a7f3d0;
  --sidebar-w: 280px;
  --topbar-h: 64px;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.03);
  --shadow-md: 0 4px 12px rgba(15,23,42,.08);
  --font-sans: 'Inter', 'Segoe UI', Arial, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-sans); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input { font: inherit; }
a { color: inherit; text-decoration: none; }
.font-serif { font-family: var(--font-serif); }

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

/* Sidebar */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w); background: var(--navy-dark);
  color: #f7fafc; display: flex; flex-direction: column;
  z-index: 50; transition: transform .25s ease;
}
.sidebar-header { padding: 24px 20px; }
.brand { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; }
.brand-icon {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: var(--copper); border-radius: 12px; color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.brand-name { display: block; font-family: var(--font-serif); font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.brand-sub { display: block; font-size: 12px; color: rgba(247,250,252,.55); }
.sidebar-nav { flex: 1; padding: 0 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: rgba(247,250,252,.7);
  transition: all .15s;
}
.nav-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-btn.active {
  background: #fff; color: var(--navy);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.nav-btn svg { flex-shrink: 0; }

/* Assistant card */
.sidebar-assistant {
  margin: auto 16px 0; padding: 16px;
  border-radius: var(--radius); border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.06);
}
.assistant-header { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; margin-bottom: 12px; }
.assistant-desc { font-size: 12px; line-height: 1.65; color: rgba(247,250,252,.6); }

/* Sidebar footer */
.sidebar-footer { padding: 16px; }
.user-btn {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 8px; border-radius: 12px;
  text-align: left; transition: background .15s;
}
.user-btn:hover { background: rgba(255,255,255,.1); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--copper); display: grid; place-items: center;
  font-size: 13px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { display: block; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 12px; color: rgba(247,250,252,.5); }
.icon-settings { color: rgba(247,250,252,.5); flex-shrink: 0; }

/* Mobile sidebar */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 40;
}
.sidebar-overlay.open { display: block; }

/* Main */
.main {
  flex: 1; margin-left: var(--sidebar-w);
  display: flex; flex-direction: column; min-width: 0;
}
.topbar {
  position: sticky; top: 0; z-index: 10;
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 32px; background: rgba(255,255,255,.9);
  border-bottom: 1px solid rgba(226,232,240,.8);
  backdrop-filter: blur(12px);
}
.menu-btn { display: none; }
.search-wrap { position: relative; flex: 1; max-width: 640px; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-input {
  width: 100%; height: 40px; padding: 0 12px 0 40px;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  background: #f8fafc; font-size: 14px; outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--navy); }
.topbar-icon {
  position: relative; width: 40px; height: 40px;
  display: grid; place-items: center; border-radius: var(--radius-xs);
  color: var(--text-secondary);
}
.topbar-icon:hover { background: #f1f5f9; }
.notif-dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); border: 2px solid #fff;
}
.hide-mobile { display: inline; }

/* Content */
.content { padding: 32px; max-width: 1500px; margin: 0 auto; width: 100%; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-xs);
  font-size: 14px; font-weight: 500; transition: all .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-light); }
.btn-outline { border: 1px solid var(--border); color: var(--text); background: #fff; }
.btn-outline:hover { background: #f8fafc; }
.btn-white { background: #fff; color: var(--navy); }
.btn-white:hover { background: rgba(255,255,255,.9); }
.btn-ghost { color: var(--text-secondary); }
.btn-ghost:hover { background: #f1f5f9; color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-md); }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm); transition: all .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-top { display: flex; justify-content: space-between; align-items: flex-start; }
.stat-label { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.stat-icon {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; background: #eef2f6; color: #254969;
}
.stat-value { display: block; margin-top: 12px; font-family: var(--font-serif); font-size: 30px; font-weight: 600; color: var(--navy); }
.stat-note { display: block; margin-top: 4px; font-size: 12px; color: var(--text-muted); }
.stat-note.warning { color: var(--red); }

/* Section titles */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-light);
}
.section-title { font-family: var(--font-serif); font-size: 20px; font-weight: 600; color: var(--navy); }
.section-note { margin-top: 4px; font-size: 12px; color: var(--text-muted); }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 9999px;
  font-size: 12px; font-weight: 500; border: 1px solid;
}
.badge-blue { background: var(--blue-bg); color: var(--blue-text); border-color: var(--blue-border); }
.badge-red { background: var(--red-bg); color: var(--red-text); border-color: var(--red-border); }
.badge-amber { background: var(--amber-bg); color: var(--amber-text); border-color: var(--amber-border); }
.badge-green { background: var(--emerald-bg); color: var(--emerald-text); border-color: var(--emerald-border); }
.badge-default { background: #f5f5f5; color: #525252; border-color: var(--border); }

/* Two-column layout */
.two-col { display: grid; grid-template-columns: 1.35fr .65fr; gap: 24px; }

/* Task list */
.task-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border-light);
  cursor: pointer; transition: background .1s;
}
.task-row:last-child { border-bottom: none; }
.task-row:hover { background: #f8fafc; }
.task-row.done { opacity: .45; }
.task-check {
  width: 20px; height: 20px; border-radius: 6px;
  border: 1.5px solid #cbd5e1; display: grid; place-items: center;
  flex-shrink: 0; margin-top: 2px; transition: all .15s;
}
.task-check:hover { border-color: var(--copper); }
.task-check.checked { background: var(--navy); border-color: var(--navy); color: #fff; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 14px; font-weight: 500; color: #1e293b; }
.task-row.done .task-title { text-decoration: line-through; color: var(--text-muted); }
.task-matter { margin-top: 4px; font-size: 12px; color: var(--text-muted); }
.task-meta { text-align: right; flex-shrink: 0; }
.task-due { margin-top: 6px; font-size: 12px; font-weight: 500; color: var(--text-secondary); }

/* Agenda card */
.agenda-card {
  background: var(--navy); border-radius: var(--radius); padding: 20px;
  color: #fff; box-shadow: var(--shadow-sm);
}
.agenda-top { display: flex; justify-content: space-between; align-items: flex-start; }
.agenda-label { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .18em; color: var(--copper-light); }
.agenda-title { margin-top: 4px; font-family: var(--font-serif); font-size: 20px; font-weight: 600; }
.agenda-icon { color: rgba(255,255,255,.5); }
.agenda-list { margin-top: 20px; display: flex; flex-direction: column; gap: 16px; }
.agenda-event { display: flex; gap: 12px; }
.agenda-time { width: 44px; padding-top: 2px; font-size: 12px; font-weight: 500; color: rgba(255,255,255,.55); flex-shrink: 0; }
.agenda-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.dot-blue { background: #3b82f6; }
.dot-violet { background: #8b5cf6; }
.dot-amber { background: #f59e0b; }
.agenda-event-title { font-size: 14px; font-weight: 500; }
.agenda-event-type { margin-top: 4px; font-size: 12px; color: rgba(255,255,255,.45); }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 760px; text-align: left; border-collapse: collapse; }
thead { background: rgba(248,250,252,.8); }
th { padding: 12px 16px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
th:first-child { padding-left: 20px; }
th:last-child { padding-right: 20px; text-align: right; }
td { padding: 16px; border-top: 1px solid var(--border-light); vertical-align: middle; }
td:first-child { padding-left: 20px; }
td:last-child { padding-right: 20px; }
tr:hover { background: rgba(248,250,252,.7); cursor: pointer; }
.matter-title { font-size: 14px; font-weight: 600; color: var(--navy); }
.matter-id { margin-top: 4px; font-size: 12px; color: var(--text-muted); }
.matter-client { font-size: 14px; color: var(--text-secondary); }
.matter-next { font-size: 14px; color: var(--text-secondary); }

/* Progress bar */
.progress-wrap { display: flex; align-items: center; gap: 8px; justify-content: flex-end; width: 112px; margin-left: auto; }
.progress-bar { flex: 1; height: 6px; background: #f1f5f9; border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--copper); border-radius: 99px; }
.progress-text { width: 32px; text-align: right; font-size: 12px; color: var(--text-muted); }

/* Page header */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-title { font-family: var(--font-serif); font-size: 32px; font-weight: 600; color: var(--navy); }
.page-subtitle { margin-top: 8px; color: var(--text-secondary); }

/* Dashboard hero */
.dash-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.dash-date { font-size: 14px; font-weight: 500; color: var(--copper-text); margin-bottom: 4px; }
.dash-greeting { font-family: var(--font-serif); font-size: 32px; font-weight: 600; color: var(--navy); letter-spacing: -.02em; }
.dash-summary { margin-top: 8px; color: var(--text-secondary); }
.dash-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--emerald-border); background: var(--emerald-bg);
  font-size: 12px; font-weight: 500; color: var(--emerald-text);
  align-self: flex-start;
}

/* Simple page cards */
.simple-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.simple-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm); transition: all .15s;
}
.simple-card:hover { box-shadow: var(--shadow-md); }
.simple-icon {
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 12px; background: #eef2f6; color: #254969; flex-shrink: 0;
}
.simple-label { font-weight: 500; color: #1e293b; }
.simple-meta { margin-top: 4px; font-size: 12px; color: var(--text-muted); }
.simple-arrow { margin-left: auto; color: #cbd5e1; flex-shrink: 0; }

/* No results */
.no-results { padding: 40px; text-align: center; font-size: 14px; color: var(--text-muted); }

/* Dialog */
.dialog-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 100;
  place-items: center; backdrop-filter: blur(4px);
}
.dialog-overlay.open { display: grid; }
.dialog {
  background: var(--card); border-radius: var(--radius);
  padding: 24px; width: 90%; max-width: 440px;
  box-shadow: 0 16px 48px rgba(0,0,0,.15);
}
.dialog-title { font-family: var(--font-serif); font-size: 24px; font-weight: 600; color: var(--navy); }
.dialog-desc { margin-top: 4px; font-size: 14px; color: var(--text-secondary); }
.field-label { display: block; margin-top: 16px; margin-bottom: 6px; font-size: 14px; font-weight: 500; }
.input {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-xs);
  font-size: 14px; outline: none; transition: border-color .15s;
}
.input:focus { border-color: var(--navy); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* Spacing */
.space-y-6 > * + * { margin-top: 24px; }

/* Responsive */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1000px) {
  .two-col { grid-template-columns: 1fr; }
  .simple-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-btn { display: grid; place-items: center; width: 40px; height: 40px; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .dash-greeting { font-size: 24px; }
  .page-title { font-size: 24px; }
  .hide-mobile { display: none; }
  .page-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}
