:root {
  color-scheme: light;
  --ink: #0f172a;
  --ink-soft: #1e293b;
  --paper: #f4f7fb;
  --card: #ffffff;
  --line: rgb(15 23 42 / 9%);
  --muted: #64748b;
  --negative: #dc2626;
  --negative-strong: #b91c1c;
  --neutral: #334155;
  --neutral-border: #d5dde8;
  --neutral-fill: #f8fafc;
  --info: #0369a1;
  --danger: var(--negative);
  --shadow: 0 16px 40px rgb(15 23 42 / 8%);
  --shadow-sm: 0 1px 2px rgb(15 23 42 / 5%);
  --radius: 16px;
  --radius-sm: 10px;
  --focus-ring: 3px solid rgb(var(--accent-rgb) / 42%);
  --font: "Noto Sans JP", "Inter", "Yu Gothic UI", "Segoe UI", sans-serif;
  --display: "Inter", "Noto Sans JP", sans-serif;
  --text-xs: .75rem;
  --text-sm: .8125rem;
  --text-md: .9375rem;
  --text-lg: 1.125rem;
  --text-xl: 1.375rem;
  --text-2xl: 1.75rem;
  --shell: #ffffff;
  --shell-muted: #64748b;
  --shell-line: rgb(15 23 42 / 8%);

  /* Shared workspace. Role themes change the accent only. */
  --bg-base: #e7eef6;
  --bg-mid: #f5f8fb;
  --bg-end: #eef3f8;

  /* Default accent: sign-in (deep blue) */
  --accent: #1d4ed8;
  --accent-soft: #60a5fa;
  --accent-strong: #1e40af;
  --accent-muted: #bfdbfe;
  --accent-eyebrow: #1d4ed8;
  --accent-rgb: 29 78 216;
  --accent-soft-rgb: 96 165 250;
  --accent-strong-rgb: 30 64 175;
  --accent-deep-rgb: 30 58 138;
  --bg-accent-rgb: 29 78 216;
  --bg-accent2-rgb: 14 116 144;
  --nav-active-text: #1e3a8a;
  --nav-active-bg: #dbeafe;
  --surface-tint: #eff6ff;
  --surface-tint-strong: #dbeafe;
  --surface-border: #bfdbfe;
  --surface-hover: #e8f1ff;
  --primary-text-on-accent: #fff;
  --positive: var(--accent);
  --positive-strong: var(--accent-strong);
  --positive-soft: var(--accent-soft);
  --primary: var(--accent);
  --primary-strong: var(--accent-strong);
}

html[lang="en"] body {
  font-family: "Inter", "Noto Sans JP", "Segoe UI", sans-serif;
}

/* Super — indigo. Admin — blue. User — teal. Finance — amber. */
body.theme-super {
  --accent: #6d28d9;
  --accent-soft: #a78bfa;
  --accent-strong: #5b21b6;
  --accent-muted: #ddd6fe;
  --accent-eyebrow: #6d28d9;
  --accent-rgb: 109 40 217;
  --accent-soft-rgb: 167 139 250;
  --accent-strong-rgb: 91 33 182;
  --accent-deep-rgb: 76 29 149;
  --bg-accent-rgb: 109 40 217;
  --nav-active-text: #5b21b6;
  --nav-active-bg: #ede9fe;
  --surface-tint: #f5f3ff;
  --surface-tint-strong: #ede9fe;
  --surface-border: #ddd6fe;
  --surface-hover: #f5f3ff;
}

body.theme-admin {
  --accent: #1d4ed8;
  --accent-soft: #60a5fa;
  --accent-strong: #1e40af;
  --accent-muted: #bfdbfe;
  --accent-eyebrow: #1d4ed8;
  --accent-rgb: 29 78 216;
  --accent-soft-rgb: 96 165 250;
  --accent-strong-rgb: 30 64 175;
  --accent-deep-rgb: 30 58 138;
  --bg-accent-rgb: 29 78 216;
  --nav-active-text: #1e3a8a;
  --nav-active-bg: #dbeafe;
  --surface-tint: #eff6ff;
  --surface-tint-strong: #dbeafe;
  --surface-border: #bfdbfe;
  --surface-hover: #e8f1ff;
}

body.theme-finance {
  --accent: #c2410c;
  --accent-soft: #fb923c;
  --accent-strong: #9a3412;
  --accent-muted: #fed7aa;
  --accent-eyebrow: #c2410c;
  --accent-rgb: 194 65 12;
  --accent-soft-rgb: 251 146 60;
  --accent-strong-rgb: 154 52 18;
  --accent-deep-rgb: 124 45 18;
  --bg-accent-rgb: 194 65 12;
  --nav-active-text: #9a3412;
  --nav-active-bg: #ffedd5;
  --surface-tint: #fff7ed;
  --surface-tint-strong: #ffedd5;
  --surface-border: #fed7aa;
  --surface-hover: #fff7ed;
}

body.theme-user {
  --accent: #0f766e;
  --accent-soft: #2dd4bf;
  --accent-strong: #115e59;
  --accent-muted: #99f6e4;
  --accent-eyebrow: #0f766e;
  --accent-rgb: 15 118 110;
  --accent-soft-rgb: 45 212 191;
  --accent-strong-rgb: 17 94 89;
  --accent-deep-rgb: 19 78 74;
  --bg-accent-rgb: 15 118 110;
  --nav-active-text: #115e59;
  --nav-active-bg: #ccfbf1;
  --surface-tint: #f0fdfa;
  --surface-tint-strong: #ccfbf1;
  --surface-border: #99f6e4;
  --surface-hover: #f0fdfa;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body { min-height: 100%; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 3000;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.skip-link:focus {
  top: 12px;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  background: var(--bg-mid);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(880px 420px at 0% -12%, rgb(var(--bg-accent-rgb) / 10%), transparent 58%),
    radial-gradient(720px 380px at 100% 0%, rgb(14 116 144 / 7%), transparent 52%),
    linear-gradient(180deg, var(--bg-mid) 0%, var(--bg-base) 100%);
}

.app-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgb(15 23 42 / 3.5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(15 23 42 / 3.5%) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 0%, black, transparent 80%);
  pointer-events: none;
}

button, input, select, textarea { font: inherit; }

/* Default = secondary / neutral action */
button {
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid var(--neutral-border);
  border-radius: 12px;
  background: var(--neutral-fill);
  color: var(--neutral);
  cursor: pointer;
  font-weight: 700;
  letter-spacing: .01em;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #94a3b8;
  color: var(--ink-soft);
  background: #fff;
  box-shadow: 0 8px 18px rgb(15 23 42 / 8%);
}

button:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* Positive / forward actions — theme accent */
button.primary {
  color: var(--primary-text-on-accent);
  border-color: transparent;
  background: var(--accent);
  box-shadow: 0 1px 2px rgb(15 23 42 / 8%), 0 8px 18px rgb(var(--accent-rgb) / 22%);
}

button.primary:hover:not(:disabled) {
  color: var(--primary-text-on-accent);
  border-color: transparent;
  background: var(--accent-strong);
  box-shadow: 0 10px 22px rgb(var(--accent-rgb) / 28%);
}

