:root {
  --ink: #20312f;
  --muted: #61736e;
  --line: #d7e3df;
  --paper: #f4f8f7;
  --card: #ffffff;
  --accent: #0c7668;
  --accent-dark: #075b51;
  --accent-soft: #e5f3ef;
  --warn: #fff5dc;
  --danger: #fff0ee;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 15px/1.6 system-ui, -apple-system, "Microsoft YaHei", sans-serif; }

.topbar { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px max(16px, calc((100% - 1080px) / 2)); background: #173e39; color: #fff; }
.topbar-inner { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand { color: #fff; font-size: 20px; font-weight: 750; letter-spacing: .05em; text-decoration: none; white-space: nowrap; }
.brand:hover { color: #d8f3ed; }
.team-badge { border: 1px solid #72aaa0; border-radius: 20px; background: transparent; color: #d8f3ed; font-size: 12px; padding: 3px 10px; white-space: nowrap; }
.logout-form { color: #d8f3ed; }
.username { overflow: hidden; max-width: 9rem; text-overflow: ellipsis; white-space: nowrap; }
.logout-button { min-height: 38px; }

.app-container { width: min(1080px, calc(100% - 24px)); margin: 30px auto 70px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.muted { color: var(--muted) !important; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 24px; }
.display-title { margin: 4px 0 5px; font-size: clamp(1.7rem, 5vw, 2.25rem); font-weight: 750; letter-spacing: -.03em; }
.summary { display: flex; align-items: baseline; gap: 5px; flex: 0 0 auto; color: var(--accent); white-space: nowrap; }
.summary strong { font-size: 2rem; font-weight: 750; }
.summary span { color: var(--muted); font-size: 13px; }

.flash { margin-bottom: 16px; border-radius: 10px; padding: 11px 14px; }
.flash.success { background: #e7f7ef; border-color: #b8e3cc; color: #176b4c; }
.flash.warning { background: var(--warn); border-color: #f0db9f; color: #78571c; }
.flash.error { background: var(--danger); border-color: #efc0b8; color: #9c372b; }

.work-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.work-card, .login-card, .empty { border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.work-card .card-body { padding: 22px; }
.work-meta { display: flex; align-items: center; justify-content: space-between; min-height: 24px; color: var(--muted); font-size: 12px; }
.team-badge { display: inline-block; background: var(--accent-soft); border-color: transparent; color: var(--accent-dark); font-weight: 650; }
.topbar .team-badge { background: transparent; border-color: #72aaa0; color: #d8f3ed; }
.work-title { margin: 12px 0 15px; font-size: clamp(1.3rem, 4vw, 1.5rem); font-weight: 750; }
.details { display: grid; gap: 8px; margin: 0; border-top: 1px solid var(--line); padding: 15px 0 0; }
.details div { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 10px; }
.details dt { color: var(--muted); }
.details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.supervisor { font-weight: 650; }
.supervisor span { margin-left: 6px; color: #a34d2d; font-size: 12px; font-weight: 500; }
.work-card form { margin-top: 18px; }
fieldset { min-width: 0; border: 0; padding: 0; margin: 0 0 17px; }
legend { float: none; width: auto; margin-bottom: 9px; font-weight: 700; }
.worker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.worker { display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: center; gap: 5px; min-height: 48px; margin: 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.worker .form-check-input { margin: 0; }
.worker-copy { min-width: 0; overflow-wrap: anywhere; }
.worker:has(input:checked) { border-color: #6ebcb0; background: #edfaf6; }
.worker:focus-within { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgb(12 118 104 / 20%); }
.worker--disabled { background: #f1f4f3; color: #8b9894; cursor: not-allowed; }
.worker--disabled small { grid-column: 2; color: #a34d2d; font-size: 11px; }
.record-id { margin-top: 18px; color: var(--muted); font-size: 12px; }
.submit-button { min-height: 48px; }

.login-card { max-width: 440px; margin: clamp(32px, 10vh, 88px) auto 0; }
.login-card .card-body { padding: clamp(22px, 6vw, 34px); }
.login-card h1 { font-weight: 750; letter-spacing: -.03em; }
.stack-form { display: grid; gap: 17px; margin-top: 25px; }
.stack-form .form-label { margin-bottom: 6px; font-weight: 650; }
.stack-form .form-control { min-height: 48px; }
.empty .card-body { padding: 54px 20px; }
.empty h1, .empty h2 { margin: 5px 0 10px; }
.inline-button { margin-top: 12px; min-width: 112px; }

.form-control:focus, .form-check-input:focus, .btn:focus-visible, .brand:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 .2rem rgb(12 118 104 / 25%); }
.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent-dark); --bs-btn-hover-border-color: var(--accent-dark); --bs-btn-active-bg: var(--accent-dark); --bs-btn-active-border-color: var(--accent-dark); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }

@media (max-width: 575.98px) {
  .topbar { min-height: 60px; padding: 9px 12px; }
  .brand { font-size: 18px; }
  .username { display: none; }
  .app-container { margin-top: 22px; }
  .page-heading { display: block; margin-bottom: 20px; }
  .summary { margin-top: 10px; }
  .summary strong { font-size: 1.75rem; }
  .work-card .card-body { padding: 18px; }
  .worker-grid { grid-template-columns: 1fr; }
  .details div { grid-template-columns: 6.5rem minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
