:root {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #152c3d;
  background: #f3f7f8;
  line-height: 1.6;
  --ink: #152c3d;
  --muted: #526776;
  --line: #dbe5e9;
  --surface: #fff;
  --accent: #155b85;
  --accent-dark: #10486b;
  --soft: #eaf4fa;
  --green: #126c56;
  --shadow: 0 14px 38px #18384c0b;
}
* { box-sizing: border-box }
body { margin: 0 }
main { max-width: 1160px; margin: auto; padding: 32px clamp(16px, 4vw, 40px) }
.portal, .workspace, .setup { min-height: 100vh; display: flex; flex-direction: column }
.portal > main, .workspace > main, .setup > main { flex: 1; width: 100%; margin: 0 auto }
h1, h2, h3 { line-height: 1.24; margin: 0 0 10px; overflow-wrap: anywhere }
h1 { font-size: clamp(1.65rem, 4vw, 2.4rem); letter-spacing: -.035em }
h2 { font-size: 1.25rem }
h3 { font-size: 1.08rem }
p { margin: 0 0 14px; overflow-wrap: anywhere }
a { color: var(--accent); text-underline-offset: .18em }
[hidden], .workspace-alerts:empty { display: none !important }
:focus-visible { outline: 3px solid #2389b6; outline-offset: 3px }
.site-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px max(clamp(16px, 4vw, 40px), calc((100% - 1080px) / 2));
  background: #fff; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 750; line-height: 1.35 }
.brand img { display: block; flex: none; object-fit: contain; background: #fff; border-radius: 50% }
.quiet-link, .bar-label { font-size: .875rem; font-weight: 650 }
.quiet-link { text-decoration: none; white-space: nowrap }
.bar-label, .muted { color: var(--muted) }
.eyebrow { font-size: .82rem; font-weight: 750; color: var(--green); letter-spacing: .09em; margin-bottom: 10px }
section, article, form, details {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin: 0 0 14px;
}
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 44px; max-width: 100%;
  padding: 9px 16px; border: 1px solid transparent; border-radius: 10px; background: var(--accent);
  color: #fff; font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
}
button:hover, .button:hover { background: var(--accent-dark) }
button:disabled { opacity: .55; cursor: default }
.secondary { color: var(--accent-dark); background: var(--soft); border-color: var(--line) }
.secondary:hover { background: #dceef7 }
.full-button { width: 100% }
label { display: block; font-size: .9rem; font-weight: 650; margin: 0 0 14px }
input:not([type=checkbox]):not([type=radio]), select, textarea {
  display: block; width: 100%; min-width: 0; min-height: 44px; padding: 9px 11px; border: 1px solid #bfd0d9;
  border-radius: 9px; font: inherit; font-size: 1rem; font-weight: 400; color: var(--ink); background: #fff; margin-top: 5px;
}
input[type=checkbox], input[type=radio] { accent-color: var(--accent) }
textarea { resize: vertical }
.check-field { display: flex; align-items: center; gap: 8px }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(145px, 100%), 1fr)); gap: 10px }
summary { cursor: pointer; color: var(--accent-dark); font-weight: 750; padding: 4px }
details[open] summary { margin-bottom: 12px }
.tile { color: #165640; background: #e9f7f1 }
.tile:hover { background: #d7f0e7 }
.notice { margin: 0 0 14px; padding: 12px 14px; border-radius: 9px; color: #2d546e; background: #eaf4fa }
.warning { color: #932e29 }
.notice.warning { background: #fff0ed }
.notice.success { background: #e5f5ed; color: #145a44 }
.scroll { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-bottom: 14px }
table { border-collapse: collapse; width: 100%; font-size: .91rem }
td, th { text-align: left; vertical-align: middle; white-space: nowrap; padding: 11px 14px; border-bottom: 1px solid var(--line) }
th { color: #375467; background: #edf4f7 }
tr:last-child td { border-bottom: 0 }
dialog {
  width: min(94vw, 660px); max-height: 88vh; max-height: 88dvh; padding: clamp(16px, 4vw, 28px);
  border: 1px solid var(--line); border-radius: 18px; color: var(--ink); box-shadow: var(--shadow);
}
dialog::backdrop { background: #10293ca8 }
dialog .close { display: flex; margin: 0 0 14px auto; color: #27475a; background: #edf3f6 }
dialog form { padding: 0; border: 0 }
#actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px }

.portal-main { padding-top: clamp(24px, 5vw, 56px) }
.hero {
  position: relative; isolation: isolate; overflow: hidden; display: grid; align-items: center;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, .85fr); gap: clamp(24px, 5vw, 64px);
  padding: clamp(28px, 6vw, 76px); color: white; background: linear-gradient(122deg, #103249 12%, #125571 61%, #137363);
  border: 0; border-radius: clamp(18px, 3vw, 30px); box-shadow: 0 18px 42px #06354722;
}
.hero::after {
  content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 88% 18%, #81e6c842, transparent 35%),
    repeating-linear-gradient(140deg, transparent 0 30px, #ffffff0c 30px 31px, transparent 31px 43px);
  mask-image: linear-gradient(90deg, transparent 15%, #000 100%);
}
.hero h1 { font-size: clamp(2rem, 5vw, 4rem); margin: 0 0 14px }
.hero .eyebrow { color: #a8e8d9 }
.hero-description { color: #dbeef1; font-size: clamp(.96rem, 1.8vw, 1.15rem); margin-bottom: 26px }
.primary-cta { background: #e4fff5; color: #134e43 }
.primary-cta:hover { background: #ccf4e5 }
.flow-board { padding: clamp(16px, 3vw, 24px); background: #092b3d5e; border: 1px solid #ccf3f450; border-radius: 19px }
.flow-board h2 { font-size: 1rem; margin: 0 0 15px }
.flow { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px }
.flow li { display: flex; align-items: center; gap: 12px; padding: 8px 11px; background: #ffffff12; border-radius: 9px }
.flow-dot { width: 9px; height: 9px; flex: none; background: #9ff0d6; border-radius: 50% }
.flow small { display: block; color: #c6e9eb; font-size: .82rem }
.role-grid, .download-grid, .setup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px }
.role-grid { margin-top: 20px }
.role-card { display: flex; align-items: flex-start; gap: 14px; padding: clamp(16px, 3vw, 26px); box-shadow: var(--shadow) }
.role-card p { color: var(--muted); margin: 0 }
.role-mark { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; font-weight: 750; color: var(--accent); background: var(--soft) }
.worker-card .role-mark { color: var(--green); background: #e5f6ef }
.site-footer {
  width: min(100% - 32px, 1080px); margin: 0 auto; padding: 18px 0 24px;
  border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: .86rem;
}
.site-footer p { margin: 2px 0 }
.site-footer .footer-link { color: inherit; text-decoration: none; text-underline-offset: .24em }
.site-footer .footer-link:hover, .site-footer .footer-link:focus-visible { text-decoration: underline; text-decoration-thickness: 1px }
.footer-registration { font-size: .92em; overflow-wrap: anywhere }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap }
.download-grid, .setup-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, .85fr); align-items: start }
.download-intro, .download-guide, .setup-grid > * { padding: clamp(18px, 3vw, 28px); box-shadow: var(--shadow) }
.release-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 }
.release-meta div { flex: 1 1 90px; background: var(--soft); border-radius: 9px; padding: 9px 11px }
.release-meta dt { font-size: .8rem; color: var(--muted) }
.release-meta dd { margin: 0; font-weight: 700 }
.guide-list { padding-left: 1.3em }
.guide-list li { margin: 8px 0 }
.site-cover { display: block; width: 100%; max-height: 275px; object-fit: contain; border-radius: 14px; margin: 0 0 16px; background: #edf5f6 }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px }
.toolbar form { display: flex; flex: 1 1 250px; gap: 8px; margin: 0; padding: 0; border: 0; background: transparent }
.toolbar form input { margin-top: 0 }
.metric-grid { grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)) }
.metric-grid section { margin-bottom: 8px }
.metric-value { font-size: 1.7rem; font-weight: 750; margin: 0 }
.admin-actions { display: flex; gap: 6px }
.verbatim { white-space: pre-wrap }
.logo-preview { display: block; width: min(100%, 220px); height: auto; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 14px }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(145px,100%),1fr)); align-items: end; gap: 10px }
.filter-grid label { margin: 0 }

.workspace[data-role=worker] { --accent: #126c56; --accent-dark: #0e5846; --soft: #e5f6ef }
.workspace:has(#login input[value=worker]:checked) { --accent: #126c56; --accent-dark: #0e5846; --soft: #e5f6ef }
.workspace[data-state=entry], .setup { background: radial-gradient(ellipse at 65% 0, #e0f2ef 0, #f3f7f8 65%); min-height: 100vh }
.workspace-alerts > p { max-width: 100% }
#status:empty { display: none }
#status:not(:empty) { background: #eaf4fa; color: #204e69; padding: 10px 13px; border-radius: 9px }
.workspace[data-state=entry] .workspace-alerts { max-width: 490px; margin: 0 auto }
.login-card, .state-card, #password { width: min(100%, 490px); margin: clamp(6px, 4vw, 48px) auto 18px; padding: clamp(20px, 4vw, 34px); box-shadow: var(--shadow) }
.login-heading { margin-bottom: 20px }
.workspace[data-state=entry] .login-card { margin-top: 0 }
.login-help { margin: 14px 0 0; color: var(--muted); font-size: .88rem }
.role-select { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; border: 0; padding: 0; margin: 0 0 14px }
.role-select legend { padding: 0 0 5px; font-size: .9rem; font-weight: 650 }
.role-select label { display: flex; align-items: center; gap: 7px; margin: 0; padding: 10px; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer }
.role-select label:has(input:checked) { color: var(--accent-dark); background: var(--soft); border-color: var(--accent) }
#nav:empty { display: none }
#nav { min-width: 0; padding: 9px; border: 1px solid var(--line); border-radius: 14px; background: #fff; margin-bottom: 20px }
#nav button, #nav .button { text-align: left; color: #395467; background: transparent; justify-content: flex-start }
#nav button:hover, #nav .button:hover, #nav [aria-current=page] { color: var(--accent-dark); background: var(--soft) }
.workspace-content { min-width: 0 }
#view-title { margin-bottom: 17px }
.work-order { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 16px; box-shadow: var(--shadow) }
.work-order p { margin: 5px 0 0; color: var(--muted); font-size: .91rem }
.work-order.urgent { border-left: 4px solid #d0524d }
.work-order button { background: var(--soft); color: var(--accent-dark) }
.work-order button:hover { filter: brightness(.96) }
.order-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 9px }
.order-meta code { font-size: .83rem; overflow-wrap: anywhere }
.pill { display: inline-flex; align-items: center; border-radius: 100px; padding: 3px 9px; background: var(--soft); color: var(--accent-dark); font-size: .8rem; white-space: nowrap }
.pill.good { color: #145a44; background: #e5f5ed }
.pill.bad { color: #932e29; background: #fff0ed }
.empty-state { text-align: center; color: var(--muted); padding: 30px 16px }
.setup-heading { margin-bottom: 20px }
.setup-grid { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr) }
.checklist { padding: 0; list-style: none; margin: 14px 0 }
.checklist li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .9rem }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 10px }
.setup-admin { margin: 20px 0 0; padding-top: 17px; border-top: 1px solid var(--line) }
@media (min-width: 800px) {
  .workspace[data-channel=admin][data-state=work] .workspace-main { display: grid; grid-template-columns: 185px minmax(0, 1fr); gap: 0 22px }
  .workspace[data-channel=admin][data-state=work] .workspace-alerts, .workspace[data-channel=admin][data-state=work] #password:not([hidden]) { grid-column: 1 / -1 }
  .workspace[data-channel=admin][data-state=work] #nav { flex-direction: column; align-items: stretch; align-self: start; margin: 0 }
}
@media (max-width: 680px) {
  main { padding-top: 20px }
  .hero, .role-grid, .download-grid, .setup-grid { grid-template-columns: minmax(0, 1fr) }
  .hero { gap: 22px }
  .role-grid { gap: 0 }
  .site-bar { padding-block: 10px }
  .brand img { width: 38px; height: 38px }
  .workspace[data-state=work] #nav { display: flex; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-inline: contain }
  #nav button, #nav .button { white-space: nowrap }
  .work-order { grid-template-columns: minmax(0, 1fr) }
  .work-order button { justify-self: start }
}
@media (max-width: 375px) {
  .field-grid { grid-template-columns: minmax(0, 1fr) }
  .brand { font-size: .9rem }
  .bar-label { font-size: .76rem }
}
