:root {
  --indigo: #1e40af;
  --indigo-hover: #1d3a9c;
  --indigo-soft: #eef2ff;
  --indigo-border: #c7d2fe;
  --bg: #f8f9fb;
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --amber-bg: #fefce8;
  --amber-text: #854d0e;
  --amber-border: #fde68a;
  --emerald-bg: #ecfdf5;
  --emerald-text: #065f46;
  --emerald-border: #a7f3d0;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
.hidden { display: none !important; }

/* Login */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}
.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wordmark-img {
  height: 48px;
  width: auto;
  mix-blend-mode: multiply;
  object-fit: contain;
  margin: -6px -4px;
}
.wordmark-img.sm { height: 38px; margin: -5px -3px; }
.pill {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
}
.pill-desk {
  background: var(--indigo-soft);
  color: var(--indigo);
  border: 1px solid var(--indigo-border);
}
.subtitle {
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 13px;
}
.lead { margin: 0 0 16px; color: #374151; }
.security-callout {
  display: flex;
  gap: 10px;
  background: #f5f7ff;
  border: 1px solid #dbe4ff;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12.5px;
  color: #334155;
  margin-bottom: 18px;
}
.login-form label { display: block; margin-bottom: 14px; }
.login-form label span { display: block; font-weight: 500; margin-bottom: 5px; font-size: 13px; }
input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid #bfdbfe;
  border-color: var(--indigo);
}
.masked-secret {
  -webkit-text-security: disc;
  text-security: disc;
}
.btn-primary {
  background: var(--indigo);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: var(--indigo-hover); }
.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 500;
  cursor: pointer;
}
.btn-ghost-sm {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.full-width { width: 100%; }
.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12.5px;
  margin-bottom: 12px;
}
.sample-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.sample-label { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.sample-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sample-card {
  text-align: left;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sample-card:hover { border-color: var(--indigo); background: #fafbff; }
.sample-card strong { font-size: 13px; color: var(--text); }
.sample-card span { font-size: 11.5px; color: var(--muted); }
.text-danger { color: var(--danger) !important; }

/* App Shell — 1080p full-width with 240px left sidebar rail */
.app-shell {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 240px;
  flex: 0 0 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}
.sidebar-header { padding: 0 6px 18px; border-bottom: 1px solid var(--border); }
.sidebar-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.nav-section { margin-top: 20px; }
.nav-heading {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 0 10px 8px;
}
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  margin-bottom: 2px;
}
.nav-item:hover { background: #f3f4f6; }
.nav-item.active { background: var(--indigo-soft); color: var(--indigo); font-weight: 600; }
.nav-badge {
  background: #e5e7eb;
  color: #374151;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
}
.nav-item.active .nav-badge { background: #dbeafe; color: var(--indigo); }
.matters-list { display: flex; flex-direction: column; gap: 4px; padding: 0 6px; }
.matter-chip {
  font-size: 12.5px;
  color: #374151;
  padding: 5px 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.matter-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--indigo); flex-shrink: 0; }
.sidebar-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.user-name { font-weight: 600; font-size: 13px; }
.user-role { font-size: 11.5px; color: var(--muted); }

/* Main Canvas */
.main-canvas { flex: 1; padding: 28px 32px; overflow-y: auto; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.page-header h1 { margin: 0; font-size: 22px; font-weight: 700; }
.muted { color: var(--muted); margin: 4px 0 0; font-size: 13.5px; }

.split-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(420px, 1.25fr);
  gap: 20px;
  align-items: start;
}
.ticket-list { display: flex; flex-direction: column; gap: 12px; }
.ticket-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.ticket-card:hover { border-color: #93c5fd; }
.ticket-card.selected { border-color: var(--indigo); box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.08); }
.ticket-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.ticket-meta { font-size: 12px; color: var(--muted); font-weight: 600; }
.ticket-title { font-size: 15px; font-weight: 600; margin: 2px 0 6px; }
.ticket-foot { font-size: 12.5px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; }

.badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.badge-open { background: var(--amber-bg); color: var(--amber-text); border-color: var(--amber-border); }
.badge-progress { background: var(--indigo-soft); color: var(--indigo); border-color: var(--indigo-border); }
.badge-closed { background: var(--emerald-bg); color: var(--emerald-text); border-color: var(--emerald-border); }
.badge-blocked { background: var(--danger-bg); color: var(--danger); border-color: #fecaca; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.table-card { padding: 0; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.data-table th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #f9fafb;
}
.section-label {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 20px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.empty-box {
  border: 1px dashed #d1d5db;
  border-radius: 10px;
  padding: 14px;
  font-size: 13px;
  color: var(--muted);
  background: #fafafa;
}
.receipt-mini {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fafbff;
  font-size: 12.5px;
}
.comment-item {
  padding: 8px 10px;
  background: #f9fafb;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}
.comment-form { display: flex; gap: 8px; margin-top: 10px; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 14px;
  padding: 22px;
  border: 1px solid var(--border);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-header h2 { margin: 0; font-size: 17px; }
.modal-form label { display: block; margin-bottom: 12px; }
.modal-form label span { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* Workspace Hub Landing Page & Clickable Brand */
.brand-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  padding: 2px 0;
  cursor: pointer;
  text-align: left;
}
.brand-btn:hover { opacity: 0.85; }
.pill-discovery {
  background: var(--emerald-bg);
  color: var(--emerald-text);
  border: 1px solid var(--emerald-border);
}
.btn-discovery {
  background: #047857;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}
.btn-discovery:hover { background: #065f46; }
.btn-discovery:disabled, .btn-primary:disabled {
  background: #e5e7eb;
  color: #6b7280;
  cursor: not-allowed;
}
.home-shell { min-height: 100vh; display: flex; flex-direction: column; }
.home-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.home-user-bar { display: flex; align-items: center; gap: 12px; }
.home-container {
  max-width: 980px;
  width: 100%;
  margin: 48px auto;
  padding: 0 24px;
}
.home-intro h1 { margin: 0 0 6px; font-size: 26px; font-weight: 700; }
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 22px;
  margin-top: 28px;
}
.hub-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
}
.hub-card-locked { opacity: 0.72; background: #fafafa; }
.hub-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.hub-card h2 { margin: 0 0 6px; font-size: 18px; }
.hub-stats {
  margin: 14px 0 20px;
  padding: 10px 12px;
  background: #f8f9fb;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  color: #374151;
}
.hub-actions { margin-top: auto; }