/* Negative / cancel / revoke — red + white */
button.danger {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(180deg, #f87171, var(--negative-strong));
  box-shadow: 0 10px 24px rgb(220 38 38 / 24%);
}

button.danger:hover:not(:disabled) {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(180deg, #fb7185, var(--negative));
}

/* Explicit secondary (same as default, for clarity in markup) */
button.secondary {
  color: var(--neutral);
  border-color: var(--neutral-border);
  background: var(--neutral-fill);
  box-shadow: none;
}

button.secondary:hover:not(:disabled) {
  color: var(--ink-soft);
  background: #fff;
  border-color: #94a3b8;
}

input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid rgb(15 23 42 / 14%);
  border-radius: var(--radius-sm);
  background: #fbfcff;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

input::placeholder, textarea::placeholder { color: #94a3b8; }

textarea { min-height: 96px; resize: vertical; }

input:hover, select:hover, textarea:hover {
  border-color: rgb(var(--accent-rgb) / 35%);
}

/* Request Latin input for email/password. ime-mode is a browser hint, strongest on Windows. */
input.ime-latin,
input.ime-latin:focus {
  ime-mode: disabled;
}

input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
  border-color: rgb(var(--accent-rgb) / 45%);
}

input[type="file"] {
  padding: 10px 12px;
  border-style: dashed;
  border-color: var(--surface-border);
  background: var(--surface-tint);
  cursor: pointer;
  font-size: .88rem;
}
input[type="file"]:hover { background: var(--surface-tint-strong); }

.app-header {
  position: relative;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(1560px, calc(100% - 28px));
  margin: 18px auto 0;
  padding: 16px 20px;
  color: var(--ink);
  border: 1px solid var(--shell-line);
  border-radius: 18px;
  background: #fff;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-sm);
}

body.is-authed { scroll-padding-top: 96px; }

body.is-authed .app-header {
  border-color: rgb(var(--accent-rgb) / 24%);
  box-shadow: var(--shadow), inset 4px 0 0 rgb(var(--accent-rgb) / 72%);
}

body.is-authed .app-nav {
  position: sticky;
  top: 10px;
  z-index: 90;
  border-color: rgb(var(--accent-rgb) / 22%);
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  color: var(--primary-text-on-accent);
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .04em;
  background: linear-gradient(145deg, var(--accent-soft), var(--accent) 55%, var(--accent-strong));
  box-shadow: 0 12px 28px rgb(var(--accent-rgb) / 32%);
}

.app-header h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: .02em;
}

.brand-sub { margin: 2px 0 0; color: var(--shell-muted); font-size: .88rem; }

.eyebrow {
  margin: 0;
  color: var(--accent-eyebrow);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--shell-line);
  border-radius: 999px;
  background: var(--neutral-fill);
  color: var(--ink-soft);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .04em;
  white-space: nowrap;
}

.role-glyph {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: currentColor;
  box-shadow: 0 0 0 3px rgb(255 255 255 / 45%);
}

.phase-badge.is-role {
  color: var(--primary-text-on-accent);
  border-color: rgb(var(--accent-rgb) / 45%);
  background: linear-gradient(135deg, rgb(var(--accent-rgb) / 88%), rgb(var(--accent-strong-rgb) / 92%));
  box-shadow: 0 8px 22px rgb(var(--accent-rgb) / 28%);
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(1560px, calc(100% - 28px));
  margin: 12px auto 0;
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--shell-line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.whoami { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; min-width: 0; flex: 1 1 220px; }
.whoami .muted { color: var(--muted); }
.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  color: var(--primary-text-on-accent);
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  font-weight: 800;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgb(var(--accent-rgb) / 45%);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-section {
  margin: 0 0 1.25rem;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #f8fafc);
}

.avatar-upload-row {
  align-items: center;
}

.avatar-preview-box {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  font-size: 1.4rem;
}

.note-time {
  display: block;
  opacity: .75;
  margin-top: 4px;
}

.notes-toolbar {
  margin-top: 0;
}

.note-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
}

.note-main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 14px;
  width: 100%;
  text-align: left;
  border-radius: 16px;
  background: var(--surface-tint);
  border: 1px solid transparent;
}

.note-main small { grid-column: 1 / -1; color: var(--muted); }
.note-main .note-status { font-size: .82rem; font-weight: 800; color: var(--muted); }
.note-item.is-unread .note-main {
  border-color: var(--surface-border);
  background: var(--surface-tint);
}
.note-item.is-unread .note-status { color: var(--accent-strong); }
.note-item.is-read .note-main { background: #f8fafc; }
.note-main:hover:not(:disabled) { background: var(--surface-hover); }
.note-item.has-link .note-main { cursor: pointer; }
.note-delete {
  align-self: center;
  min-width: 64px;
  padding: 8px 12px;
}

.session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  flex: 1 1 auto;
}

.nav-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: #eef2f7;
}

.nav-cluster-account {
  background: #f8fafc;
}
.nav-cluster:not(:has(button:not(.hidden))) {
  display: none;
}

.app-nav button {
  min-height: 38px;
  padding: 7px 12px;
  border-radius: 999px;
  border-color: transparent;
  background: transparent;
  color: var(--neutral);
  font-size: .875rem;
  white-space: nowrap;
}

.app-nav button:hover:not(:disabled) {
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.app-nav button.is-active {
  color: var(--nav-active-text);
  background: var(--nav-active-bg);
  box-shadow: inset 0 0 0 1px rgb(var(--accent-rgb) / 18%);
}

.app-nav #logout-button {
  margin-left: 4px;
  color: #fff;
  border-color: transparent;
  background: linear-gradient(180deg, #f87171, #b91c1c);
}

.app-nav #logout-button:hover:not(:disabled) {
  color: #fff;
  background: linear-gradient(180deg, #fb7185, #dc2626);
  box-shadow: 0 8px 18px rgb(220 38 38 / 28%);
}
.app-nav #notes-button #unread-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: #e2e8f0;
  color: var(--ink-soft);
  font-size: .72rem;
}
.app-nav #notes-button.has-unread #unread-count { background: #ff6b6b; color: #fff; }

main {
  width: min(1560px, calc(100% - 28px));
  margin: 22px auto 72px;
}

body:not(.is-authed) main {
  display: grid;
  justify-items: center;
  min-height: calc(100vh - 170px);
  align-content: center;
}

