:root {
  --ink: #0b2427;
  --ink-soft: #24464a;
  --paper: #f2f3ed;
  --panel: #fbfcf8;
  --line: #cbd5cc;
  --muted: #596966;
  --teal: #0b7774;
  --teal-dark: #075b59;
  --acid: #d9f54a;
  --orange: #ed7a32;
  --red: #c73a31;
  --blue: #2469a5;
  --shadow: 0 18px 48px rgba(14, 47, 49, .14);
  --focus-ring: #d9f54a;
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
[hidden] { display: none !important; }
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.shell {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(11, 119, 116, .035) 1px, transparent 1px),
    linear-gradient(rgba(11, 119, 116, .035) 1px, transparent 1px),
    var(--paper);
  background-size: 24px 24px;
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  color: #f7fff9;
  background: var(--ink);
  border-bottom: 4px solid var(--acid);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand__mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  flex: 0 0 38px; color: var(--ink); background: var(--acid);
  border-radius: 4px 13px 4px 4px; font-weight: 900; font-size: 12px;
}
.brand__title { margin: 0; font-size: 17px; letter-spacing: .03em; }
.brand__subtitle { display: block; margin-top: 2px; color: #b7d0ce; font-size: 12px; }
.topbar__actions { display: flex; gap: 8px; align-items: center; }

.button {
  min-height: 38px; padding: 8px 13px; border: 1px solid var(--line);
  border-radius: 7px; color: var(--ink); background: var(--panel); font-weight: 750;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.button:hover { transform: translateY(-1px); border-color: var(--teal); }
.button--primary { color: #fff; background: var(--teal); border-color: var(--teal); }
.button--primary:hover { background: var(--teal-dark); }
.button--accent { color: var(--ink); background: var(--acid); border-color: #bdd438; }
.button--danger { color: #fff; background: var(--red); border-color: var(--red); }
.button--ghost { color: inherit; background: transparent; border-color: rgba(255,255,255,.25); }
.button--small { min-height: 31px; padding: 5px 9px; font-size: 12px; }

.field { display: grid; gap: 6px; }
.field > span, .field > label { color: var(--muted); font-size: 12px; font-weight: 750; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid #aebdb6;
  border-radius: 7px; color: var(--ink); background: #fff; outline: none;
}
.field textarea { min-height: 86px; resize: vertical; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--teal); box-shadow: 0 0 0 3px rgba(11,119,116,.12);
}
.field input[aria-invalid="true"] { border-color: var(--red); box-shadow: 0 0 0 3px rgba(199,58,49,.12); }

.password-input { position: relative; }
.password-input input { padding-right: 58px; }
.password-input__toggle {
  position: absolute; right: 5px; top: 50%; min-width: 46px; min-height: 30px;
  padding: 4px 7px; transform: translateY(-50%); border: 0; border-radius: 5px;
  color: var(--teal-dark); background: #e4f2ef; font-size: 12px; font-weight: 850;
}
.password-input__toggle:hover { background: #d4e9e4; }
.password-input__toggle:focus-visible { outline: 3px solid rgba(11,119,116,.22); outline-offset: 2px; }
.password-rules { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; margin: -2px 0 0; padding: 0; list-style: none; }
.password-rules li { display: grid; gap: 3px; min-width: 0; padding: 7px 8px; border: 1px solid var(--line); border-radius: 5px; background: #f1f3ee; }
.password-rules span { color: var(--ink-soft); font-size: 12px; font-weight: 750; }
.password-rules b { color: var(--muted); font-size: 12px; font-weight: 800; }
.password-rules li.is-met { border-color: #9bc5b6; background: #e4f2ef; }
.password-rules li.is-met b { color: var(--teal-dark); }

.status {
  display: inline-flex; align-items: center; gap: 5px; width: max-content;
  padding: 4px 7px; border-radius: 999px; background: #e5ece7;
  color: #3f5653; font-size: 12px; font-weight: 800;
}
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status--assigned, .status--submitted { color: var(--blue); background: #e5f0fb; }
.status--in_progress, .status--processing { color: #8b5d00; background: #fff2c8; }
.status--changes_requested, .status--failed { color: var(--red); background: #fbe8e6; }
.status--approved, .status--published, .status--ready { color: #087055; background: #dff4e8; }
.status--canceled { color: #707070; background: #ececec; }
.status--archived { color: #5e6570; background: #e5e7eb; }

.empty { padding: 34px 20px; text-align: center; color: var(--muted); }
.notice { padding: 10px 12px; border-left: 4px solid var(--teal); background: #e4f2ef; font-size: 13px; line-height: 1.55; }
.notice--warn { border-left-color: var(--orange); background: #fff0df; }
.notice--error { border-left-color: var(--red); background: #fbe8e6; color: #7d241f; }
.muted { color: var(--muted); }

.login-gate {
  position: fixed; inset: 0; z-index: 5000; display: grid; place-items: center;
  min-height: 100dvh; padding: clamp(18px,4vw,48px); overflow-y: auto; background:
    linear-gradient(90deg, rgba(217,245,74,.045) 1px, transparent 1px),
    linear-gradient(rgba(217,245,74,.045) 1px, transparent 1px),
    radial-gradient(circle at 12% 16%, rgba(217,245,74,.16), transparent 26rem),
    radial-gradient(circle at 88% 82%, rgba(20,142,137,.28), transparent 30rem),
    var(--ink); background-size: 32px 32px,32px 32px,auto,auto,auto;
}
.login-card {
  width: min(400px,100%); padding: 28px; border: 1px solid rgba(255,255,255,.18);
  border-top: 4px solid var(--acid); border-radius: 5px 22px 5px 5px;
  background: var(--panel); box-shadow: 0 28px 80px rgba(0,0,0,.38);
  animation: login-card-enter .38s cubic-bezier(.2,.8,.2,1) both;
}
.login-card__identity { margin-bottom: 24px; }
.login-card h1 { margin: 0; color: #000; font-size: 27px; font-weight: 950; line-height: 1.12; letter-spacing: -.035em; }
.login-card :is(#mapLoginTitle, #adminLoginTitle, #workerLoginTitle) { color: #000; }
.login-card form { display: grid; gap: 14px; }
.login-card .field { gap: 7px; }
.login-card .field input { min-height: 42px; padding-inline: 11px; background: #fff; }
.login-card .form-error { min-height: 18px; }
.login-card .button { width: auto; min-width: 88px; min-height: 38px; justify-self: start; padding: 7px 18px; }
@keyframes login-card-enter { from { opacity: 0; transform: translateY(12px); } }

@media (max-height: 620px) {
  .login-gate { place-items: start center; }
}

.toast-stack { position: fixed; top: 78px; right: 16px; z-index: 6000; display: grid; gap: 8px; }
.toast {
  width: min(360px, calc(100vw - 32px)); padding: 11px 13px; border-radius: 7px;
  color: #fff; background: var(--ink); box-shadow: var(--shadow); font-size: 13px;
  animation: toast-in .22s ease both;
}
.toast--error { background: #8e2c27; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

.progress { height: 7px; overflow: hidden; border-radius: 99px; background: #dfe5df; }
.progress__bar { height: 100%; width: 0; background: var(--teal); transition: width .18s ease; }

dialog { border: 0; padding: 0; color: inherit; background: transparent; }
dialog::backdrop { background: rgba(5, 22, 24, .65); backdrop-filter: blur(4px); }

@media (max-width: 720px) {
  .topbar { min-height: 58px; padding: 8px 12px; }
  .brand__mark { width: 34px; height: 34px; flex-basis: 34px; }
  .brand__title { font-size: 14px; }
  .brand__subtitle { display: none; }
  .topbar__actions .button { min-height: 44px; padding: 7px 10px; font-size: 12px; }
  .login-gate { padding: max(18px,env(safe-area-inset-top)) 12px max(18px,env(safe-area-inset-bottom)); }
  .login-card { padding: 24px 20px; }
  .password-rules { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
