* { box-sizing: border-box; }

:root {
  --bg: #f7f7fb;
  --text: #111;
  --primary: #0b5ed7;
  --muted: #6c757d;
  --border: #e5e7eb;
  --card: #fff;
  --primary-600: #0a58ca;
  --primary-700: #094faf;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 6px 20px rgba(0,0,0,.08);
  --ring: rgba(11,94,215,.35);
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

header, footer {
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
}
header {
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  background-image: linear-gradient(90deg, var(--primary) 0%, var(--primary-600) 50%, var(--primary-700) 100%);
}

main {
  padding: 16px;
}

.container { max-width: 960px; margin: 0 auto; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.card { 
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease, transform .12s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Media preview constraints */
.attachment-media img,
.attachment-media video,
.attachment-media iframe { 
  max-width: 100%; 
  width: 100%;
  border-radius: 6px; 
  display: block; 
}
.attachment-media video { height: auto; }
.attachment-media iframe { height: 60vh; border: 1px solid var(--border); }

/* Responsive tables/text */
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; background: #fff; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; word-break: normal; overflow-wrap: anywhere; }
.table thead th { background: #f3f4f6; font-weight: 700; color: #374151; }
.table tbody tr:nth-child(odd) { background: #fafafa; }
.table tbody tr:hover { background: #f0f7ff; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Button rows flex wrap */
.actions { display:flex; gap:8px; flex-wrap: wrap; }

.btn { display: inline-block; padding: 10px 14px; border-radius: 6px; border: 1px solid var(--primary); background: var(--primary); color: #fff; cursor: pointer; text-align: center; }
.btn.secondary { background: var(--muted); border-color: var(--muted); }
.btn.light { background: transparent; border-color: #fff; color: #fff; }
.btn.link { border: none; background: transparent; color: var(--primary); padding: 0; }
.btn.block { display: block; width: 100%; }

/* Button interactivity */
.btn { transition: transform .06s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease; }
.btn:hover { filter: brightness(1.05); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.btn:active { transform: translateY(1px); }
.btn:focus { outline: 2px solid var(--ring); outline-offset: 2px; }

.input, textarea, select {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 16px;
  background: #fff;
}
.input:focus, textarea:focus, select:focus { outline: 2px solid var(--ring); outline-offset: 2px; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11,94,215,.12); }
::placeholder { color: #9ca3af; }

label { display: block; font-weight: 600; font-size: 14px; }
label > .input, label > textarea, label > select { margin-top: 6px; font-weight: 400; }

.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: 1fr 1fr; }

.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 720px; }
.table th, .table td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }

.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: #eef2ff; font-weight: 600; font-size: 12px; }

/* Status badge colors */
.badge.status-submitted { background: #eef2ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge.status-under-review { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.badge.status-under-investigation { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.badge.status-prosecutor-review { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.badge.status-closed { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }

/* Simple top navigation */
.topnav { display:flex; gap:12px; align-items:center; flex-wrap: wrap; }
.topnav a { color:#fff; opacity:.95; padding: 8px 10px; border-radius: 6px; }
.topnav a:hover { text-decoration: none; opacity:1; background: rgba(255,255,255,.12); }

/* Hamburger button */
.nav-toggle { display:none; background: transparent; border: 1px solid rgba(255,255,255,.6); color:#fff; padding:8px 10px; border-radius:6px; }
.nav-toggle:focus { outline: 2px solid rgba(255,255,255,.7); outline-offset: 2px; }

.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }

/* Responsive tweaks */
@media (max-width: 640px) {
  .grid.two { grid-template-columns: 1fr; }
  header, footer { padding: 12px; }
  main { padding: 12px; }
  .btn { padding: 12px 14px; }
  .table { font-size: 0.9rem; }
  .attachment-media iframe { height: 45vh; }
  /* Collapse nav by default on small screens */
  .nav-toggle { display:inline-block; }
  header .topnav { display: none; width: 100%; }
  header.nav-open .topnav { display:flex; }
  header .actions { width: 100%; }
  /* Tables: keep most cells on one line; let selected columns wrap */
  .table-wrap { overflow-x: auto; }
  .table th, .table td { white-space: nowrap; }
  /* Allow wrapping for Title (2), Case Type (8), Outcome (9), and the last column (Actions) */
  .table th:nth-child(2), .table td:nth-child(2),
  .table th:nth-child(8), .table td:nth-child(8),
  .table th:nth-child(9), .table td:nth-child(9),
  .table th:last-child, .table td:last-child { white-space: normal; }
  /* Suggested min-widths for key columns to avoid squishing */
  .table th:nth-child(1), .table td:nth-child(1) { min-width: 96px; }
  .table th:nth-child(2), .table td:nth-child(2) { min-width: 180px; }
  .table th:nth-child(3), .table td:nth-child(3) { min-width: 120px; }
  .table th:nth-child(4), .table td:nth-child(4),
  .table th:nth-child(5), .table td:nth-child(5) { min-width: 120px; }
  .table th:nth-child(6), .table td:nth-child(6),
  .table th:nth-child(7), .table td:nth-child(7),
  .table th:nth-child(8), .table td:nth-child(8),
  .table th:nth-child(9), .table td:nth-child(9),
  .table th:nth-child(10), .table td:nth-child(10),
  .table th:nth-child(11), .table td:nth-child(11) { min-width: 140px; }
  .table th:nth-child(12), .table td:nth-child(12) { min-width: 200px; }
}

/* Notification bar */
#notif-bar { 
  background: #fff;
  color: var(--text);
  border-top: 1px solid rgba(255,255,255,.25);
  border-bottom: 1px solid var(--border);
}
#notif-bar .notif-wrap { 
  max-width: 960px; 
  margin: 0 auto; 
  padding: 8px 16px; 
  display:flex; 
  align-items:center; 
  justify-content: space-between; 
  gap: 12px; 
}
#notif-bar .notif-left { display:flex; gap:8px; align-items:center; }
#notif-bar .notif-bell { font-size: 18px; }
#notif-bar .notif-text a { color: var(--primary); text-decoration: underline; }
#notif-bar.show { background: #f0f7ff; box-shadow: 0 2px 6px rgba(0,0,0,.08); border-color: #cfe2ff; }

/* Language switcher */
.lang-switcher {
  position: relative;
  display: inline-block;
}

.lang-switcher select {
  appearance: none;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  padding: 6px 28px 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.lang-switcher select:hover {
  background: rgba(255,255,255,.25);
  border-color: rgba(255,255,255,.5);
}

.lang-switcher select:focus {
  outline: 2px solid rgba(255,255,255,.7);
  outline-offset: 2px;
}

.lang-switcher::after {
  content: '▼';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 12px;
  pointer-events: none;
}

@media (max-width: 640px) { }

/* Header brand/logo */
.brand { display:flex; align-items:center; gap:10px; }
.brand img { width: 26px; height: 26px; display:block; }
.brand .brand-text { color:#fff; font-weight:700; letter-spacing:.2px; text-shadow: 0 1px 0 rgba(0,0,0,.15); }

/* Footer */
footer { background: #0b5ed7; background-image: linear-gradient(180deg, #0b5ed7 0%, #0a58ca 100%); color: #eaf2ff; box-shadow: 0 -2px 8px rgba(0,0,0,.04); }
footer .container { display:flex; align-items:center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
footer a { color: #eaf2ff; opacity: .95; }
footer a:hover { opacity: 1; text-decoration: underline; }

/* Password visibility toggle */
.password-field .input-wrap { position: relative; }
.password-field .input { padding-right: 44px; }
.password-field .toggle-pass {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 1px solid transparent; color: #6b7280;
  padding: 6px; line-height: 1; border-radius: 8px; cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.password-field .toggle-pass:hover { background: #f3f4f6; color: #374151; border-color: #e5e7eb; }
.password-field .toggle-pass:focus { outline: 2px solid rgba(37,99,235,0.35); outline-offset: 2px; }
