:root {
  --navy: #02066b;
  --navy-deep: #02044a;
  --orange: #f06c23;
  --yellow: #ffb40e;
  --green: #138808;
  --purple: #72288e;
  --brown: #731010;
  --blue: #3b3bf8;
  --ink: #1c2048;
  --muted: #4d527f;
  --line: #e3e5f4;
  --paper: #fffbf6;
  --card: #ffffff;
  --radius: 14px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { font-size: 14px; }
body {
  font-family: "Segoe UI", "Noto Sans", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(circle at top left, rgba(255, 180, 14, 0.28), transparent 32%),
    radial-gradient(circle at bottom right, rgba(240, 108, 35, 0.18), transparent 28%),
    var(--paper);
}
.login-card {
  width: min(440px, 100%);
  background: var(--card);
  border-radius: 22px;
  padding: 32px 28px;
  box-shadow: 0 18px 50px rgba(2, 6, 107, 0.08);
}
.login-card img { height: auto; }
.login-card h1 { margin: 14px 0 6px; color: var(--navy); font-size: 24px; }
.login-card p { margin: 0 0 18px; color: var(--muted); line-height: 1.45; font-size: 14px; }
.login-card form { display: grid; gap: 12px; }
.dev-code {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff4d4;
  text-align: center;
}
.dev-code span { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.dev-code strong { color: var(--navy); font-size: 22px; letter-spacing: 0.18em; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.rail {
  background: var(--navy);
  color: white;
  padding: 18px 14px 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: white;
  text-decoration: none;
  padding: 6px 8px 16px;
}
.brand img { width: 52px; height: 52px; object-fit: contain; background: white; border-radius: 12px; padding: 4px; }
.brand strong { display: block; font-size: 15px; }
.brand small { color: #d9dcf8; font-size: 12px; }
.nav { display: grid; gap: 4px; }
.nav button {
  text-align: left;
  border: 0;
  background: transparent;
  color: #e7e9ff;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
}
.nav button[aria-current="page"] { background: var(--orange); color: white; font-weight: 700; }
.nav button:hover { background: rgba(255, 255, 255, 0.08); }
.nav button[aria-current="page"]:hover { background: var(--orange); }

.workspace { min-width: 0; }
.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 22px 28px 8px;
}
.crumb { margin: 0; color: var(--orange); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; font-size: 11px; }
.top h1 { margin: 2px 0 0; color: var(--navy); font-size: 22px; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.view { padding: 8px 28px 40px; display: grid; gap: 16px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.stat {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--line);
  text-align: left;
}
.stat strong { display: block; font-size: 22px; color: var(--navy); }
.stat span { color: var(--muted); font-size: 12px; }
.stat:nth-child(3n) strong { color: var(--purple); }
.stat:nth-child(4n) strong { color: var(--green); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}
.card h2, .view h2 { margin: 0 0 8px; color: var(--navy); font-size: 16px; }
.view h3 { margin: 12px 0 6px; color: var(--navy); font-size: 14px; }
.lede { margin: 0; color: var(--muted); line-height: 1.45; font-size: 13px; }
.split { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.stack { display: grid; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13px; }
th { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
tr:hover td { background: #fff8f2; }

.filters, .form-grid { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
label { display: grid; gap: 6px; font-size: 13px; font-weight: 650; color: var(--navy); min-width: 160px; }
input, select, textarea {
  border: 1.5px solid rgba(2, 6, 107, 0.28);
  border-radius: 10px;
  padding: 8px 10px;
  background: white;
  min-height: 36px;
  font-size: 13px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(240, 108, 35, 0.28); border-color: var(--orange); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { min-width: 0; font-weight: 600; display: flex; gap: 6px; align-items: center; }
fieldset { border: 1px solid var(--line); border-radius: 12px; margin: 0; padding: 10px 12px; }
legend { padding: 0 6px; color: var(--navy); font-weight: 700; font-size: 13px; }

.primary, .ghost, .danger, .good {
  border-radius: 10px;
  padding: 8px 12px;
  border: 0;
  font-weight: 700;
  font-size: 13px;
}
.primary { background: var(--navy); color: white; }
.primary.accent { background: var(--orange); }
.ghost { background: #eef0fb; color: var(--navy); }
.danger { background: var(--brown); color: white; }
.good { background: var(--green); color: white; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.linkish { background: none; border: 0; color: var(--blue); font-weight: 700; padding: 0; }

.chip {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 750;
  background: #eceefe;
  color: var(--navy);
}
.chip-active, .chip-approved, .chip-published, .chip-approved-participation { background: #e5f6e3; color: var(--green); }
.chip-pending, .chip-submitted, .chip-under-review, .chip-draft { background: #fff4d4; color: #8a5a00; }
.chip-rejected, .chip-suspended, .chip-cancelled { background: #fde8e8; color: var(--brown); }
.chip-approved-winner { background: #efe4f6; color: var(--purple); }
.chip-approved-runner-up, .chip-ongoing { background: #e7e8ff; color: var(--blue); }

.pager { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.muted { color: var(--muted); font-size: 12px; }
.note { background: #fff4e8; border-radius: 12px; padding: 10px 12px; color: #6a320c; font-size: 13px; }
.warn { background: #fff4d4; }

.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: var(--navy);
  color: white;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  max-width: min(360px, calc(100% - 24px));
  z-index: 30;
}
.dialog { position: fixed; inset: 0; background: rgba(2, 4, 74, 0.46); display: grid; place-items: center; padding: 20px; z-index: 20; }
.dialog-card { width: min(720px, 100%); max-height: min(90vh, 860px); overflow: auto; background: white; border-radius: 18px; padding: 20px; display: grid; gap: 12px; }
.dialog-card h2 { margin: 0; color: var(--navy); font-size: 18px; }
.stack > label, .dialog-card label { width: 100%; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
[hidden] { display: none !important; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; }
  .nav { display: flex; overflow-x: auto; }
  .nav button { white-space: nowrap; }
  .top, .view { padding-left: 16px; padding-right: 16px; }
}