.settings-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}
.settings-menu button {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 700;
}
.settings-menu button.is-active {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.login-announcement {
  width: min(460px, 100%);
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 28px rgb(15 23 42 / 6%);
}
.login-announcement[data-kind="important"] { border-left-color: #b45309; }
.login-announcement[data-kind="maintenance"] { border-left-color: #1d4ed8; }
.login-announcement-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.login-announcement-head p {
  margin: 0;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .04em;
}
.login-announcement-mark {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--accent);
}
.login-announcement[data-kind="important"] .login-announcement-mark { background: #b45309; }
.login-announcement[data-kind="maintenance"] .login-announcement-mark { background: #1d4ed8; }
.login-announcement-body {
  max-height: 9.5rem;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: .95rem;
}
#announce-preview { width: 100%; margin-top: 8px; }

.auth-card {
  position: relative;
  overflow: visible;
  width: min(460px, 100%);
  padding: 32px 28px 28px;
  display: grid;
  gap: 16px;
  box-shadow: 0 18px 50px rgb(15 23 42 / 10%), inset 0 4px 0 var(--accent);
}
.auth-card::before {
  content: none;
}

.auth-card h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.8rem;
}

.auth-links {
  margin: 4px 0 0;
  text-align: center;
}

button.link-button {
  min-height: auto;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  box-shadow: none;
  transform: none;
}

button.link-button:hover:not(:disabled) {
  color: var(--accent);
  border: none;
  box-shadow: none;
  transform: none;
}

.card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm), 0 14px 36px rgb(15 23 42 / 5%);
  overflow: visible;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr minmax(280px, .55fr) auto;
  align-items: end;
  gap: 16px;
}

.month-toolbar { margin-bottom: 8px; }

.month-picker-field {
  display: grid;
  gap: 7px;
  font-weight: 700;
  font-size: .9rem;
}

.month-picker-label { color: var(--ink); }

.month-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.month-picker select {
  min-width: 0;
  flex: 1 1 auto;
  height: 42px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 3px),
    calc(100% - 11px) calc(50% - 3px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.month-picker select#month-year { flex: 1.1 1 5.5rem; }
.month-picker select#month-month { flex: 1 1 4.5rem; }

.month-picker .month-step {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
}

h2, h3 { color: var(--ink); }
h2 { margin: 0 0 6px; font-family: var(--display); font-size: 1.7rem; }
h3 { margin: 0 0 10px; font-size: 1.05rem; }

label { display: grid; gap: 7px; font-weight: 700; font-size: .9rem; }
.muted { color: var(--muted); }

.notice {
  min-height: 0;
  margin: 0 0 16px;
  padding: 0;
  border-radius: 16px;
  white-space: pre-line;
}
.notice:empty { display: none; }
.notice.info, .notice.success, .notice.error {
  padding: 12px 16px;
  border: 1px solid transparent;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgb(8 16 32 / 8%);
}
.notice.info { color: #1c4d9b; background: #eaf1ff; border-color: #cddbff; }
.notice.success { color: var(--accent-strong); background: var(--surface-tint); border-color: var(--surface-border); }
.notice.error { color: #9c1c1c; background: #ffecec; border-color: #ffc9c9; }

body.is-authed .notice.info,
body.is-authed .notice.success,
body.is-authed .notice.error {
  position: relative;
  top: auto;
  z-index: 5;
}

body:not(.is-authed) .notice {
  width: min(460px, 100%);
  margin-top: -8px;
  margin-bottom: 16px;
}

.hidden { display: none !important; }

.section-heading, .card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 8px 0 16px;
}

.section-heading h2 {
  color: var(--ink);
  text-shadow: none;
}
.section-heading .muted {
  color: var(--muted);
}
.section-heading .page-kicker {
  color: var(--accent-strong);
}
.section-heading button.secondary {
  color: var(--ink-soft);
  border-color: var(--neutral-border);
  background: #fff;
}
.section-heading button.secondary:hover:not(:disabled) {
  color: var(--ink);
  background: var(--surface-hover);
  border-color: var(--surface-border);
}
.section-heading button.primary {
  box-shadow: 0 10px 24px rgb(var(--accent-rgb) / 34%);
}
.card .page-kicker { color: var(--accent-strong); }
.card h2, .card h3 { color: var(--ink); }

.page-kicker {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.status-chip {
  padding: 8px 13px;
  border-radius: 999px;
  font-weight: 800;
  background: #eef2f7;
}
.status-chip.draft { color: #8a5a00; background: #fff3bf; }
.status-chip.submitted { color: #1c4d9b; background: #e8f0ff; }
.status-chip.reviewing { color: #0f766e; background: #ccfbf1; }
.status-chip.returned { color: #9c1c1c; background: #ffe3e3; }
.status-chip.accepted { color: #075c43; background: #dff7ec; }
.status-chip.none { color: #5c6778; background: #eef1f5; }
.status-chip.overdue { color: #ad1d1d; background: #ffd6d6; }

.alert-banner {
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 14px;
  color: #9c1c1c;
  border: 1px solid #ffa8a8;
  background: #fff5f5;
  font-weight: 700;
}

.alert-banner.alert-banner-note {
  color: #7a5b00;
  border-color: #f0d48a;
  background: #fff7df;
}

.review-table tr.is-mismatch td {
  background: #fff5f5;
}

.review-table tr.weekend td {
  background: #fff7f7;
}

.review-table tr.holiday td {
  background: #fff8e8;
}

.review-table tr.is-overtime td {
  box-shadow: inset 3px 0 0 #c2410c;
}

.day-flag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  color: #9a3412;
  background: #ffedd5;
}

.confirm-box,
.submit-confirm {
  margin: 4px 0 0;
  padding: 16px 18px;
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--surface-tint), #ffffff);
}

.submit-confirm h4 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.submit-checklist {
  list-style: none;
  margin: 14px 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.submit-checklist li {
  display: grid;
  grid-template-columns: 1.6rem 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: .95rem;
}

.submit-checklist li.is-ok {
  border-color: var(--surface-border);
  background: var(--surface-tint);
}

.submit-checklist li.is-ng {
  border-color: #fecaca;
  background: #fff7f7;
}

.submit-checklist li.is-warn {
  border-color: #f0d48a;
  background: #fff7df;
}

.submit-checklist .check-mark {
  font-weight: 800;
  line-height: 1.3;
}

.submit-checklist .check-label {
  font-weight: 700;
}

.submit-checklist .check-detail {
  grid-column: 2 / -1;
  color: #64748b;
  font-size: .88rem;
  font-weight: 500;
}

.submit-checklist .check-state {
  font-size: .82rem;
  font-weight: 800;
  white-space: nowrap;
}

.submit-confirm-alert {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #f0d48a;
  background: #fff7df;
  color: #7a5b00;
  font-weight: 700;
}

#submit-hints.submit-hints-warn {
  color: #9a3412;
  font-weight: 700;
}

#submit-hints.submit-hints-note {
  color: #7a5b00;
  font-weight: 700;
}

.invoice-preview {
  width: 100%;
  min-height: 420px;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}
#finance-invoice-preview { min-height: 560px; }

.invoice-status {
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
}

.invoice-status.is-empty {
  color: #7a5b00;
  background: #fff7df;
  border-color: #f0d48a;
}

.invoice-status.is-registered {
  color: #0b6b52;
  background: #e7fbf4;
  border-color: #b7f0dc;
}

.invoice-feedback {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #b7f0dc;
  color: #0b6b52;
  background: #e7fbf4;
  font-weight: 600;
}

.invoice-feedback.hidden { display: none; }

.invoice-versions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.invoice-version-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f4f7fb;
}

.invoice-version-item button[data-version] {
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 2px;
}

.invoice-version-item button[data-delete-version] {
  border: 0;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  padding: 0;
  background: #ffe8e8;
  color: #9c1c1c;
  font-weight: 700;
  cursor: pointer;
}

.invoice-version-item button[data-delete-version]:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.seal-preview {
  max-width: 180px;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.report-item.overdue { border-color: #ffa8a8; background: #fff5f5; }
.save-dirty { color: #9c6b00; font-weight: 800; }
.save-error { color: #9c1c1c; font-weight: 800; }
.save-ok { color: #075c43; }

.metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.metrics article {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff, #f7faf8);
}

.metrics article::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent-soft), var(--accent-strong));
}

.metrics span { display: block; color: var(--muted); font-size: var(--text-sm); font-weight: 700; }
.metrics strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.4rem;
}

.table-scroll {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

.backup-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.backup-step { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.backup-step h4 { margin: 0 0 8px; }
.backup-step .check-line {
  display: flex;
  gap: 8px;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin-top: 12px;
}
.backup-step .check-line input[type="checkbox"] {
  width: 18px;
  min-width: 18px;
  max-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  padding: 0;
  flex: 0 0 18px;
}

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid #e8edf4; text-align: left; vertical-align: middle; }
thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #475569;
  background: #f4f7fb;
  font-size: var(--text-sm);
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
  box-shadow: 0 1px 0 #e8edf4;
}
td { font-size: var(--text-md); }
tbody tr:nth-child(even) td { background: #fafbfd; }
tbody tr:hover td { background: var(--surface-hover); }

.work-table {
  min-width: 1120px;
  width: max(100%, 1120px);
}

.work-table input[type="time"] {
  width: 104px;
  min-width: 104px;
}

.work-table input[type="number"] {
  width: 68px;
  min-width: 68px;
}

.work-table input[type="text"] {
  min-width: 160px;
  width: 100%;
}

.work-table .weekend { background: #fff7f7; }
.work-table .weekend td { background: #fff7f7; }
.work-table .holiday { background: #fff8e8; }
.work-table .holiday td { background: #fff8e8; }
.work-table tbody tr.weekend:hover td { background: #ffecec; }
.work-table tbody tr.holiday:hover td { background: #fff3d6; }
.invalid { color: #c92a2a; font-weight: 800; }

.work-table th:last-child,
.work-table td.row-actions {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 84px;
  width: 84px;
  background: #fff;
  box-shadow: -10px 0 14px rgb(8 16 32 / 7%);
}

.work-table thead th:last-child {
  z-index: 3;
  background: #f4f7fb;
}

.work-table tr.weekend td.row-actions,
.work-table tr.weekend th:last-child { background: #fff7f7; }

.work-table tr.holiday td.row-actions,
.work-table tr.holiday th:last-child { background: #fff8e8; }

.work-table tbody tr:nth-child(even) td.row-actions { background: #fafbfd; }
.work-table tbody tr:hover td.row-actions { background: var(--surface-hover); }
.work-table tbody tr.weekend:hover td.row-actions { background: #ffecec; }
.work-table tbody tr.holiday:hover td.row-actions { background: #fff3d6; }

.row-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.row-actions button {
  min-height: 30px;
  padding: 3px 8px;
  font-size: .78rem;
  white-space: nowrap;
}

.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.history-list button.month-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: .84rem;
  font-weight: 700;
  box-shadow: none;
  transform: none;
}

.history-list button.month-status:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgb(24 39 75 / 10%);
}

.history-list button.month-status .month-status-ym {
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}

.history-list button.month-status .month-status-label {
  font-weight: 800;
}

.history-list button.month-status.is-selected {
  outline: 2px solid var(--positive-strong);
  outline-offset: 1px;
}

.history-list button.month-status.none {
  color: #5c6778;
  background: #eef1f5;
  border-color: #d7dde7;
}

.history-list button.month-status.draft {
  color: #8a5a00;
  background: #fff3bf;
  border-color: #ffe066;
}

.history-list button.month-status.overdue {
  color: #ad1d1d;
  background: #ffd6d6;
  border-color: #ffa8a8;
}

.history-list button.month-status.submitted {
  color: #1c4d9b;
  background: #e8f0ff;
  border-color: #a5c0f5;
}

.history-list button.month-status.reviewing {
  color: #0f766e;
  background: #ccfbf1;
  border-color: #5eead4;
}

.history-list button.month-status.returned {
  color: #9c1c1c;
  background: #ffe3e3;
  border-color: #ffa8a8;
}

.history-list button.month-status.accepted {
  color: #075c43;
  background: #dff7ec;
  border-color: #8ce0c0;
}

.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.button-row, .filter-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; align-items: flex-end; }
.filter-row > label { flex: 1 1 180px; min-width: 0; }
.filter-row > button,
.button-row > button { flex: 0 0 auto; }
.form-actions-row > button.primary { align-self: flex-end; min-width: 7.5rem; }
.profile-fields .filter-row:first-child { margin-top: 0; }
.card > .filter-row:first-child { margin-top: 0; }

.submit-card {
  background:
    radial-gradient(400px 160px at 100% 0%, rgb(var(--accent-rgb) / 16%), transparent 60%),
    linear-gradient(180deg, #fff, var(--surface-tint));
}

.manager-layout { grid-template-columns: minmax(280px, .72fr) minmax(0, 1.28fr); }

.manager-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
}

.count-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2f7;
  font-size: .82rem;
}

.count-chip em { font-style: normal; color: var(--muted); font-weight: 700; }
.count-chip strong { font-size: 1rem; }
.count-chip.draft { background: #fff3bf; color: #8a5a00; }
.count-chip.submitted { background: #e8f0ff; color: #1c4d9b; }
.count-chip.reviewing { background: #ccfbf1; color: #0f766e; }
.count-chip.returned { background: #ffe3e3; color: #9c1c1c; }
.count-chip.accepted { background: #dff7ec; color: #075c43; }

.finance-result {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--surface-border);
  border-radius: 16px;
  background: var(--surface-tint);
}
.finance-result.is-selected {
  border-color: var(--accent-soft);
  background: var(--surface-tint-strong);
  box-shadow: 0 0 0 1px rgb(var(--accent-rgb) / 25%);
}
.finance-result-main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 14px;
  width: 100%;
  padding: 0;
  text-align: left;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.finance-result-main small,
.finance-invoice-name { grid-column: 1 / -1; }
.finance-invoice-name {
  font-size: .82rem;
  font-weight: 700;
}
.finance-invoice-name.is-ready { color: var(--accent-strong); }
.finance-invoice-name.is-empty { color: var(--muted); font-weight: 500; }
.finance-invoice-meta-line {
  grid-column: 1 / -1;
  font-size: .8rem;
  color: var(--muted);
  font-weight: 600;
}
.finance-result-actions,
.finance-invoice-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.finance-result-actions .primary,
.finance-invoice-toolbar .primary { min-width: 9.5rem; }

.report-list { display: grid; gap: 8px; margin-top: 16px; }
.report-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 14px;
  width: 100%;
  text-align: left;
  border-radius: 16px;
  background: var(--surface-tint);
  border: 1px solid transparent;
}
.report-item small { grid-column: 1 / -1; color: var(--muted); }
.report-item:hover:not(:disabled) { background: var(--surface-hover); }
.report-item.is-selected {
  border-color: var(--accent-soft);
  background: var(--surface-tint-strong);
  box-shadow: 0 0 0 1px rgb(var(--accent-rgb) / 25%);
}
.report-item.has-link {
  cursor: pointer;
  border-color: var(--surface-border);
}
.report-item.has-link:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--accent-soft);
}
.report-item .note-open-hint {
  grid-column: 1 / -1;
  margin: 0;
  font-style: normal;
  font-size: .78rem;
  font-weight: 700;
  color: var(--positive-strong);
}

.review-card {
  background:
    radial-gradient(420px 180px at 100% 0%, rgb(14 165 233 / 10%), transparent 55%),
    linear-gradient(180deg, #fff, #f8fafc);
}

.review-empty {
  padding: 28px 8px 18px;
  text-align: center;
}
.review-empty-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 800;
}

.review-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.review-header h3 { margin: 0; font-size: 1.25rem; }
.review-header-main { min-width: 0; }

.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.detail-grid div { padding: 12px; border-radius: 14px; background: #f5f7fb; }
.detail-grid dt { color: var(--muted); font-size: .78rem; }
.detail-grid dd { margin: 5px 0 0; font-weight: 800; }

.review-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 12px;
  padding: 4px;
  border-radius: 14px;
  background: #eef2f7;
}
.review-tab {
  border: 0;
  background: transparent;
  color: #475569;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: 10px;
  font-weight: 700;
  box-shadow: none;
}
.review-tab:hover:not(:disabled) {
  background: rgb(255 255 255 / 70%);
  box-shadow: none;
}
.review-tab.is-active {
  background: #fff;
  color: var(--nav-active-text);
  box-shadow: 0 1px 2px rgb(15 23 42 / 8%);
}

.review-pane { margin-top: 4px; }

.review-invoice-meta { margin-bottom: 10px; }
.invoice-meta-card {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}
.invoice-meta-card.is-registered { border-color: #bbf7d0; background: #f7fef9; }
.invoice-meta-card.is-empty { border-color: #f0d48a; background: #fff7df; color: #7a5b00; font-weight: 700; }
.invoice-meta-card strong { font-size: 1rem; }

.review-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.timeline-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}
.timeline-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: .78rem;
  font-weight: 800;
  white-space: nowrap;
}
.timeline-item.action-submit .timeline-badge { background: #e8f0ff; color: #1c4d9b; }
.timeline-item.action-withdraw .timeline-badge { background: #ffedd5; color: #9a3412; }
.timeline-item.action-review .timeline-badge { background: #ccfbf1; color: #0f766e; }
.timeline-item.action-return .timeline-badge { background: #ffe3e3; color: #9c1c1c; }
.timeline-item.action-accept .timeline-badge { background: #dff7ec; color: #075c43; }
.timeline-item.action-unaccept .timeline-badge { background: #ffe3e3; color: #9c1c1c; }
.timeline-body strong { display: block; margin-bottom: 4px; }
.timeline-body p { margin: 0; line-height: 1.5; }

.review-decision {
  margin-top: 20px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid #cbd5e1;
  background: linear-gradient(180deg, #f8fafc, #fff);
}
.review-decision-head h4 { margin: 0 0 4px; }
.review-decision-head .muted { margin: 0 0 12px; }
.review-comment-block {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}
.review-comment-block.is-required {
  padding: 12px;
  border-radius: 14px;
  border: 1px dashed #94a3b8;
  background: #fff;
}
.review-actions-primary {
  margin-top: 0;
}
.review-actions-primary .primary {
  min-width: 140px;
}
.review-actions-secondary {
  margin-top: 10px;
}
.accepted-pdf-actions {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.review-table { min-width: 700px; margin: 0; }

.help-content { display: grid; gap: 16px; margin-top: 8px; }
.help-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--surface-tint), var(--surface-tint-strong));
  font-size: .82rem;
  font-weight: 800;
}
.help-role-badge.super { color: #be185d; background: linear-gradient(135deg, #fdf2f8, #fce7f3); }
.help-role-badge.admin { color: #047857; background: linear-gradient(135deg, #ecfdf5, #d1fae5); }
.help-role-badge.user { color: #a16207; background: linear-gradient(135deg, #fefce8, #fef9c3); }
.help-role-badge.finance { color: #6d28d9; background: linear-gradient(135deg, #f5f3ff, #ede9fe); }

.help-hero {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(135deg, #f8fafc 0%, var(--surface-tint) 100%);
}
.help-hero h3 { margin: 0 0 8px; font-size: 1.15rem; }
.help-hero p { margin: 0; line-height: 1.7; }

.help-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  margin: 14px 0 4px;
}
.help-flow-step {
  flex: 1 1 120px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: center;
  font-size: .88rem;
  line-height: 1.5;
}
.help-flow-step strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1.1rem;
}
.help-flow-arrow {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 1.2rem;
  font-weight: 800;
}

.help-section {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}
.help-section h4 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: var(--ink-soft);
}
.help-section ul, .help-section ol {
  margin: 0;
  padding-left: 1.2em;
  line-height: 1.75;
}
.help-section li + li { margin-top: 6px; }
.help-section p { margin: 0 0 8px; line-height: 1.7; }
.help-section p:last-child { margin-bottom: 0; }

.help-faq { display: grid; gap: 8px; }
.help-faq details {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--neutral-fill);
  padding: 10px 14px;
}
.secret-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.secret-row input { flex: 1; min-width: 0; }
.secret-row button { flex: 0 0 auto; }

.help-faq summary {
  cursor: pointer;
  font-weight: 800;
  line-height: 1.45;
}
.help-faq summary:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
}
.help-faq p { margin: 8px 0 0; color: var(--ink-soft); line-height: 1.65; }

.help-tip {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border-left: 4px solid var(--accent);
  background: var(--surface-tint);
  font-size: .9rem;
  line-height: 1.6;
}
.help-tip.warn {
  border-left-color: var(--negative);
  background: #fff5f5;
}
.help-tip.ok {
  border-left-color: var(--accent);
  background: var(--surface-tint-strong);
}

.help-menu-map {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.help-menu-chip {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: .85rem;
  font-weight: 700;
  text-align: center;
}
.help-menu-chip small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 500;
  font-size: .75rem;
}

.help-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.help-footer h3 { margin: 0 0 8px; font-size: 1rem; }
.help-contact { margin-top: 10px; font-weight: 700; }

@media (max-width: 520px) {
  .help-flow-arrow { display: none; }
  .help-flow-step { flex: 1 1 100%; }
}

.split-form { display: grid; gap: 14px; }

footer {
  padding: 8px 24px 28px;
  color: var(--muted);
  text-align: center;
  font-size: .85rem;
}

.account-kind {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .02em;
  vertical-align: middle;
}
.account-kind.super { color: #5b21b6; background: #ede9fe; }
.account-kind.admin { color: #1e40af; background: #dbeafe; }
.account-kind.user { color: #0f766e; background: #ccfbf1; }
.account-kind.finance { color: #9a3412; background: #ffedd5; }

body.is-busy { cursor: progress; }
.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(8 16 32 / 58%);
  backdrop-filter: blur(10px);
}
.busy-card {
  width: min(420px, 100%);
  padding: 22px 22px 18px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 24px 60px rgb(8 16 32 / 28%);
}
.busy-title {
  margin: 0 0 6px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 800;
}
.busy-status {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.55;
}
.busy-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-tint-strong);
}
.busy-bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent-strong));
  transition: width .2s ease;
}
.busy-bar.is-indeterminate .busy-bar-fill {
  width: 38%;
  animation: busy-slide 1.15s ease-in-out infinite;
}
.busy-percent {
  margin: 10px 0 0;
  color: var(--accent-strong);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-align: right;
}
@keyframes busy-slide {
  0% { transform: translateX(-130%); }
  100% { transform: translateX(280%); }
}
.preview-box { margin-top: 12px; }
.preview-status {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  background: var(--surface-tint);
  color: var(--accent-strong);
  font-size: .88rem;
  font-weight: 700;
}
.preview-status .busy-bar { margin-top: 8px; }

@media (max-width: 900px) {
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar > div { grid-column: 1 / -1; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .two-column, .manager-layout { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .work-table { min-width: 980px; width: max(100%, 980px); }
  .work-table input[type="time"] { width: 96px; min-width: 96px; }
  .work-table input[type="text"] { min-width: 140px; }
}

@media (max-width: 520px) {
  .app-header { align-items: flex-start; flex-direction: column; width: calc(100% - 16px); }
  .phase-badge { align-self: flex-start; }
  main, .app-nav, .app-header { width: calc(100% - 16px); }
  .toolbar { grid-template-columns: 1fr; }
  .toolbar > * { grid-column: auto; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics article:last-child { grid-column: 1 / -1; }
  .card { padding: 14px; }
  .section-heading, .card-heading { align-items: stretch; flex-direction: column; }
  .nav-cluster { border-radius: 16px; }
  .work-table th:last-child,
  .work-table td.row-actions {
    min-width: 76px;
    width: 76px;
  }
}

#manager-progress,
#assigned-list {
  margin: 0 0 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  color: var(--ink-soft);
  font-weight: 650;
  line-height: 1.55;
}
#assigned-list { margin-bottom: 16px; }

.review-empty {
  padding: 48px 16px 32px;
}
.review-empty::before {
  content: "";
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 18px;
  background:
    linear-gradient(145deg, var(--surface-tint), var(--surface-tint-strong));
  box-shadow: inset 0 0 0 1px var(--surface-border);
}
.review-empty-title { color: var(--ink); }

.review-table td button,
.data-table td button {
  min-height: 34px;
  padding: 4px 10px;
  font-size: .8rem;
}

.auth-card {
  box-shadow: 0 18px 50px rgb(15 23 42 / 10%), inset 0 4px 0 var(--accent);
}
.auth-card .page-kicker { letter-spacing: .2em; }

.card {
  transition: box-shadow .2s ease, border-color .2s ease;
}

.metrics article {
  box-shadow: 0 8px 22px rgb(8 16 32 / 5%);
}

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

/* --- UI polish 1.0.8 --- */
body.is-authed .app-header {
  padding: 12px 18px;
  margin-top: 10px;
}
body.is-authed .app-header h1 { font-size: clamp(1.25rem, 2.4vw, 1.7rem); }
body.is-authed .brand-mark { width: 44px; height: 44px; border-radius: 14px; font-size: .95rem; }

.auth-card .split-form > button.primary { width: 100%; min-height: 46px; }
.auth-card .muted { line-height: 1.6; }

.file-field {
  flex: 1 1 220px;
  min-width: 0;
}
.file-field input[type="file"] {
  min-height: 88px;
  padding: 18px 14px;
  border-radius: 16px;
  border: 1.5px dashed var(--surface-border);
  background:
    linear-gradient(180deg, var(--surface-tint), #fff);
  color: var(--muted);
  font-weight: 700;
}
.file-field input[type="file"]:hover {
  border-color: rgb(var(--accent-rgb) / 45%);
  background: var(--surface-tint-strong);
  color: var(--ink-soft);
}
.file-field-compact { flex: 1 1 180px; }
.file-field-compact input[type="file"] { min-height: 52px; padding: 10px 12px; }

.surface-block {
  margin-top: 16px;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, #fff, #f8fafc);
}
.surface-block:first-child { margin-top: 8px; }
.surface-block h3 { margin-bottom: 6px; }

.stack-field {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}
.stack-field > button { justify-self: start; }

.empty-state {
  margin: 8px 0 0;
  padding: 28px 16px;
  text-align: center;
  border: 1px dashed #d7deea;
  border-radius: 16px;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 650;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.table-actions button {
  min-height: 34px;
  padding: 4px 10px;
  font-size: .8rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  background: #eef2f7;
  color: #475569;
}
.status-pills { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.status-pill.active { color: #075c43; background: #dff7ec; }
.status-pill.disabled,
.status-pill.inactive { color: #9a3412; background: #ffedd5; }
.status-pill.pending { color: #92400e; background: #fef3c7; }
.status-pill.locked { color: #1e3a8a; background: #dbeafe; }
button.deactivate {
  color: #9a3412;
  border-color: #fdba74;
  background: #ffedd5;
  box-shadow: none;
}
button.activate {
  color: #fff;
  border-color: transparent;
  background: #0f766e;
}
button.purge {
  color: #fff;
  border-color: transparent;
  background: #b91c1c;
}
.table-actions .action-break { flex-basis: 100%; height: 0; }
dialog.user-dialog {
  width: min(36rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border: 0;
  border-radius: 16px;
  padding: 1.25rem 1.25rem 1rem;
}
dialog.user-dialog::backdrop { background: rgb(15 23 42 / 45%); }
.user-dialog-final { display: grid; gap: 10px; margin-top: 12px; }
.user-dialog .purge-groups { display: grid; gap: 10px; margin-top: 12px; }
.user-dialog .purge-groups h4 { margin: 0 0 4px; font-size: .92rem; }
.user-dialog .purge-groups ul { margin: 0; padding-left: 1.1rem; }

.mono-id {
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
}
.cell-email { word-break: break-all; }

#contractor-panel .table-scroll {
  max-height: min(70vh, 740px);
  overflow-y: auto;
}
.work-table input,
.work-table select {
  min-height: 38px;
  padding: 6px 8px;
}

.manager-info-strip {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 10px;
  margin: 0 0 16px;
}
#manager-progress,
#assigned-list {
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink-soft);
  font-weight: 650;
  line-height: 1.55;
}

.section-heading { margin-top: 0; }
.section-heading .status-chip { box-shadow: 0 8px 20px rgb(0 0 0 / 18%); }

.note-item.is-unread .note-main {
  box-shadow: inset 4px 0 0 var(--accent);
}
.finance-result:hover {
  border-color: var(--accent-soft);
}
.finance-result-main:hover:not(:disabled) {
  transform: none;
  box-shadow: none;
  background: transparent;
}

.month-picker {
  padding: 4px;
  border-radius: 16px;
  background: var(--surface-tint);
  border: 1px solid var(--surface-border);
}
.month-picker select {
  background: #fff;
}
.month-toolbar > button.primary {
  min-width: 9.5rem;
  min-height: 46px;
}

.metrics article {
  background: linear-gradient(180deg, #fff, var(--surface-tint));
}

.profile-fields { display: grid; gap: 4px; }
#users-edit {
  border-color: var(--surface-border);
  background: linear-gradient(180deg, var(--surface-tint), #fff);
  box-shadow: 0 0 0 1px rgb(var(--accent-rgb) / 12%), 0 16px 40px rgb(8 16 32 / 8%);
}
#save-hint {
  min-height: 1.3em;
  margin: 8px 0 10px;
  font-weight: 700;
}

select {
  appearance: none;
  background-color: #fbfcff;
  background-image:
    linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 3px),
    calc(100% - 11px) calc(50% - 3px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

.help-hero {
  border-color: var(--surface-border);
}

.invoice-meta-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px 14px;
}
.invoice-meta-card strong { grid-column: 1 / -1; }

@media (max-width: 900px) {
  .manager-info-strip { grid-template-columns: 1fr; }
  .profile-fields .filter-row { display: flex; }
}
.nav-toggle,
.work-card-tools,
.split-back,
.preview-mobile-hint {
  display: none;
}

.work-day-toggle {
  display: inline;
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  box-shadow: none;
  transform: none;
  cursor: default;
}
.work-day-toggle:hover:not(:disabled) {
  transform: none;
  box-shadow: none;
  background: transparent;
  border: 0;
}
.work-day-actual { display: none; }

@media (max-width: 520px) {
  .file-field input[type="file"] { min-height: 64px; }
  .month-toolbar > button.primary { width: 100%; }
}

@media (max-width: 768px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    min-width: 44px;
    padding: 8px 14px;
  }
  .nav-toggle-unread {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: rgb(255 255 255 / 16%);
    color: #fff;
    font-size: .72rem;
    font-weight: 800;
  }
  .nav-toggle-unread:not(.hidden) { background: #ff6b6b; }

  .app-nav,
  body.is-authed .app-nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    position: sticky;
    top: env(safe-area-inset-top, 0);
    z-index: 120;
    width: calc(100% - 16px);
    margin-top: 8px;
  }
  .whoami { flex: 1 1 auto; }
  .session-actions {
    display: none;
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
  }
  .app-nav.is-nav-open .session-actions { display: flex; }
  .nav-cluster {
    width: 100%;
    flex-direction: column;
    border-radius: 16px;
  }
  .app-nav button {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }
  .app-nav #logout-button { width: 100%; margin-left: 0; }

  .work-card-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 10px;
  }
  .work-card-tools button { min-height: 44px; }

  .split-back {
    display: inline-flex;
    min-height: 44px;
    margin: 0 0 10px;
  }

  .preview-mobile-hint {
    display: block;
    margin: 8px 0 0;
    color: var(--muted);
    font-size: .88rem;
    line-height: 1.55;
  }

  input, select, textarea, button {
    min-height: 44px;
    font-size: 16px;
  }
  .row-actions button,
  .review-tab,
  .month-status {
    min-height: 44px;
  }

  #contractor-panel .card-heading {
    position: sticky;
    top: calc(env(safe-area-inset-top, 0px) + 58px);
    z-index: 6;
    padding-bottom: 8px;
    background: var(--card);
  }

  #contractor-panel .table-scroll {
    max-height: none;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .work-table {
    min-width: 0 !important;
    width: 100% !important;
  }
  .work-table thead { display: none; }
  .work-table,
  .work-table tbody,
  .work-table tr,
  .work-table th,
  .work-table td {
    display: block;
    width: 100%;
  }
  .work-table tr {
    margin: 0 0 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
  }
  .work-table tr.weekend { background: #fff7f7; }
  .work-table tr.holiday { background: #fff8e8; }
  .work-table th,
  .work-table td,
  .work-table tbody tr:nth-child(even) td,
  .work-table tbody tr:hover td,
  .work-table tbody tr.weekend:hover td,
  .work-table tbody tr.holiday:hover td {
    border: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }
  .work-table th.work-day-head,
  .work-table thead th:last-child,
  .work-table th:last-child,
  .work-table td.row-actions {
    position: static;
    width: 100%;
    min-width: 0;
    box-shadow: none;
  }
  .work-day-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
  }
  .work-day-toggle {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 4px;
    cursor: pointer;
    text-align: left;
  }
  .work-day-actual {
    display: inline-block;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
  }
  .work-table td[data-label] {
    display: grid;
    grid-template-columns: 5.5rem minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    margin-top: 8px;
  }
  .work-table td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .78rem;
    font-weight: 800;
  }
  .work-table td.row-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
  }
  .work-table td.row-actions::before { content: none; }
  .work-table input[type="time"],
  .work-table input[type="number"],
  .work-table input[type="text"] {
    width: 100%;
    min-width: 0;
  }
  .work-table tr.is-collapsed td { display: none; }
  .work-table tr.is-collapsed .work-day-head { margin-bottom: 0; }

  .review-table { min-width: 0; width: 100%; }
  .review-table thead { display: none; }
  .review-table,
  .review-table tbody,
  .review-table tr,
  .review-table td {
    display: block;
    width: 100%;
  }
  .review-table tr {
    margin: 0 0 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
  }
  .review-table td {
    border: 0;
    padding: 4px 0;
  }
  .review-table td[data-label]::before {
    content: attr(data-label) "：";
    color: var(--muted);
    font-size: .78rem;
    font-weight: 800;
    margin-right: 6px;
  }

  #manager-panel:not(.is-showing-detail) #review-card,
  #finance-panel:not(.is-showing-detail) #finance-review-card {
    display: none;
  }
  #manager-panel.is-showing-detail .manager-list-card,
  #finance-panel.is-showing-detail .finance-list-card,
  body:has(#manager-panel.is-showing-detail) #start-panel {
    display: none;
  }

  .detail-grid { grid-template-columns: 1fr; }
  .two-column { grid-template-columns: 1fr; }
  .invoice-preview,
  #finance-invoice-preview {
    min-height: 240px;
  }
  .metrics { grid-template-columns: 1fr 1fr; }
}

.dash-state {
  margin: 0 0 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
}

.dash-state p { margin: 0 0 12px; }

.dash-loading {
  color: var(--muted);
  font-weight: 700;
}

.dash-summary {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) minmax(280px, 1fr);
  gap: 16px;
  margin-bottom: 18px;
  align-items: stretch;
}

.dash-hero,
.dash-stat {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 40px rgb(8 16 32 / 8%);
}

.dash-hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 220px;
  padding: 28px 28px 24px;
  background: linear-gradient(165deg, #fff 20%, var(--surface-tint));
  border-color: var(--surface-border);
}

.dash-hero::before,
.dash-stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
}

.dash-hero::before {
  background: linear-gradient(180deg, var(--accent-soft), var(--accent-strong));
}

.dash-hero-label,
.dash-stat > span {
  color: var(--muted);
  font-size: .84rem;
  font-weight: 700;
}

.dash-hero-value {
  margin: 8px 0 10px;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(2.5rem, 5vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.dash-hero-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: .92rem;
}

.dash-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dash-stat {
  min-height: 104px;
  padding: 16px 16px 14px 20px;
}

.dash-stat.is-filled::before { background: #059669; }
.dash-stat.is-rate { grid-column: 1 / -1; }
.dash-stat.is-rate::before { background: #0369a1; }
.dash-stat.is-alert {
  background: #fff7ed;
  border-color: #fdba74;
}
.dash-stat.is-alert::before { background: #ea580c; }
.dash-stat.is-alert strong { color: #9a3412; }

.dash-stat strong,
.dash-hero-value { display: block; }

.dash-stat strong {
  margin-top: 8px;
  color: var(--ink);
  font-size: 1.85rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.dash-flag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #ffedd5;
  color: #9a3412;
  font-style: normal;
  font-size: .72rem;
  font-weight: 800;
  vertical-align: 1px;
}

.dash-rate {
  height: 10px;
  margin-top: 12px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.dash-rate > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: #0284c7;
  transition: width .35s ease;
}

.dash-rate.is-alert > span { background: #ea580c; }
.dash-rate.is-complete > span { background: #059669; }

.dash-calendar-card { margin-top: 4px; }

.dash-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  color: var(--ink-soft);
  font-size: .82rem;
  font-weight: 700;
}

.dash-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dash-legend li::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #94a3b8;
}

.dash-legend .is-worked::before { background: #059669; }
.dash-legend .is-missing::before { background: #ea580c; }
.dash-legend .is-explicit::before { background: #64748b; }
.dash-legend .is-today::before { background: #2563eb; }
.dash-legend .is-future::before { background: #cbd5e1; }
.dash-legend .is-off::before { background: #94a3b8; }

.dash-cal-head,
.dash-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.dash-cal-head { margin-bottom: 8px; }

.dash-cal-dow {
  padding: 4px 0 8px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  text-align: center;
}

.dash-cal-dow.is-sun { color: #b91c1c; }
.dash-cal-dow.is-sat { color: #1d4ed8; }

button.dash-day {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 108px;
  padding: 10px 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: 0;
  text-align: left;
  box-shadow: none;
}

button.dash-day:hover:not(:disabled) {
  transform: none;
  border-color: rgb(var(--accent-rgb) / 55%);
  box-shadow: 0 8px 18px rgb(15 23 42 / 8%);
}

button.dash-day.is-today:hover:not(:disabled) {
  box-shadow: inset 0 0 0 2px #2563eb, 0 8px 18px rgb(15 23 42 / 8%);
}

.dash-day-num {
  font-size: 1.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.dash-day-dow {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
}

.dash-day.is-sun .dash-day-dow { color: #b91c1c; }
.dash-day.is-sat .dash-day-dow { color: #1d4ed8; }

.dash-day-time {
  color: var(--ink);
  font-size: .95rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.dash-day-state {
  margin-top: auto;
  font-size: .78rem;
  font-weight: 800;
}

button.dash-day.is-worked {
  background: #f0fdf4;
  border-color: #86efac;
}
button.dash-day.is-worked .dash-day-time,
button.dash-day.is-worked .dash-day-state { color: #047857; }

button.dash-day.is-missing {
  background: #fff7ed;
  border-color: #fdba74;
}
button.dash-day.is-missing .dash-day-state { color: #c2410c; }

button.dash-day.is-explicit_off {
  background: #f8fafc;
  border-color: #cbd5e1;
}
button.dash-day.is-explicit_off .dash-day-state { color: #334155; }

button.dash-day.is-today {
  background: #eff6ff;
  border-color: #2563eb;
  box-shadow: inset 0 0 0 2px #2563eb;
}
button.dash-day.is-today .dash-day-state { color: #1d4ed8; }

button.dash-day.is-future {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #475569;
}
button.dash-day.is-future .dash-day-num,
button.dash-day.is-future .dash-day-state { color: #475569; }

button.dash-day.is-off {
  background: #f1f5f9;
  border-color: #e2e8f0;
}
button.dash-day.is-off .dash-day-state { color: #475569; }

.dash-day-pad { min-height: 1px; }

.work-table tr.is-dash-target th,
.work-table tr.is-dash-target td {
  box-shadow: inset 0 0 0 2px var(--accent-strong);
}

.dash-dialog {
  width: min(520px, calc(100% - 24px));
  max-height: min(90vh, 760px);
  padding: 0;
  border: none;
  border-radius: 20px;
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: auto;
}

.dash-dialog::backdrop { background: rgb(15 23 42 / 48%); }

.dash-dialog form { padding: 22px; }

.dash-dialog .page-kicker { color: var(--accent-strong); }

.dash-dialog h3 { margin: 0 0 6px; }

.dash-dialog .detail-grid { margin-top: 14px; }

.dash-dialog .dash-detail-wide { grid-column: 1 / -1; }

#dashboard-panel .section-heading .button-row {
  margin-top: 0;
  align-items: center;
}

@media (max-width: 800px) {
  .dash-summary { grid-template-columns: 1fr; }
  .dash-hero { min-height: 0; }
}

@media (max-width: 640px) {
  #dashboard-panel .section-heading {
    flex-direction: column;
    align-items: stretch;
  }
  #dashboard-panel .section-heading .button-row button { flex: 1 1 auto; }

  .dash-cal-head { display: none; }
  .dash-cal-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .dash-day-pad { display: none; }
  button.dash-day {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    grid-template-areas: "num dow time state";
    align-items: center;
    gap: 6px 12px;
    min-height: 0;
    padding: 12px 14px;
  }
  .dash-day-num { grid-area: num; }
  .dash-day-dow { grid-area: dow; }
  .dash-day-time { grid-area: time; }
  .dash-day-state { grid-area: state; margin-top: 0; justify-self: end; }
}

@media (prefers-reduced-motion: reduce) {
  .dash-rate > span { transition: none; }
}

html[data-boot-locale="en"]:not([data-i18n-ready]) body {
  visibility: hidden;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.locale-switch {
  position: relative;
}

.locale-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--shell-line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
  cursor: pointer;
}

.locale-toggle:disabled {
  opacity: .6;
  cursor: progress;
}

.locale-menu {
  position: absolute;
  z-index: 120;
  top: calc(100% + 6px);
  right: 0;
  min-width: 148px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid rgb(15 23 42 / 12%);
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
  box-shadow: 0 12px 32px rgb(15 23 42 / 16%);
}

.locale-menu button {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.locale-menu button[aria-selected="true"] {
  font-weight: 800;
  background: rgb(15 23 42 / 6%);
}

.locale-menu button:focus-visible,
.locale-toggle:focus-visible {
  outline: 2px solid rgb(37 99 235);
  outline-offset: 2px;
}

#roles-nav-button { white-space: nowrap; }

.roles-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  margin: 4px 0 12px;
}
.roles-search { flex: 1 1 220px; min-width: 0; }
.roles-search input { width: 100%; }
.roles-filters, .roles-zoom {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.roles-filters label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: .86rem;
  font-weight: 700;
}
.roles-zoom-level {
  min-width: 3.2em;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
}
.roles-notice {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-tint);
  color: var(--ink-soft);
}
.roles-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 14px;
  align-items: stretch;
}
.roles-canvas {
  min-height: 640px;
  height: 70vh;
  border-radius: 20px;
  border: 1px solid var(--line);
  background-color: #f8fafc;
  background-image: radial-gradient(rgb(15 23 42 / 12%) 1px, transparent 1px);
  background-size: 18px 18px;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
.roles-canvas:active { cursor: grabbing; }
.roles-canvas:focus-visible { outline: 3px solid rgb(var(--accent-rgb) / 45%); outline-offset: 2px; }
.roles-canvas svg { width: 100%; height: 100%; display: block; }
.roles-detail {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
  padding: 16px;
  min-height: 280px;
}
.roles-detail h3 { margin: 0 0 12px; }
.roles-detail h4 { margin: 14px 0 0; font-size: .95rem; }
.roles-detail-kicker { display: flex; align-items: center; gap: 6px; }
.roles-detail-name { margin: 8px 0 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.roles-detail-role { margin: 2px 0 12px; color: var(--muted); }
.roles-field { margin: 0 0 8px; }
.roles-field span { display: block; color: var(--muted); font-size: .78rem; font-weight: 700; }
.roles-field strong { font-weight: 750; overflow-wrap: anywhere; }
.roles-detail-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.roles-detail-list li {
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--neutral-fill);
  border: 1px solid var(--line);
}
.roles-detail-kicker { margin: 0; font-weight: 800; }
.roles-detail-sentence { margin: 4px 0 0; }
.roles-focus {
  min-height: 32px;
  margin-top: 6px;
  padding: 4px 8px;
  font-size: .82rem;
}
.roles-primary {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #ede9fe;
  color: #5b21b6;
  font-size: .75rem;
  font-weight: 800;
}
.roles-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.roles-legend li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .86rem;
  font-weight: 700;
}
.roles-swatch {
  width: 28px;
  height: 0;
  border-top-width: 3px;
  border-top-style: solid;
}
.roles-swatch.is-manage { border-top-color: #1d4ed8; }
.roles-swatch.is-report { border-top-color: #047857; border-top-style: dashed; }
.roles-swatch.is-review { border-top-color: #6d28d9; }
.roles-status { min-height: 1.4em; margin: 8px 0 0; color: var(--muted); font-weight: 700; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.roles-node-object, .roles-chip-object { overflow: visible; pointer-events: all; }
.roles-node {
  box-sizing: border-box;
  display: flex;
  gap: 10px;
  align-items: center;
  width: 232px;
  height: 120px;
  padding: 10px 12px;
  border: 1px solid rgb(15 23 42 / 12%);
  border-left-width: 5px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 24px rgb(15 23 42 / 8%);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.roles-node.is-contractor { border-left-color: #0f766e; }
.roles-node.is-manager { border-left-color: #1d4ed8; }
.roles-node.is-admin { border-left-color: #4338ca; }
.roles-node.is-finance { border-left-color: #b45309; }
.roles-node.is-self {
  border-color: var(--accent);
  border-left-width: 5px;
  background: linear-gradient(180deg, #fff, var(--surface-tint));
}
.roles-node.is-selected { box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / 55%), 0 10px 24px rgb(15 23 42 / 8%); }
.roles-node.is-dim, .roles-edge.is-dim { opacity: .2; }
.roles-edge.is-hidden { display: none; }
.roles-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: 50%;
  background: #e2e8f0;
  color: var(--ink);
  font-weight: 800;
}
.roles-avatar img { width: 100%; height: 100%; object-fit: cover; }
.roles-node-copy { min-width: 0; }
.roles-node-name, .roles-node-role {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.roles-node-name { font-weight: 800; white-space: nowrap; }
.roles-node-role {
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.3;
  white-space: normal;
}
.roles-node-you {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .68rem;
  font-style: normal;
  font-weight: 800;
}
.roles-edge-hit { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; }
.roles-edge-line { fill: none; stroke-width: 2.2; pointer-events: none; }
.roles-edge.is-manage .roles-edge-line { stroke: #1d4ed8; }
.roles-edge.is-report .roles-edge-line { stroke: #047857; stroke-dasharray: 7 5; }
.roles-edge.is-review .roles-edge-line { stroke: #6d28d9; stroke-width: 2.8; }
.roles-edge.is-selected .roles-edge-line { stroke-width: 3.6; }
.roles-chip {
  box-sizing: border-box;
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  width: 124px;
  height: 32px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 10px rgb(15 23 42 / 8%);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}
.roles-chip.is-manage { color: #1d4ed8; }
.roles-chip.is-report { color: #047857; }
.roles-chip.is-review { color: #6d28d9; }
.roles-chip.is-selected { box-shadow: 0 0 0 2px currentColor; }
.roles-chip-icon { display: inline-flex; }
.roles-chip-icon svg { display: block; }
.roles-chip-label { white-space: nowrap; }
.roles-detail-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 50%;
  background: #e2e8f0;
  font-weight: 800;
}
.roles-detail-avatar img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 900px) {
  .roles-stage { grid-template-columns: 1fr; }
  .roles-canvas { height: 68vh; min-height: 420px; }
}

@media (max-width: 520px) {
  .header-tools { align-self: flex-end; }
  .locale-menu { left: auto; right: 0; }
}

.payment-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}
.payment-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.payment-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.payment-card {
  text-align: left;
  border: 1px solid #d7dee8;
  border-radius: 14px;
  background: #fff;
  padding: 12px 14px;
  cursor: pointer;
}
.payment-card strong { display: block; font-size: 1.4rem; margin-top: 4px; }
.payment-card.is-selected { outline: 2px solid #0f766e; background: #f0fdfa; }
.payment-card small { color: #5c6778; }
.payment-table td, .payment-table th { white-space: nowrap; }
.payment-reasons { white-space: normal; min-width: 12rem; }
@media (max-width: 768px) {
  .payment-toolbar { grid-template-columns: 1fr; }
}
