:root {
  --primary: #1a3a5c;
  --primary-dark: #122a44;
  --accent: #2e6da4;
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #d9e0e8;
  --text: #222831;
  --muted: #6b7684;
  --danger: #c0392b;
  --success: #1e8449;
  --warning: #b9770e;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft JhengHei", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navbar */
.navbar {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.brand { color: #fff; font-weight: 700; font-size: 1.1rem; }
.brand:hover { text-decoration: none; color: #dbe7f3; }
.nav-links { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.nav-links a { color: #e8eef5; }
.nav-links a:hover { color: #fff; }
.lang-switch { display: inline-flex; gap: 0.4rem; margin-left: 0.5rem; }
.lang-switch a {
  color: #c7d5e2; font-size: 0.85rem; padding: 0.15rem 0.45rem;
  border: 1px solid transparent; border-radius: 4px;
}
.lang-switch a.active { border-color: #fff; color: #fff; }
.lang-switch a:hover { text-decoration: none; color: #fff; }

/* Layout */
.container { max-width: 1100px; margin: 1.5rem auto; padding: 0 1rem; min-height: 60vh; }
.footer {
  text-align: center; color: var(--muted); font-size: 0.85rem;
  padding: 1.5rem 1rem; border-top: 1px solid var(--border); background: #fff;
}

h1, h2, h3 { color: var(--primary); }
.muted { color: var(--muted); }
.center { text-align: center; }
.mono { font-family: Consolas, monospace; font-size: 0.85rem; }
.pre-line { white-space: pre-line; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Buttons */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.55rem 1.1rem;
  font-size: 0.95rem;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover { background: #eef4fa; }
.btn-secondary { background: #e8edf3; color: var(--primary); }
.btn-secondary:hover { background: #dbe3ec; }
.btn-danger { background: #fff; color: var(--danger); border-color: #e6c6c2; font-weight: 700; }
.btn-danger:hover { background: #fbeeee; }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.85rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1.05rem; }
.btn-block { display: block; width: 100%; }

/* Hero / landing */
.hero { text-align: center; padding: 3rem 1rem 2rem; }
.hero h1 { font-size: 2.2rem; margin-bottom: 0.75rem; }
.hero .lead { max-width: 720px; margin: 0 auto 1.5rem; color: var(--muted); }
.hero-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }
.features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem; margin: 1rem 0;
}
.feature { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.feature h3 { margin-top: 0; }
.how-it-works { margin: 1.5rem 0; }
.steps-list { list-style: none; padding: 0; display: flex; gap: 1rem; flex-wrap: wrap; }
.steps-list li {
  flex: 1; min-width: 200px; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; display: flex; gap: 0.6rem; align-items: center;
}
.steps-list span {
  background: var(--primary); color: #fff; border-radius: 50%;
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}

/* Auth */
.auth-card { max-width: 440px; margin: 2rem auto; }

/* Forms */
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.3rem; color: var(--primary); }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="tel"],
.field input[type="number"],
.field input[type="date"],
.field select,
.field textarea {
  width: 100%; padding: 0.55rem 0.7rem; font-size: 0.95rem;
  border: 1px solid var(--border); border-radius: var(--radius); background: #fff;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent); outline-offset: -1px;
}
.field.checkbox label { font-weight: 500; display: flex; align-items: center; gap: 0.5rem; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 0.35rem 0 0; }

.form-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-top: 1rem; }

/* Row entries (dynamic parties) */
.row-entry {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 0.6rem;
  align-items: end;
  padding: 0.75rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
  background: #fafbfd;
}
#defendant-rows .row-entry { grid-template-columns: 1fr 2fr 1.4fr 1fr auto; }
.row-entry .field { margin-bottom: 0; }
@media (max-width: 760px) {
  .row-entry, #defendant-rows .row-entry { grid-template-columns: 1fr; }
  .row-entry .remove-row { justify-self: start; }
}

/* Guidance panels */
.guidance {
  background: #eef4fa; border-left: 4px solid var(--accent);
  padding: 0.6rem 0.8rem; border-radius: 4px; margin: 0.6rem 0; font-size: 0.92rem;
}
.guidance-reminder { background: #fff8e6; border-left-color: var(--warning); }

/* Wizard steps */
.steps { list-style: none; display: flex; gap: 0.5rem; padding: 0; margin: 0 0 1.25rem; flex-wrap: wrap; }
.steps li {
  flex: 1; min-width: 160px; padding: 0.6rem 0.8rem; border-radius: var(--radius);
  background: #e8edf3; color: var(--muted); font-size: 0.9rem;
}
.steps li.active { background: var(--primary); color: #fff; }
.steps strong { margin-right: 0.25rem; }

/* Flash messages */
.flash-stack { margin-bottom: 1rem; }
.flash { padding: 0.65rem 0.9rem; border-radius: var(--radius); margin-bottom: 0.5rem; border: 1px solid transparent; }
.flash-success { background: #e9f7ef; border-color: #bfe3cd; color: var(--success); }
.flash-error { background: #fdecea; border-color: #f2c6c0; color: var(--danger); }
.flash-warning { background: #fef9e7; border-color: #f3e2a9; color: var(--warning); }
.flash-info { background: #eef4fa; border-color: #d0e1f0; color: var(--accent); }

/* Dashboard */
.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem; }
.page-head h1 { margin: 0; }
.page-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.filter-bar { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.filter-bar .grow { flex: 1; min-width: 220px; }
.filter-bar .actions { display: flex; gap: 0.5rem; }
.filter-bar .field { margin-bottom: 0; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; background: var(--card); }
.data-table th, .data-table td {
  padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--border); text-align: left; font-size: 0.9rem;
}
.data-table th { background: var(--primary); color: #fff; }
.data-table .actions { white-space: nowrap; }
.data-table .actions .btn { margin-right: 0.3rem; }

.badge {
  display: inline-block; padding: 0.2rem 0.55rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600;
}
.badge-draft { background: #e8edf3; color: var(--muted); }
.badge-submitted { background: #e9f7ef; color: var(--success); }
.badge-printed { background: #eef4fa; color: var(--accent); }

.empty-state { text-align: center; padding: 2.5rem 1rem; }

/* Review / summary */
.section-head { display: flex; justify-content: space-between; align-items: center; }
.edit-link { font-size: 0.9rem; }
.summary-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.summary-table th, .summary-table td {
  padding: 0.5rem 0.6rem; border: 1px solid var(--border); text-align: left; vertical-align: top;
}
.summary-table th { background: #f4f7fa; width: 40%; }
.summary-list { display: grid; grid-template-columns: 180px 1fr; gap: 0.4rem 1rem; }
.summary-list dt { font-weight: 600; color: var(--primary); }
.summary-list dd { margin: 0; white-space: pre-line; }
@media (max-width: 600px) { .summary-list { grid-template-columns: 1fr; } }
.confirm-card .checkbox-line { display: flex; gap: 0.5rem; align-items: center; font-weight: 600; margin-bottom: 0.75rem; }

/* Claim document (print preview) */
.toolbar { display: flex; gap: 0.6rem; margin-bottom: 1rem; }
.claim-document {
  background: #fff; border: 1px solid var(--border); padding: 2rem; border-radius: var(--radius);
}
.doc-header { text-align: center; border-bottom: 2px solid var(--primary); padding-bottom: 1rem; margin-bottom: 1.5rem; }
.doc-header h1 { margin: 0; font-size: 1.5rem; }
.doc-ref { color: var(--muted); font-size: 0.85rem; }
.doc-section { margin-bottom: 1.5rem; }
.doc-section h2 { border-left: 4px solid var(--primary); padding-left: 0.6rem; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 0.75rem; }
.doc-table th, .doc-table td { border: 1px solid #333; padding: 0.5rem; text-align: left; vertical-align: top; }
.doc-table th { background: #f2f2f2; }
.doc-table .num { width: 3.5rem; text-align: center; }
.doc-table .label-col { width: 30%; }
.signature-lines { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.doc-note { color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--border); padding-top: 1rem; }

/* Print styles */
@media print {
  .navbar, .footer, .toolbar, .flash-stack, .no-print { display: none !important; }
  body { background: #fff; }
  .container { max-width: none; margin: 0; padding: 0; min-height: 0; }
  .claim-document { border: none; padding: 0; box-shadow: none; }
  .doc-table th { background: #f2f2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
