:root {
  --bg: #0b1220;
  --bg2: #0f1a31;
  --card: rgba(255, 255, 255, 0.06);
  --card2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.14);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.70);
  --brand: #caa45a;
  --brand2: #ffd88a;
  --danger: #ff5c6c;
  --ok: #32d583;
  --shadow: 0 16px 50px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --radius2: 10px;
  --control-height: 64px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 600px at 30% 10%, rgba(202, 164, 90, 0.18), transparent 60%),
    radial-gradient(1000px 500px at 80% 20%, rgba(255, 216, 138, 0.10), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
}

a {
  color: var(--brand2);
  text-decoration: none;
}

.container {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  backdrop-filter: blur(10px);
  background: rgba(9, 14, 26, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 10;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(202, 164, 90, 0.95), rgba(255, 216, 138, 0.7));
  box-shadow: 0 10px 30px rgba(202, 164, 90, 0.25);
}

.brand-title {
  line-height: 1.1;
}

.brand-title strong {
  display: block;
  font-size: 14px;
  letter-spacing: 0.6px;
}

.brand-title span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.nav {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.20);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  border-color: rgba(202, 164, 90, 0.55);
  background: linear-gradient(135deg, rgba(202, 164, 90, 0.95), rgba(255, 216, 138, 0.65));
  color: #120f08;
}

.btn-primary:hover {
  border-color: rgba(255, 216, 138, 0.85);
  background: linear-gradient(135deg, rgba(202, 164, 90, 1), rgba(255, 216, 138, 0.8));
}

.btn-danger {
  border-color: rgba(255, 92, 108, 0.5);
  background: rgba(255, 92, 108, 0.16);
}

.page {
  padding: 28px 0 56px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.card {
  position: relative;
  z-index: 1;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card h1,
.card h2,
.card h3 {
  margin: 0 0 10px;
}

.muted {
  color: var(--muted);
}

.kpi {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.kpi strong {
  font-size: 30px;
  letter-spacing: -0.6px;
}

.kpi span {
  color: var(--muted);
  font-weight: 600;
}

.form {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.86);
}

.field-group {
  display: grid;
  gap: 6px;
}

.field-title {
  font-weight: 700;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.86);
}

.suggestions {
  display: grid;
  align-items: center;
  padding: 8px;
  min-height: var(--control-height);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 18, 34, 0.92);
}

.suggestion-item {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.92);
  cursor: pointer;
}

.suggestion-item:hover,
.suggestion-item:focus {
  outline: none;
  border-color: rgba(255, 216, 138, 0.45);
  background: rgba(255, 216, 138, 0.12);
}

.suggestion-item strong {
  color: #ffe2a5;
}

summary {
  cursor: pointer;
}

.advanced-summary {
  font-weight: 800;
  letter-spacing: 0.2px;
  color: rgba(255, 255, 255, 0.92);
}

input,
select {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  width: 100%;
  min-height: var(--control-height);
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  outline: none;
}

option {
  color: #111827;
  background: #ffffff;
}

select:invalid {
  color: rgba(255, 255, 255, 0.72);
}

input:focus,
select:focus {
  border-color: rgba(255, 216, 138, 0.55);
  box-shadow: 0 0 0 4px rgba(255, 216, 138, 0.12);
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.row > * {
  flex: 1;
}

.tribunal-picker {
  position: relative;
  display: grid;
  gap: 10px;
}

.tribunal-help {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.76);
  font-weight: 600;
}

.tribunal-picker.has-selection .tribunal-help {
  color: #ffe2a5;
  border-color: rgba(255, 216, 138, 0.45);
  background: rgba(255, 216, 138, 0.10);
}

.tribunal-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tribunal-list .chip-input,
.choice-list .chip-input {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  display: none !important;
}

.tribunal-list .tribunal-option {
  box-sizing: border-box;
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  text-align: center;
  line-height: 1.2;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(19, 30, 53, 0.95), rgba(14, 24, 44, 0.95));
  color: rgba(255, 255, 255, 0.92);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
  text-decoration: none;
}

.tribunal-list .tribunal-option:hover,
.tribunal-list .tribunal-option:focus {
  background: linear-gradient(135deg, rgba(202, 164, 90, 0.95), rgba(255, 216, 138, 0.78));
  color: #111827;
  border-color: rgba(255, 216, 138, 0.88);
  box-shadow: 0 6px 18px rgba(202, 164, 90, 0.18);
  outline: none;
}

.tribunal-list .chip-input:checked + .tribunal-option,
.tribunal-list .chip-input:focus + .tribunal-option {
  background: linear-gradient(135deg, rgba(202, 164, 90, 0.95), rgba(255, 216, 138, 0.78));
  color: #111827;
  border-color: rgba(255, 216, 138, 0.88);
  box-shadow: 0 6px 18px rgba(202, 164, 90, 0.18);
}

.choice-group {
  display: grid;
  gap: 10px;
}

.choice-group-label {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.82);
  font-weight: 600;
}

.choice-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
}

.choice-list .choice-option {
  box-sizing: border-box;
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  text-align: center;
  line-height: 1.2;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(19, 30, 53, 0.95), rgba(14, 24, 44, 0.95));
  color: rgba(255, 255, 255, 0.92);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
  text-decoration: none;
}

.choice-list .choice-option:hover,
.choice-list .choice-option:focus {
  background: linear-gradient(180deg, rgba(29, 45, 77, 0.98), rgba(20, 34, 60, 0.98));
  border-color: rgba(255, 255, 255, 0.28);
  outline: none;
}

.choice-list .chip-input:checked + .choice-option,
.choice-list .chip-input:focus + .choice-option {
  background: linear-gradient(135deg, rgba(202, 164, 90, 0.95), rgba(255, 216, 138, 0.78));
  color: #111827;
  border-color: rgba(255, 216, 138, 0.88);
  box-shadow: 0 6px 18px rgba(202, 164, 90, 0.18);
}

@media (max-width: 640px) {
  .tribunal-list,
  .choice-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.alert {
  border-radius: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

.alert-danger {
  border-color: rgba(255, 92, 108, 0.45);
  background: rgba(255, 92, 108, 0.12);
  color: rgba(255, 255, 255, 0.92);
}

.alert-ok {
  border-color: rgba(50, 213, 131, 0.45);
  background: rgba(50, 213, 131, 0.12);
}

body.modal-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(4, 9, 20, 0.72);
  backdrop-filter: blur(8px);
}

.modal-overlay[hidden] {
  display: none !important;
}

.modal-card {
  width: min(360px, 100%);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(24, 34, 55, 0.98), rgba(14, 22, 40, 0.98));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

.modal-card-danger {
  border-color: rgba(255, 92, 108, 0.45);
  box-shadow: 0 24px 80px rgba(255, 92, 108, 0.12);
}

.modal-card-ok {
  border-color: rgba(50, 213, 131, 0.35);
  box-shadow: 0 24px 80px rgba(50, 213, 131, 0.12);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-title {
  margin: 0;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.96);
}

.modal-message {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 15px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  background: rgba(10, 15, 28, 0.35);
}

th,
td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: top;
}

th {
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.03);
}

td {
  color: rgba(255, 255, 255, 0.90);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  font-weight: 700;
  font-size: 12px;
}

.footer-note {
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  line-height: 1.5;
}
