
/* Root */
:root {
  --bg: #0b1020;
  --panel: #121a2b;
  --panel-2: #16223a;
  --text: #e6ebff;
  --muted: #9fb0d3;
  --brand: #6ea8fe;
  --accent: #9d86ff;
  --danger: #ff6b6b;
  --ok: #57d9a3;
  --border: #22314f;
  --shadow: rgba(0,0,0,0.35);
}

/* Reset-ish */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 800px at 20% 10%, #0e1630 0%, #080c18 60%, #05070e 100%);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  line-height: 1.5;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

/* Top bar */
.nav { border-bottom:1px solid var(--border); background: rgba(8,12,24,0.6); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 5; }
.nav-inner { 
  max-width: 960px; margin: 0 auto; 
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 16px; padding:14px 18px; 
}
.nav a { color: var(--muted); text-decoration: none; margin-right: 12px; }
.nav a:hover { color: var(--text); }
.nav-left { justify-self: start; display:flex; align-items:center; gap: 12px; }
.nav-center { justify-self: center; display:flex; align-items:center; gap: 12px; }
.nav-right { justify-self: end; display:flex; align-items:center; gap: 12px; }

/* Layout */
.container { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.page { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.stack { display: grid; gap: 16px; }
.grid { display: grid; gap: 12px; grid-auto-flow: row; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Cards */
.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 6px 30px var(--shadow), inset 0 1px 0 rgba(255,255,255,0.03);
  width: 100%;
  max-width: 360px;
}
.card h1, .card h2 { margin: 0 0 10px 0; font-size: 20px; }
.muted { color: var(--muted); font-size: 13px; }
.card a { color: var(--text); text-decoration: none; }
.card a:hover { text-decoration: underline; }

/* Forms */
form.grid { grid-template-columns: 1fr; }
label { font-size: 13px; color: var(--muted); }
input, button, select {
  font-size: 16px;
  color: var(--text);
}
input, select {
  width: 100%;
  border: 1px solid var(--border);
  background: #0c1326;
  padding: 10px 12px;
  border-radius: 8px;
  outline: none;
}
input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(110,168,254,0.15); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #1a2750 0%, #172347 100%);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.btn-block { width: 100%; justify-content: center; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, #3b6edc 0%, #2b4fb0 100%); border-color: #2b4fb0; }
.btn-danger { background: linear-gradient(180deg, #d94c4c 0%, #b23a3a 100%); border-color: #b23a3a; }

/* Table */
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 600; }
td, th { padding: 10px 8px; border-bottom: 1px solid var(--border); }
tbody tr:hover { background: rgba(255,255,255,0.02); }

/* Blocks */
.note { font-size: 12px; color: var(--muted); }
pre.out {
  background: #0c1326;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  overflow: auto;
}

/* Admin toolbar */
.toolbar { display:flex; gap:12px; align-items:center; margin-bottom: 14px; }
.table-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.table-actions .btn { margin-right: 0; }

/* Loading spinner */
.spinner { width: 16px; height: 16px; border: 2px solid var(--muted); border-top-color: var(--text); border-radius: 50%; display: inline-block; vertical-align: middle; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive tweaks */
@media (max-width: 560px) {
  .card { padding: 16px; max-width: 94vw; }
  .nav-inner { grid-template-columns: 1fr; justify-items: center; gap: 8px; padding: 10px 12px; font-size: 14px; }
  .nav-left, .nav-right, .nav-center { justify-self: center; }
}

/* Modal (white card on dim backdrop) */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 14, 0.55);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  z-index: 50;
  overflow-y: auto;
}
.modal-backdrop.show { display: flex; }
/* Light card (original white variant) */
.modal-card {
  position: relative;
  width: min(680px, 94vw);
  background: linear-gradient(180deg, #ffffff 0%, #f6f8ff 100%);
  color: #111b2e;
  border: 1px solid rgba(12, 18, 28, 0.08);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(6, 13, 31, 0.32);
  display: flex;
  flex-direction: column;
  max-height: min(92vh, 760px);
  overflow: hidden;
  min-height: 0;
}
.modal-header { padding: 18px 22px 0; }
.modal-header h3 { margin: 0 0 4px 0; font-size: 22px; color: #0e1a2e; }
.modal-subtext { margin: 0 0 10px 0; color: #5c6f8f; font-size: 13px; }
.modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.modal-form { padding: 10px 22px 22px; }
.modal-body .modal-form {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 22px 22px;
}
.modal-card > .modal-form {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}
.modal-form .row-actions { margin-top: 4px; }
.modal-close {
  position: absolute; top: 10px; right: 10px;
  border: none; background: transparent; color: #647aa6;
  font-size: 24px; line-height: 1; padding: 4px 8px; border-radius: 8px; cursor: pointer;
}
.modal-close:hover { background: rgba(0,0,0,0.06); color: #0e1a2e; }
.modal-card label { color: #2a3a56; font-weight: 600; font-size: 14px; }
.modal-card input, .modal-card select {
  width: 100%;
  background: #ffffff;
  color: #0b1a33;
  border: 1px solid #d7dcea;
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}
.modal-card input:focus, .modal-card select:focus {
  border-color: #3b6edc;
  box-shadow: 0 0 0 4px rgba(59,110,220,0.15);
}
.modal-card .btn-primary {
  background: linear-gradient(180deg, #2c436f 0%, #1f375f 100%);
  border-color: #1f375f;
  border-radius: 16px;
  font-size: 18px;
  padding: 14px 18px;
}

/* Dropzone */
.dropzone {
  display: flex; align-items: center; justify-content: center;
  height: 120px; border: 2px dashed #b9c4dc; border-radius: 12px;
  background: #f7faff; color: #5b6f97; cursor: pointer;
  transition: box-shadow .2s, border-color .2s;
}
.dropzone:hover { border-color: #3b6edc; box-shadow: 0 0 0 4px rgba(59,110,220,0.12); }
.dropzone svg { width: 44px; height: 44px; opacity: 0.9; }

/* Cases list inside modal */
.case-list { display: grid; gap: 12px; max-height: 60vh; overflow: auto; padding-right: 2px; }
.case-item {
  background: #ffffff;
  border: 1px solid #e6ecf5;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 3px 18px rgba(0,0,0,0.06);
}
.case-head { display:flex; align-items:center; justify-content: space-between; gap: 12px; }
.case-head-main { display:flex; align-items:center; gap: 12px; flex: 1; min-width: 0; }
.case-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid #e6ecf5; box-shadow: 0 4px 18px rgba(7, 15, 35, 0.18); flex-shrink: 0; }
.case-title { font-weight: 700; color: #0e1a2e; }
.case-id { font-weight: 600; color: #8aa0c8; margin-left: 6px; font-size: 12px; }
.case-desc { color: #5c6f8f; margin: 6px 0 10px; }
.case-meta { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.case-meta div { display: grid; gap: 2px; }
.case-meta strong { color: #2a3a56; font-size: 12px; font-weight: 700; }
.case-meta span { color: #0b1a33; font-size: 14px; }

.lawyer-results {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px 22px 22px;
  background: linear-gradient(180deg, rgba(239,243,255,0.72) 0%, rgba(255,255,255,0.92) 100%);
  border-top: 1px solid rgba(18, 32, 58, 0.08);
  overflow: hidden;
  min-height: 0;
}
.lawyer-results-head h4 { margin: 0; font-size: 20px; color: #0e1a2e; }
.lawyer-results-subtext { margin: 2px 0 8px; color: #5c6f8f; font-size: 13px; }
.lawyer-list { flex: 1; display: grid; gap: 12px; overflow-y: auto; padding-right: 4px; min-height: 0; }
.lawyer-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: flex-start;
  background: #ffffff;
  border: 1px solid rgba(120, 138, 186, 0.22);
  border-radius: 14px;
  padding: 16px 18px;
  outline: none;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.lawyer-card:hover { border-color: rgba(59,110,220,0.36); box-shadow: 0 0 0 1px rgba(59,110,220,0.12); }
.lawyer-card:focus { border-color: rgba(59,110,220,0.6); box-shadow: 0 0 0 2px rgba(59,110,220,0.15); }
.lawyer-card-selected {
  border-color: rgba(59,110,220,0.9);
  box-shadow: 0 0 0 2px rgba(59,110,220,0.22);
}
.lawyer-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #dfe6f5;
  box-shadow: 0 6px 18px rgba(9, 23, 55, 0.15);
}
.lawyer-info { display: grid; gap: 8px; }
.lawyer-info-head { display: flex; flex-direction: column; gap: 4px; }
.lawyer-info-head h4 { margin: 0; font-size: 18px; color: #0e1a2e; }
.lawyer-firm { font-size: 12px; font-weight: 600; color: #5c6f8f; letter-spacing: .4px; text-transform: uppercase; }
.lawyer-info-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin: 4px 0 2px; }
.lawyer-info-grid div { display: grid; gap: 2px; }
.lawyer-info-grid strong { color: #2a3a56; font-size: 12px; font-weight: 700; }
.lawyer-info-grid span { color: #0b1a33; font-size: 14px; }
.lawyer-summary { margin: 0; color: #435575; font-size: 13px; line-height: 1.5; }
.lawyer-actions { justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.lawyer-empty { margin: 16px 0; text-align: center; color: #5c6f8f; font-size: 14px; }

.lawyer-confirm {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px 22px 28px;
  text-align: center;
  justify-content: center;
}
.lawyer-confirm h4 { margin: 0; font-size: 22px; color: #0e1a2e; }
.lawyer-confirm p { margin: 0; color: #435575; font-size: 14px; }

.badge { display:inline-block; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; letter-spacing: .2px; }
.badge-filed { background: #eef2ff; color: #374151; }
.badge-ongoing { background: rgba(59,110,220,0.12); color: #1f375f; }
.badge-won { background: rgba(87,217,163,0.18); color: #116a4f; }
.badge-lost { background: rgba(255,107,107,0.15); color: #8b1e1e; }
@media (max-width: 560px) {
  .modal-card { border-radius: 16px; }
  .modal-header h3 { font-size: 20px; }
  .lawyer-card { grid-template-columns: 1fr; }
  .lawyer-avatar { width: 64px; height: 64px; }
}
