:root {
  --green: #146c14;
  --green-dark: #0e4f10;
  --red: #c41616;
  --ink: #1c2430;
  --muted: #5c6778;
  --line: #e3e7ee;
  --bg: #f3f5f7;
  --card: #fff;
  --radius: 6px;
  --font: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}
a { color: var(--green-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, .btn, input, select, textarea { font-family: inherit; }

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #cfd6e0;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  background: #fff;
  color: var(--ink);
}
button:hover, .btn:hover { border-color: #b7c0cc; }
.btn.primary, button.primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  min-height: 40px;
}
.btn.primary:hover, button.primary:hover { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.btn.ghost { background: #fff; }
.btn.warn { background: #fff; color: var(--red); border-color: #e7b4b4; }
.btn.warn:hover { background: #fdf6f6; }

.public-page { background: #eef1f3; }
.public-page::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: var(--green);
}
.public {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}
.card {
  position: relative;
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px 26px 24px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .06);
}
.card .close {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 22px;
  line-height: 1;
}
.card .close:hover { background: #eef1f3; color: var(--ink); }
.mark {
  margin: 0 0 10px;
  text-align: center;
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
}
.card h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0;
}
.card h1.solo { margin-bottom: 20px; }
.card .sub { margin: 0 0 18px; text-align: center; color: var(--muted); font-size: 14px; }

.top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  min-height: 56px;
  background: #12261a;
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 3;
  border-bottom: 3px solid var(--red);
}
.brand {
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover { color: #fff; text-decoration: none; }
.top nav { display: flex; gap: 2px; }
.top nav a {
  color: rgba(255, 255, 255, .88);
  font-weight: 500;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: 4px;
  text-decoration: none;
}
.top nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; text-decoration: none; }
.who {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, .8);
  font-size: 13px;
}
.who a { color: rgba(255, 255, 255, .88); text-decoration: none; }
.who a:hover { color: #fff; text-decoration: underline; }
.role-pill, .role-switch select {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 4px;
  padding: 4px 8px;
  color: #fff;
  font-size: 13px;
}
.role-switch { margin: 0; }
.role-switch label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; color: rgba(255, 255, 255, .8); }
.role-switch select option { color: var(--ink); }

.app { width: min(1120px, calc(100% - 32px)); margin: 20px auto 48px; }
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px 18px;
  margin-bottom: 14px;
}
.panel h2 {
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-size: 17px;
  font-weight: 700;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; padding: 0; border: 0; }
.flash {
  background: #f3f8f3;
  border: 1px solid #d5e6d5;
  border-inline-start: 3px solid var(--green);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
  color: #1d3b22;
}
label { display: block; font-weight: 500; margin-bottom: 10px; font-size: 14px; }
label span, .lbl { display: block; margin-bottom: 5px; font-weight: 600; font-size: 13px; color: #2a3442; }
.otp-input {
  letter-spacing: .45em;
  font-size: 28px !important;
  text-align: center;
  font-weight: 700;
  direction: ltr;
}
input[type=text], input[type=password], input[type=date], select, textarea, .otp-input {
  width: 100%;
  background: #fff;
  border: 1px solid #cfd6e0;
  border-radius: var(--radius);
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(20, 108, 20, .2);
  border-color: var(--green);
}
input:disabled, select:disabled, textarea:disabled { background: #f6f7f9; color: #4b5565; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.choice {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 16px 14px;
  color: var(--ink);
  text-decoration: none;
  border-top: 3px solid var(--green);
}
.choice:hover { text-decoration: none; border-color: #c5d0c5; border-top-color: var(--green-dark); }
.choice strong { display: block; margin-bottom: 4px; font-size: 16px; }
.choice span { color: var(--muted); font-size: 13px; line-height: 1.5; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}
.dash-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 148px;
  padding: 18px 16px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  border-top: 4px solid var(--green);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  transition: border-color .15s ease, transform .15s ease;
}
.dash-card:hover {
  text-decoration: none;
  border-color: #c5d0c5;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 24, 40, .08);
}
.dash-card:hover:not([class*="dash-card--"]) {
  border-top-color: var(--green-dark);
}
.dash-card strong {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
}
.dash-card > span:last-child {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  margin-top: auto;
}
.dash-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 10px;
  border-radius: 8px;
  background: #e8f1e8;
  color: var(--green-dark);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
}
.dash-card--wait { border-top-color: #c41616; }
.dash-card--wait .dash-count { background: #fdecec; color: #9b1212; }
.dash-card--process { border-top-color: #b7791f; }
.dash-card--process .dash-count { background: #fff4e0; color: #8a5a12; }
.dash-card--ok { border-top-color: #146c14; }
.dash-card--warn { border-top-color: #9a3412; }
.dash-card--warn .dash-count { background: #ffedd5; color: #9a3412; }
.dash-card--final { border-top-color: #1e3a5f; }
.dash-card--final .dash-count { background: #e8eef6; color: #1e3a5f; }
.dash-card--new { border-top-color: var(--green); background: #f4faf4; }
.dash-card--new .dash-count { display: none; }

.nav-notif {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #c41616;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.notice-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 14px;
  padding: 14px 16px;
  background: #fff8f0;
  border: 1px solid #f0d2a8;
  border-right: 4px solid #b7791f;
  border-radius: 8px;
}
.notice-banner strong { color: #8a5a12; }
.notice-banner span { flex: 1 1 220px; color: #5c4a2e; }
.notice-banner .btn {
  flex: 0 0 auto;
  margin-inline-start: auto;
}
.notif-list { display: grid; gap: 10px; }
.notif-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.notif-item.is-unread {
  background: #f7fbf7;
  border-color: #c5d8c5;
}
.notif-item-main { flex: 1; }
.notif-item-main strong { display: block; margin-bottom: 4px; }
.notif-item-main p { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.notif-item-actions { flex-shrink: 0; }

.role-line-actions {
  display: flex;
  align-items: flex-end;
  padding-bottom: 2px;
}
.role-line-actions .remove-role {
  min-height: 40px;
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  color: #3d4a5c;
  font-weight: 600;
  font-size: 13px;
  background: #f7f8fa;
}
tbody tr:hover td { background: #f8faf8; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 14px; }
.wide { grid-column: 1 / -1; }
.person {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px 12px;
  margin: 14px 0;
  background: #fff;
}
.person h3 {
  margin: 0 -14px 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  background: #dce8dc;
  border-bottom: 1px solid #b7cbb7;
  border-radius: 8px 8px 0 0;
  color: #0e3a14;
}
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.checks label { font-weight: 500; display: flex; gap: 6px; align-items: center; margin: 0; }
.muted { color: var(--muted); font-weight: 500; }
.row-actions { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.tag {
  display: inline-block;
  border-radius: 4px;
  padding: 2px 8px;
  background: #eef3ee;
  color: #1d4a24;
  font-size: 12px;
  font-weight: 600;
}
.search { display: flex; gap: 8px; }
.search input { flex: 1; }
.results {
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-top: 8px;
  max-height: 220px;
  overflow: auto;
  background: #fff;
}
.results button,
.results .dup {
  width: 100%;
  justify-content: flex-start;
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  text-align: right;
  font-weight: 500;
  padding: 8px 10px;
  color: var(--ink);
  font-size: 14px;
}
.results .dup {
  background: #fff8f0;
  color: #7a3e00;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}
.results .dup strong { font-weight: 700; color: var(--ink); }
.results .dup span { font-size: 13px; color: #5c4a2e; }
.results .dup em { font-style: normal; font-size: 12px; color: #9a5a12; }
.results button:hover { background: #f6f8f6; }
#martyr-search-note { margin: 6px 0 0; font-size: 13px; }
.hint {
  background: #f7f8fa;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--muted);
  margin-bottom: 12px;
  font-size: 13px;
}
.child-row { display: grid; grid-template-columns: 1.5fr .55fr 1.3fr .9fr .9fr; gap: 8px; margin-bottom: 8px; }
ul { margin: 0; padding-inline-start: 18px; }
li { margin: 4px 0; }

@media (max-width: 800px) {
  .top { flex-wrap: wrap; padding: 10px 14px; gap: 8px; }
  .who { width: 100%; margin-inline-start: 0; }
  .child-row { grid-template-columns: 1fr 1fr; }
  .app { width: min(1120px, calc(100% - 16px)); }
}
