:root {
  --navy: #0b3d64;
  --navy-2: #12507f;
  --bg: #f4f6f9;
  --card: #ffffff;
  --border: #d8e0e8;
  --muted: #6b7885;
  --green: #1b6b1b;
  --green-bg: #d9f2d9;
  --yellow: #8a6100;
  --yellow-bg: #fff2cc;
  --orange: #a83b00;
  --orange-bg: #ffe0cc;
  --red: #a80000;
  --red-bg: #ffd6d6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-size: 14px;
  color: #1c2733;
  background: var(--bg);
}

a { color: var(--navy-2); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--navy);
  color: #fff;
  padding: 10px 20px;
}
.topbar .brand a { color: #fff; text-decoration: none; font-weight: 600; font-size: 16px; }
.topbar .version { background: rgba(255,255,255,.18); border-radius: 10px; padding: 2px 8px; font-size: 12px; margin-left: 8px; color: #fff; text-decoration: none; }
.topbar .version:hover { background: rgba(255,255,255,.32); }
.topnav a { color: #dbe7f2; text-decoration: none; margin-left: 16px; }
.topnav a:hover { color: #fff; }

.topnav { display: flex; align-items: center; gap: 14px; }
.topnav a { margin-left: 0; }
.user-info { color: #cfe0ef; font-size: 13px; }
.logout-form { margin: 0; }
.logout-form .btn { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .4); }
.logout-form .btn:hover { background: rgba(255, 255, 255, .12); }

.auth-body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #082c49 0%, #0f4c7d 55%, #1a6aa8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-shell {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  width: 100%;
  max-width: 940px;
  min-height: 540px;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 26px 70px rgba(3, 20, 36, .45);
}
.auth-brand {
  position: relative;
  display: flex;
  align-items: center;
  padding: 46px 42px;
  color: #fff;
  background: linear-gradient(160deg, #0b3d64 0%, #0f4c7d 55%, #14618f 100%);
}
.auth-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .10) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: .55;
  pointer-events: none;
}
.auth-brand-inner { position: relative; z-index: 1; }
.auth-logo {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .32);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 22px;
}
.auth-brand h1 { font-size: 23px; line-height: 1.25; margin: 0 0 10px; color: #fff; }
.auth-brand p { color: #cfe0ef; font-size: 14px; line-height: 1.5; margin: 0 0 24px; }
.auth-features { list-style: none; margin: 0; padding: 0; }
.auth-features li { position: relative; padding-left: 26px; margin-bottom: 11px; color: #e4eefa; font-size: 13.5px; }
.auth-features li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  top: 0;
  color: #7fd0a1;
  font-weight: 700;
}
.auth-panel { padding: 46px 42px; display: flex; flex-direction: column; justify-content: center; }
.auth-panel h2 { margin: 0 0 4px; font-size: 21px; color: var(--navy); }
.auth-panel .sub { color: var(--muted); font-size: 13px; margin: 0 0 22px; }
.auth-form label { font-size: 12.5px; margin-bottom: 14px; }
.auth-form input { width: 100%; padding: 10px 12px; border-radius: 8px; }
.auth-form input[type=text],
.auth-form input[type=password],
.auth-form input[type=number],
.auth-form input[type=search],
.auth-form input[type=email] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #767676;
  border: revert;
}
.auth-form .captcha-row { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.auth-form .captcha-q { font-weight: 700; color: var(--navy); white-space: nowrap; font-size: 15px; }
.auth-form .captcha-row input { max-width: 130px; margin-top: 0; }
.auth-form .btn { width: 100%; margin-top: 8px; padding: 11px; font-size: 14px; }
.auth-foot { margin: 20px 0 0; font-size: 11.5px; color: var(--muted); text-align: center; letter-spacing: .3px; }
@media (max-width: 780px) {
  .auth-shell { grid-template-columns: 1fr; min-height: 0; }
  .auth-brand { padding: 30px 26px; }
  .auth-features { display: none; }
  .auth-panel { padding: 30px 26px; }
}

.notice { background: #eaf5ea; border: 1px solid #bfe0bf; color: #1b6b1b; border-radius: 6px; padding: 8px 12px; font-size: 13px; }
.error { background: #fdecec; border: 1px solid #e8b7b7; color: #a80000; border-radius: 6px; padding: 8px 12px; font-size: 13px; }
.readonly-banner { background: #fff6e5; border: 1px solid #f0d9a8; color: #8a6100; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 13.5px; }

.grid-4 { display: grid; grid-template-columns: 1.2fr 1.4fr 1.4fr 1.6fr; gap: 12px; align-items: end; }
@media (max-width: 900px) { .grid-4 { grid-template-columns: 1fr 1fr; } }
.checks-inline { display: flex; flex-direction: column; gap: 4px; padding-bottom: 6px; }
.temp-pwd { width: 130px; }
.small { font-size: 11.5px; }

.container { max-width: 1900px; margin: 0 auto; padding: 20px 28px; }
.footer { text-align: center; color: var(--muted); padding: 24px; font-size: 12px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { margin: 0; font-size: 22px; color: var(--navy); }
.muted { color: var(--muted); font-size: 12.5px; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lang-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: #fff; }
.lang-switch button { border: 0; background: #fff; padding: 5px 10px; cursor: pointer; font-weight: 600; color: var(--muted); }
.lang-switch button.active { background: var(--navy); color: #fff; }

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin: 8px 0 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); border: 1px solid transparent; border-bottom: 0; border-radius: 6px 6px 0 0; font-weight: 600; }
.tabs a.active { color: var(--navy); background: var(--card); border-color: var(--border); border-bottom: 2px solid var(--card); margin-bottom: -2px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 16px 18px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 16px; color: var(--navy); }
.card h3 { margin: 14px 0 8px; font-size: 14px; color: var(--navy-2); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

label { display: block; font-size: 12.5px; color: #35485c; margin-bottom: 8px; }
input[type=text], input[type=date], textarea, select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font: inherit;
  background: #fff;
  margin-top: 3px;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid #b7d2ea; border-color: var(--navy-2); }

.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 0; }
.check input { width: auto; margin: 0; }

.row-line { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.row-line input { margin: 0; }

.table-wrap { overflow-x: auto; }
.table-wrap.wide { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; background: #fff; }
table.table th, table.table td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; font-size: 13px; }
table.table th { background: #eef3f8; color: var(--navy); font-size: 12px; }
table.table th.vert { writing-mode: vertical-rl; transform: rotate(180deg); max-width: 42px; text-align: left; }
table.table td.center, table.table th.center { text-align: center; }
table.table td.num { text-align: center; width: 34px; color: var(--muted); }
table.table textarea, table.table input, table.table select { margin: 0; font-size: 12.5px; }
input.tiny { width: 60px; }

.grid-table { min-width: 1500px; }
.grid-table td, .grid-table th { font-size: 11.5px; }
.grid-table textarea { min-width: 160px; }
.grid-table select.hz-activities { min-width: 120px; }

.band-pill { display: inline-block; padding: 1px 7px; border-radius: 9px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.band-low { background: var(--green-bg); color: var(--green); }
.band-moderate { background: var(--yellow-bg); color: var(--yellow); }
.band-high { background: var(--orange-bg); color: var(--orange); }
.band-immediate { background: var(--red-bg); color: var(--red); }

.btn { display: inline-block; border: 1px solid var(--border); background: #fff; color: #22405c; border-radius: 6px; padding: 7px 12px; cursor: pointer; text-decoration: none; font-size: 13px; font-weight: 600; }
.btn:hover { background: #f0f5fa; }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-2); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.danger { color: var(--red); border-color: #e8b7b7; }
.btn.danger:hover { background: #fdecec; }

.form-actions { display: flex; gap: 10px; margin: 4px 0 30px; }
.inline-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { margin: 0; }

.list-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.list-head h1 { margin: 0; font-size: 24px; color: var(--navy); }
.list-head .muted { margin: 5px 0 0; }
.create-form { display: flex; gap: 8px; margin: 0; }
.create-form input { min-width: 280px; max-width: 420px; margin: 0; }

.list-toolbar { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.search-form { position: relative; display: flex; align-items: center; flex: 1; max-width: 540px; margin: 0; }
.search-icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.search-form input[type=search] { width: 100%; margin: 0; padding: 10px 12px 10px 38px; border: 1px solid var(--border); border-radius: 10px; }
.search-form #list-clear { margin-left: 8px; }

.badge { display: inline-block; background: #e8eef4; color: #48627c; border-radius: 10px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.badge.ok { background: var(--green-bg); color: var(--green); }

.actions { display: flex; gap: 6px; align-items: center; flex-wrap: nowrap; }
.actions form { margin: 0; }
.empty { color: var(--muted); }

.summary-table td { font-size: 12.5px; }

.legend { font-size: 12px; color: #3c4d5e; background: #f1f6fb; border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; margin: 10px 0; }

.list-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgba(11, 61, 100, .06); overflow: hidden; }
table.table.list { width: 100%; border-collapse: collapse; }
table.table.list th { background: #f4f8fb; color: var(--navy); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; border: 0; border-bottom: 1px solid var(--border); padding: 12px 14px; text-align: left; }
table.table.list td { border: 0; border-bottom: 1px solid #eef2f6; padding: 13px 14px; font-size: 13.5px; vertical-align: middle; }
table.table.list tbody tr.data-row:hover { background: #f8fbfd; }
table.table.list td.nowrap { white-space: nowrap; }
.project-link { color: var(--navy); font-weight: 600; text-decoration: none; }
.project-link:hover { text-decoration: underline; }

.group-row > td { background: #eef3f8; border: 0; padding: 11px 14px; font-weight: 700; color: var(--navy); }
.group-row.section-row > td { background: linear-gradient(90deg, #e6eff7, #f7fafc); border-left: 4px solid var(--navy-2); font-size: 14.5px; }
.year-row > td { background: #fbfdff; padding: 0; }
.year-toggle { width: 100%; text-align: left; display: flex; align-items: center; gap: 9px; padding: 11px 14px 11px 18px; background: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; color: var(--navy); font-size: 13.5px; }
.year-toggle:hover { background: #f1f7fb; }
.year-toggle .caret { color: var(--navy-2); font-size: 11px; }
.count { background: #dbe7f2; color: var(--navy); border-radius: 10px; padding: 1px 9px; font-size: 11.5px; font-weight: 700; }
.separator-row > td { border: 0; padding: 0; }
.separator-row .section-sep { height: 1px; background: var(--border); margin: 0; }
.empty-row > td { color: var(--muted); padding: 16px 14px; }
.row-hidden { display: none !important; }
.year-collapsed { display: none !important; }
