:root {
  color-scheme: light;
  --bg: #F2F3F5;
  --surface: #FFFFFF;
  --text: #1F2329;
  --text-2: #646A73;
  --text-3: #8F959E;
  --border: #DEE0E3;
  --border-weak: #EFF0F1;
  --primary: #3370FF;
  --primary-hover: #245BDB;
  --primary-soft: #E1EAFF;
  --danger: #F54A45;
  --danger-soft: #FDE2E2;
  --success: #237B19;
  --success-soft: #E8F5EB;
  --warning: #B26206;
  --warning-soft: #FFF5E0;
  --radius: 6px;
  --radius-lg: 6px;
  --primary-active: #1C4CBA;
  --shadow-s2: 0 4px 16px 4px rgba(31, 35, 41, 0.03), 0 4px 8px rgba(31, 35, 41, 0.02), 0 2px 4px -4px rgba(31, 35, 41, 0.02);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

html:lang(ja) {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, "Yu Gothic UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body { margin: 0; color: var(--text); background: var(--bg); font-family: var(--font); font-size: 15px; line-height: 24px; -webkit-font-smoothing: antialiased; overflow-wrap: anywhere; }
button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled, input:disabled, textarea:disabled, select:disabled { cursor: not-allowed; }
a { color: var(--primary); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: none; }
svg { display: block; flex-shrink: 0; }
img { max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.4; text-wrap: balance; }
h1 { font-size: 20px; line-height: 28px; }
h2 { font-size: 20px; line-height: 28px; }
h3, h4 { font-size: 16px; line-height: 24px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
::selection { color: #fff; background: var(--primary); }
::placeholder { color: var(--text-2); opacity: 1; }
input, textarea { caret-color: var(--primary); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
[hidden] { display: none !important; }
.muted { color: var(--text-2); }
.small { font-size: 13px; line-height: 20px; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.danger-text, .danger { color: var(--danger); }
.warn-text { color: var(--warning); }

.app-shell { min-height: 100vh; min-height: 100dvh; }
.app-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 56px; padding: 0 32px; border-bottom: 1px solid var(--border); background: var(--surface); }
.nav { display: flex; align-items: center; gap: 32px; min-width: 0; height: 56px; }
.nav-item { display: inline-flex; align-items: center; flex: none; height: 56px; padding: 0 2px; position: relative; border-bottom: 2px solid transparent; color: var(--text-2); font-size: 16px; line-height: 22px; white-space: nowrap; }
.nav-item + .nav-item::before { content: ""; position: absolute; left: -16px; top: 20px; width: 1px; height: 16px; background: rgba(31,35,41,0.15); }
.nav-item:hover { color: var(--primary); }
.nav-item.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 16px; flex: none; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 6px; border-radius: var(--radius); color: var(--text-2); }
.user-chip:hover, .user-chip[aria-current] { color: var(--primary); background: var(--bg); }
.user-chip .avatar { width: 24px; height: 24px; font-size: 12px; }
.user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 20px; }
.avatar { display: inline-flex; flex: none; width: 32px; height: 32px; border-radius: 50%; vertical-align: middle; object-fit: cover; }
.avatar-fallback { align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); font-weight: 600; line-height: 1; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; min-height: 32px; padding: 0; border: 0; border-radius: var(--radius); background: transparent; color: var(--text-2); text-decoration: none; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.icon-btn:disabled { opacity: .45; }
.workspace { width: 100%; max-width: 1264px; min-width: 0; margin: 0 auto; padding: 24px 32px 48px; }
.segmented { display: inline-flex; align-items: stretch; padding: 2px; max-width: 100%; background: transparent; border-radius: var(--radius); }
.segmented button { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; padding: 3px 12px; border: 0; border-radius: 4px; background: transparent; color: var(--text-2); white-space: nowrap; font-size: 14px; line-height: 22px; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: transparent; color: var(--primary); font-weight: 600; }
.view { min-width: 0; width: 100%; }
.rule-tabs, .admin-tabs { display: flex; align-items: center; gap: 8px; max-width: 100%; margin-bottom: 24px; padding-bottom: 3px; overflow-x: auto; }
.rule-tab, .admin-tab-link { display: inline-flex; flex: none; align-items: center; justify-content: center; gap: 8px; min-height: 32px; padding: 5px 12px; border-radius: var(--radius); color: var(--text-2); font-weight: 600; white-space: nowrap; }
.rule-tab:hover, .admin-tab-link:hover { color: var(--text); background: var(--bg); }
.rule-tab.active, .admin-tab-link.active { color: var(--primary); background: var(--primary-soft); font-weight: 600; }
.card { min-width: 0; border: 0; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-s2); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 22px; }
.card-head h2 { font-size: 16px; line-height: 24px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 32px; max-width: 100%; padding: 4px 11px; border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--text); font-size: 14px; font-weight: 400; line-height: 22px; text-align: center; text-decoration: none; white-space: nowrap; }
.btn-primary { color: #fff; background: var(--primary); }
.btn-primary:hover { color: #fff; background: var(--primary-hover); }
.btn-primary:active { background: var(--primary-active); }
.btn-ghost { color: var(--text-2); border-color: transparent; background: transparent; }
.btn-ghost:hover { color: var(--text); background: var(--bg); border-color: var(--text-3); }
.btn-danger { color: #fff; background: var(--danger); }
.btn-danger:hover { color: #fff; background: #F76965; }
.btn-ghost.danger-text { color: var(--danger); }
.btn-ghost.danger-text:hover { background: var(--danger-soft); border-color: #FBBFBC; }
.btn-sm { padding: 4px 11px; font-size: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; }
.btn:disabled:hover { filter: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; width: fit-content; max-width: 100%; padding: 0 6px; border-radius: 4px; font-size: 12px; font-weight: 400; line-height: 20px; white-space: nowrap; }
.badge-neutral { color: var(--text-2); background: var(--bg); }
.badge-ok { color: var(--success); background: var(--success-soft); }
.badge-info { color: var(--primary); background: var(--primary-soft); }
.badge-warn { color: var(--warning); background: var(--warning-soft); }
.badge-danger { color: var(--danger); background: var(--danger-soft); }
.input, .textarea { display: block; width: 100%; min-width: 0; padding: 4px 11px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); background: var(--surface); font-size: 14px; line-height: 22px; }
.input { height: 32px; }
.input:hover, .textarea:hover { border-color: var(--text-3); }
.input:focus, .textarea:focus { border-color: var(--primary); outline: none; }
.input:disabled, .textarea:disabled { color: var(--text-2); background: var(--bg); border-color: var(--border); opacity: 1; }
.input-date { width: 154px; max-width: 100%; font-variant-numeric: tabular-nums; }
.select { padding-right: 28px; }
.textarea { padding-block: 8px; min-height: 112px; resize: vertical; field-sizing: content; overflow-y: auto; }
input[type="checkbox"], input[type="radio"] { width: 17px; height: 17px; margin: 0; accent-color: var(--primary); vertical-align: middle; }

.write-grid { display: grid; grid-template-columns: minmax(0, 1fr) 252px; gap: 20px; align-items: start; }
.write-page { min-width: 0; }
.write-card { padding: 32px; }
.write-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding-bottom: 22px; }
.write-head h2 { font-size: 20px; line-height: 28px; font-variant-numeric: tabular-nums; }
.write-head .small { margin-top: 6px; }
.write-head-right { display: flex; flex-direction: column; align-items: end; flex: none; gap: 8px; padding-top: 4px; }
.status-slot { display: inline-flex; }
.deadline-countdown { color: var(--text-2); font-size: 13px; line-height: 20px; font-variant-numeric: tabular-nums; }
.notices { display: grid; gap: 8px; margin: 0 0 20px; }
.notice { display: flex; align-items: start; gap: 10px; padding: 13px 15px; border-radius: var(--radius-lg); font-size: 14px; }
.notice > svg { margin-top: 2px; }
.notice strong { font-weight: 600; }
.notice p { margin-top: 3px; }
.notice-info { color: var(--primary); background: var(--primary-soft); }
.notice-warn { color: var(--warning); background: var(--warning-soft); }
.notice-locked { color: var(--text-2); background: var(--bg); }
.notice.compact { padding: 10px 13px; margin-bottom: 12px; }
.form-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 14px 0 20px; border-top: 1px solid var(--border); }
.toolbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.toolbar-actions .btn-ghost { border-color: transparent; padding-inline: 8px; }
.report-form { display: grid; gap: 30px; }
.report-form .input, .report-form .textarea { font-size: 16px; line-height: 26px; }
.report-form .input { height: 40px; }
.report-form .textarea { min-height: 112px; }
.field { min-width: 0; }
.field-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 9px; }
.field-label { font-weight: 600; font-size: 16px; line-height: 24px; }
.required .field-label { color: var(--text); }
.req, .opt { flex: none; font-size: 13px; line-height: 20px; }
.req { margin-left: 4px; color: var(--danger); }
.opt { color: var(--text-2); }
.char-count { visibility: hidden; margin-left: auto; color: var(--text-2); font-size: 13px; line-height: 20px; font-variant-numeric: tabular-nums; }
.field:focus-within .char-count, .char-count.near-limit { visibility: visible; }
.form-hint { display: block; margin-top: 7px; color: var(--text-2); font-size: 13px; line-height: 20px; }
.field-error { display: block; margin-top: 5px; color: var(--danger); font-size: 13px; line-height: 20px; }
.field-error:empty { display: none; }
.field:has(.field-error:not(:empty)) .input, .field:has(.field-error:not(:empty)) .textarea { border-color: var(--danger); }
.form-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border); }
.save-state { display: grid; gap: 3px; font-size: 13px; line-height: 20px; }
.saved-hint { color: var(--success); }
.saved-hint:empty { display: none; }
.autosave-hint { color: var(--text-2); }
.saved-hint:not(:empty) + .autosave-hint { display: none; }
.action-buttons { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.write-side { display: grid; gap: 18px; min-width: 0; }
.side-card { padding: 20px; }
.side-card h3 { margin-bottom: 14px; }
.history-list { display: grid; }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 0; color: var(--text); border-bottom: 1px solid var(--border-weak); }
.history-row:last-child { border-bottom: 0; }
.history-row:hover .history-period, .history-row.current .history-period { color: var(--primary); }
.history-row.current .history-period { font-weight: 600; }
.history-period { font-size: 13px; line-height: 20px; }
.history-row .badge { font-size: 12px; padding-inline: 6px; }
.quick-links { display: grid; padding-block: 8px; }
.quick-link { display: flex; align-items: center; gap: 10px; padding: 13px 0; color: var(--primary); font-size: 14px; }
.quick-link span { flex: 1; }
.quick-link:hover span { text-decoration: underline; }
.preview-sheet { max-width: 72ch; padding-top: 8px; }
.preview-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 26px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.preview-head span { color: var(--text-2); font-size: 14px; }
.preview-field { margin: 32px 0; }
.preview-field h4 { margin-bottom: 8px; color: var(--text); }
.preview-field p { white-space: pre-wrap; font-size: 16px; line-height: 28px; }

.team-page, .digest-page, .stats-page { min-width: 0; }
.team-toolbar { display: grid; gap: 20px; padding: 20px 24px; margin-bottom: 20px; }
.team-digest { min-width: 0; max-width: 100%; margin-bottom: 24px; padding: 20px; overflow: hidden; }
.team-digest.compact { padding: 0; }
.digest-embed-toolbar { display: flex; align-items: start; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 20px; }
.digest-embed-meta { min-width: 0; }
.digest-embed-meta h2 { margin-bottom: 8px; }
.digest-embed-frame { display: block; width: 100%; max-width: 100%; height: 1200px; border: 0; background: var(--surface); }
.team-digest > [aria-live]:not(:empty) { padding: 16px 20px; }
.team-reports { min-width: 0; max-width: 100%; }
.team-reports > summary { padding: 16px; border-radius: var(--radius); background: var(--surface); font-weight: 600; cursor: pointer; }
.team-reports[open] > summary { margin-bottom: 16px; }
.period-nav { display: flex; align-items: center; gap: 14px; }
.period-current { display: grid; gap: 3px; min-width: 0; }
.period-current strong { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.period-current > span { color: var(--text-2); font-size: 13px; line-height: 20px; }
.team-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-width: 0; }
.control-label { display: flex; align-items: center; gap: 9px; color: var(--text-2); font-size: 12px; }
.search-input { flex: 1 1 180px; width: auto; }
.filter-switch { flex: none; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin-bottom: 20px; padding: 20px 24px; border: 0; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-s2); }
.stat-card { min-width: 0; padding: 7px 0 7px 20px; border-left: 1px solid var(--border); }
.stat-card:first-child { padding-left: 0; border-left: 0; }
.stat-card b { display: block; font-size: 24px; font-weight: 600; line-height: 32px; font-variant-numeric: tabular-nums; }
.stat-card > span { display: block; margin-top: 8px; color: var(--text-2); font-size: 12px; }
.stat-warn b { color: var(--warning); }
.stat-accent b { color: var(--primary); }
.missing-block { margin-bottom: 26px; }
.missing-block:empty { display: none; }
.missing-block h3 { margin-bottom: 10px; color: var(--danger); font-size: 16px; line-height: 24px; }
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); font-size: 12px; }
.chip-danger { color: var(--danger); background: var(--danger-soft); border-color: #FBBFBC; }
.chip-person { color: var(--primary); background: var(--primary-soft); border-color: #C9D8FF; }
.chip-x { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; margin: -4px -7px -4px 0; border: 0; border-radius: 4px; color: inherit; background: transparent; }
.chip-x:hover { background: #D6E2FF; }
.all-submitted { display: flex; align-items: center; gap: 8px; color: var(--success); font-size: 14px; }
.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 24px 0 12px; }
.list-head h2 { font-size: 16px; line-height: 24px; }
.report-list { overflow: hidden; border: 0; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-s2); }
.report-row { display: flex; align-items: center; gap: 20px; padding: 22px 24px; color: var(--text); border-bottom: 1px solid var(--border-weak); }
.report-row:last-child { border-bottom: 0; }
.report-row:hover { background: var(--bg); }
.report-row-main { flex: 1; min-width: 0; }
.report-row-head { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 10px; }
.report-name { font-size: 14px; font-weight: 600; }
.report-excerpt { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; color: var(--text-2); font-size: 15px; line-height: 24px; }
.report-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 13px; color: var(--text-2); font-size: 13px; line-height: 20px; font-variant-numeric: tabular-nums; }
.meta-item { display: inline-flex; align-items: center; gap: 5px; }
.reactions-inline { gap: 6px; }
.row-chevron { flex: none; color: var(--text-3); }

.report-page { max-width: 880px; margin: 0 auto; }
.report-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.report-card { position: relative; isolation: isolate; overflow: hidden; padding: 36px 40px; }
.watermark-layer { position: absolute; z-index: -1; inset: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: space-around; gap: 90px 30px; overflow: hidden; opacity: .045; pointer-events: none; user-select: none; }
.watermark-layer span { display: block; transform: rotate(-28deg); color: var(--text); font-size: 14px; white-space: nowrap; }
.report-header { display: flex; align-items: start; justify-content: space-between; flex-wrap: wrap; gap: 18px; margin-bottom: 28px; }
.report-author { display: flex; align-items: center; gap: 13px; min-width: 0; }
.report-author h1 { font-size: 20px; line-height: 28px; }
.report-author p { margin-top: 4px; }
.report-status { display: flex; flex-direction: column; align-items: end; gap: 7px; }
.report-content { max-width: 72ch; }
.content-field { margin-bottom: 32px; }
.content-field:last-child { margin-bottom: 0; }
.content-field h3 { color: var(--text); margin-bottom: 10px; }
.content-text { white-space: pre-wrap; font-size: 16px; line-height: 28px; }
.report-divider { height: 1px; margin: 30px 0 22px; background: var(--border); }
.report-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.report-section-head h2 { font-size: 16px; line-height: 24px; }
.reaction-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.reaction-chip { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 40px; min-height: 32px; padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: transparent; }
.reaction-chip:hover { border-color: var(--primary); background: var(--primary-soft); }
.reaction-chip.mine { border-color: var(--primary); background: var(--primary-soft); }
.reaction-count { font-size: 12px; font-weight: 600; color: var(--primary); font-variant-numeric: tabular-nums; }
.comment-list { display: grid; gap: 20px; margin: 18px 0 22px; }
.comment-row { display: flex; align-items: start; gap: 10px; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 4px; }
.comment-head strong { font-size: 14px; font-weight: 600; }
.comment-body > p { white-space: pre-wrap; font-size: 16px; line-height: 28px; }
.comment-form { display: flex; align-items: end; gap: 10px; }
.comment-input { flex: 1; min-height: 80px; }
.read-receipts { display: grid; gap: 12px; }
.read-avatars { display: flex; align-items: center; padding-left: 2px; }
.read-avatar { display: inline-flex; margin-left: -2px; border: 2px solid var(--surface); border-radius: 50%; }

.digest-toolbar { margin-bottom: 26px; }
.digest-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.digest-body { min-width: 0; }
.digest-frame { display: block; width: 100%; min-height: 72vh; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.digest-generating { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; min-height: 360px; color: var(--text-2); }
.chart-card { padding: 26px; margin-bottom: 22px; }
.bar-chart { display: flex; align-items: stretch; gap: 8px; min-width: 0; height: 240px; overflow-x: auto; padding: 10px 4px 0; border-bottom: 1px solid var(--border); }
.bar-column { display: flex; flex: 1 0 30px; flex-direction: column; align-items: center; min-width: 30px; max-width: 70px; }
.bar-track { display: flex; flex: 1; align-items: end; justify-content: center; width: 100%; min-height: 0; border-bottom: 1px solid var(--border); }
.bar-fill { width: min(64%, 24px); min-width: 8px; border-radius: 4px 4px 0 0; background: var(--primary); }
.bar-column:hover .bar-fill { outline: 2px solid var(--text); outline-offset: 2px; }
.bar-label { display: block; flex: none; padding: 9px 0; color: var(--text-2); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-card { overflow-x: auto; padding: 24px; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.data-table th { color: var(--text-2); font-weight: 600; font-size: 12px; white-space: nowrap; background: var(--bg); }
.data-table th, .data-table td { padding: 13px 14px; border-bottom: 1px solid var(--border-weak); vertical-align: middle; }
.data-table td { min-width: 80px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--bg); }
.data-table .input { min-width: 100px; }
.data-table .num, .data-table th:not(:first-child):has(+ th:last-child) { font-variant-numeric: tabular-nums; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.person-cell { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }

.settings-page { display: grid; gap: 18px; max-width: 720px; }
.settings-card { padding: 26px 28px; }
.settings-card h2 { margin-bottom: 16px; font-size: 16px; line-height: 24px; }
.settings-card > p + p { margin-top: 10px; }
.account-row { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.account-row > div { min-width: 0; }
.account-row strong { font-size: 14px; }
.account-row p { margin-top: 4px; }
.settings-lang { margin-top: 16px; }

.admin-page { min-width: 0; }
.admin-tabs { gap: 4px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.admin-tab-link { font-size: 14px; }
.admin-tab { min-width: 0; overflow-x: auto; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.rules-admin-list { display: grid; gap: 12px; }
.admin-rule-row { border: 0; box-shadow: var(--shadow-s2); display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 24px; border-radius: var(--radius); background: var(--surface); }
.admin-rule-main { flex: 1; min-width: 0; }
.admin-rule-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 8px; }
.admin-rule-head strong { font-size: 14px; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; flex: none; gap: 8px; }
.rule-form { display: grid; gap: 24px; }
.form-grid { display: grid; align-items: start; gap: 18px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-field { display: flex; flex-direction: column; min-width: 0; gap: 7px; }
.form-label { font-size: 14px; font-weight: 600; }
.form-field .form-hint { margin-top: 0; }
.form-section { display: grid; gap: 18px; padding-top: 22px; border-top: 1px solid var(--border); }
.form-section h3 { font-size: 16px; line-height: 24px; color: var(--primary); }
.fields-editor { display: grid; gap: 10px; }
.field-editor-row { display: grid; grid-template-columns: minmax(80px, .8fr) repeat(2, minmax(90px, 1fr)) 105px auto 36px; gap: 8px; align-items: center; padding: 12px; border-radius: var(--radius-lg); background: var(--bg); }
.field-editor-row .input { padding-inline: 8px; font-size: 12px; }
.field-type { min-width: 0; }
.mini-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.switch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.switch-row { position: relative; display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; font-size: 14px; }
.switch-row > input { position: absolute; left: 0; width: 38px; height: 24px; margin: 0; opacity: 0; cursor: pointer; }
.switch-track { display: block; flex: none; width: 38px; height: 24px; padding: 3px; border-radius: 12px; background: #BBBFC4; transition: background-color 140ms ease-out; }
.switch-thumb { display: block; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); transition: transform 140ms ease-out; }
.switch-row > input:checked + .switch-track { background: var(--primary); }
.switch-row > input:checked + .switch-track .switch-thumb { transform: translateX(14px); }
.switch-row > input:focus-visible + .switch-track { outline: 2px solid var(--primary); outline-offset: 2px; }
.switch-row > input:disabled ~ span { opacity: .5; }
.visibility-custom { min-width: 0; }
.picker { position: relative; display: grid; gap: 8px; min-width: 0; }
.picker-chips:empty, .picker-results:empty { display: none; }
.picker-results { display: grid; max-height: 220px; overflow-y: auto; padding: 5px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.picker-results > p { padding: 8px; }
.picker-result { display: flex; flex-direction: column; align-items: start; gap: 3px; min-height: 44px; padding: 8px 10px; border: 0; border-radius: 5px; background: transparent; text-align: left; }
.picker-result:hover { background: var(--primary-soft); }
.users-admin-list { border: 0; box-shadow: var(--shadow-s2); max-width: 100%; overflow-x: auto; border-radius: var(--radius); background: var(--surface); }
.inline-form { border: 0; box-shadow: var(--shadow-s2); display: flex; align-items: center; gap: 10px; margin-bottom: 24px; padding: 18px; border-radius: var(--radius); background: var(--surface); }
.inline-form > .input { flex: 1 1 140px; width: auto; }
.inline-form > .select { flex-grow: 0; }
.inline-form > .btn { flex: none; }
.wrap { flex-wrap: wrap; }
.audit-table { min-width: 600px; background: var(--surface); }
.audit-table th:first-child, .audit-table td:first-child { white-space: nowrap; }
.settings-admin { border: 0; box-shadow: var(--shadow-s2); display: grid; gap: 22px; max-width: 600px; padding: 26px; border-radius: var(--radius); background: var(--surface); }
.settings-admin > .btn { justify-self: start; }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 320px; padding: 40px 24px; text-align: center; background: var(--surface); border: 0; }
.empty-state h3 { max-width: 40ch; color: var(--text-2); font-size: 14px; font-weight: 400; line-height: 22px; }
.empty-state > p { max-width: 46ch; color: var(--text-3); font-size: 12px; line-height: 20px; }
.empty-state > .btn { margin-top: 8px; }
.empty-icon { display: grid; place-items: center; width: 120px; height: 120px; margin-bottom: 4px; border-radius: var(--radius-lg); background: transparent; color: #BBBFC4; }
.empty-inline { padding: 30px 18px; text-align: center; }
.error-state .empty-icon { color: var(--danger); }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 160px; color: var(--text-2); font-size: 14px; }
.history-list .loading { min-height: 100px; }
.spinner { display: inline-block; flex: none; width: 19px; height: 19px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 800ms linear infinite; }
.spinner-light { border-color: #ffffff50; border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal { position: fixed; inset: 0; width: fit-content; max-width: calc(100vw - 32px); max-height: calc(100dvh - 40px); margin: auto; padding: 0; border: 0; border-radius: var(--radius-lg); color: var(--text); background: var(--surface); box-shadow: 0 8px 32px #1F232929; overflow: auto; overscroll-behavior: contain; }
.modal::backdrop { background: #1F232966; }
.modal-card { width: 440px; max-width: 100%; padding: 28px; }
.modal-wide { width: 850px; }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.modal-head h2 { padding-top: 4px; font-size: 20px; }
.modal-text { font-size: 16px; line-height: 28px; white-space: pre-line; }
.modal-actions { display: flex; align-items: center; justify-content: end; flex-wrap: wrap; gap: 10px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.toast-stack { position: fixed; z-index: 100; right: max(24px, env(safe-area-inset-right)); bottom: max(24px, env(safe-area-inset-bottom)); display: grid; gap: 10px; width: max-content; max-width: min(400px, calc(100vw - 32px)); pointer-events: none; }
.toast { padding: 14px 18px; border-radius: var(--radius); color: var(--text); background: var(--surface); box-shadow: 0 4px 16px #1F23291F; font-size: 14px; line-height: 1.7; opacity: 1; transition: opacity 200ms ease-out, transform 200ms ease-out; }
.toast-success { color: var(--success); background: var(--success-soft); }
.toast-error { color: var(--danger); background: var(--danger-soft); }
.toast-info { color: var(--primary); background: var(--primary-soft); }
.toast-out { opacity: 0; transform: translateY(6px); }
.login-screen { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 32px 20px; }
.login-card { width: 100%; max-width: 420px; padding: 40px 34px 30px; border: 0; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-s2); }
.login-mark { display: flex; color: var(--primary); font-weight: 600; justify-content: start; gap: 3px; margin-bottom: 24px; font-size: 32px; }
.login-card h1 { font-size: 20px; line-height: 28px; }
.login-tagline { margin-top: 8px; color: var(--text-2); font-size: 14px; }
.login-message { margin: 30px 0 20px; color: var(--text-2); font-size: 14px; }
.login-dev { margin-top: 20px; color: var(--text-2); font-size: 12px; text-align: center; }

@media (max-width: 1180px) {
  .write-grid { grid-template-columns: minmax(0, 1fr); }
  .write-side { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .write-card { padding: 26px; }
  .history-list { max-height: 310px; overflow-y: auto; }
  .admin-rule-row { align-items: start; flex-direction: column; gap: 14px; }
}

@media (max-width: 859px) {
  .app-header { padding-inline: 24px; gap: 16px; }
  .nav { gap: 24px; }
  .workspace { padding: 24px; }
  .write-grid { gap: 20px; }
  .write-card { padding: 24px; }
  .field-editor-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .field-editor-row > .icon-btn { justify-self: end; }
  .inline-form { flex-wrap: wrap; }
}

@media (max-width: 540px) {
  html { scrollbar-gutter: auto; }
  .segmented button { min-height: 28px; padding-inline: 10px; font-size: 14px; }
  .app-header { height: 56px; gap: 12px; padding: 0 16px; }
  .header-actions { flex: none; }
  .user-name { display: none; }
  .nav { gap: 24px; overflow-x: auto; }
  .nav-item + .nav-item::before { left: -12px; }
  .workspace { padding: 20px 16px 40px; }
  .rule-tabs { gap: 5px; margin-bottom: 18px; }
  .rule-tab, .admin-tab-link { min-height: 32px; padding: 5px 12px; font-size: 14px; }
  .write-card { padding: 22px 18px; }
  .write-head { flex-wrap: wrap; gap: 12px; padding-bottom: 18px; }
  .write-head h2 { font-size: 20px; }
  .write-head-right { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; width: 100%; padding-top: 0; }
  .form-toolbar { gap: 8px; padding-bottom: 18px; }
  .toolbar-actions { gap: 2px; margin-left: -8px; }
  .report-form { gap: 28px; }
  .field-head { gap: 6px; }
  .input, .textarea { font-size: 16px; line-height: 26px; }
  .input { height: 40px; }
  .textarea { min-height: 112px; }
  .field-editor-row .input { font-size: 16px; }
  .btn { min-height: 32px; padding: 4px 12px; }
  .btn-sm { padding: 4px 10px; font-size: 14px; }
  .form-actions { gap: 16px; margin-top: 24px; }
  .save-state { width: 100%; }
  .action-buttons { width: 100%; margin-left: 0; }
  .action-buttons .btn { flex: 1; }
  .write-side { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .side-card { padding: 20px; }
  .history-list { max-height: 270px; }
  .team-toolbar { padding: 18px 16px; gap: 18px; margin-bottom: 22px; }
  .period-nav { gap: 5px; justify-content: space-between; }
  .period-current { flex: 1; text-align: center; }
  .period-current strong { font-size: 20px; }
  .period-current > span { font-size: 13px; }
  .team-controls { gap: 10px 8px; }
  .team-controls > .input-date { width: 100%; }
  .team-controls > .search-input { flex-basis: 100%; width: 100%; }
  .team-controls > .filter-switch { flex: 1; }
  .filter-switch button { flex: 1; padding-inline: 9px; }
  .control-label { flex: 1 1 100%; justify-content: space-between; }
  .control-label .input-date { flex: 1; width: auto; max-width: 240px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 14px; margin-bottom: 24px; }
  .stat-card { padding-left: 16px; }
  .stat-card:nth-child(odd) { padding-left: 0; border-left: 0; }
  .stat-card b { font-size: 24px; }
  .stat-card > span { font-size: 12px; margin-top: 5px; }
  .digest-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .digest-stats .stat-card { padding-left: 10px; border-left: 1px solid var(--border); }
  .digest-stats .stat-card:first-child { padding-left: 0; border-left: 0; }
  .digest-stats .stat-card b { font-size: 24px; }
  .report-row { padding: 20px 18px; gap: 8px; }
  .report-row-head { gap: 7px; }
  .report-row-head .avatar { width: 30px; height: 30px; }
  .report-name { font-size: 14px; }
  .report-meta { gap: 8px 10px; }
  .report-card { padding: 24px 20px; }
  .report-topline { gap: 8px; }
  .report-topline .btn { padding-inline: 10px; }
  .report-header { gap: 16px; margin-bottom: 24px; }
  .report-author h1 { font-size: 20px; }
  .report-status { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; }
  .watermark-layer { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 80px 15px; }
  .watermark-layer span { font-size: 14px; }
  .reaction-chip { min-height: 32px; }
  .comment-form { flex-wrap: wrap; }
  .comment-input { flex-basis: 100%; min-height: 88px; }
  .comment-form > .btn { margin-left: auto; }
  .digest-toolbar .team-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .digest-toolbar .team-controls > .input-date { grid-column: 1 / -1; width: 100%; }
  .digest-toolbar .team-controls > .btn { width: 100%; }
  .digest-frame { border-radius: var(--radius-lg); }
  .chart-card { padding: 22px 16px; }
  .bar-chart { gap: 6px; height: 210px; }
  .table-card { padding: 20px 16px; }
  .data-table { min-width: 340px; }
  .data-table th, .data-table td { padding: 12px 10px; }
  .settings-card { padding: 24px 20px; }
  .account-row { gap: 12px; }
  .admin-tabs { gap: 2px; }
  .admin-rule-row { padding: 20px 18px; }
  .row-actions { width: 100%; }
  .row-actions .btn { flex: 1; }
  .inline-form { padding: 16px; }
  .inline-form > .input { flex-basis: 100%; }
  .inline-form > .btn { width: 100%; }
  .settings-admin { padding: 22px 18px; }
  .form-grid.two, .form-grid.three, .switch-grid { grid-template-columns: minmax(0, 1fr); }
  .field-editor-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .field-editor-row > .input:first-child { grid-column: 1 / -1; }
  .mini-check { min-height: 36px; }
  .switch-row { min-height: 44px; }
  .picker-result { min-height: 48px; }
  .modal { max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  .modal-card { padding: 24px 20px; }
  .modal-head { gap: 12px; margin-bottom: 22px; }
  .modal-head h2 { font-size: 20px; }
  .modal-actions { gap: 8px; }
  .modal-actions .btn { flex: 1; }
  .toast-stack { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); }
  .login-card { padding: 32px 24px 26px; }
}

@media (max-width: 390px) {
  .team-digest, .team-reports { width: 100%; min-width: 0; }
  .digest-embed-toolbar { padding: 16px; }
  .digest-embed-toolbar > .btn { white-space: normal; }
  .team-controls > .filter-switch { flex-wrap: wrap; min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .spinner { animation: none; border-style: dotted; }
}

@media (forced-colors: active) {
  .btn, .badge, .chip, .segmented, .card { border: 1px solid CanvasText; }
  .bar-fill { background: Highlight; forced-color-adjust: none; }
  .switch-track { outline: 1px solid CanvasText; }
  .switch-row > input:checked + .switch-track { background: Highlight; forced-color-adjust: none; }
}

@media print {
  @page { margin: 15mm; }
  .app-header, .rule-tabs, .admin-tabs, .form-toolbar, .form-actions, .team-toolbar, .report-topline, .admin-toolbar, .toolbar-actions, .toast-stack, .modal, .reaction-bar, .comment-form, .row-actions, .write-side { display: none !important; }
  html, body { color: #000; background: #fff; font-size: 11pt; }
  .workspace, .view, .report-page, .digest-page { width: 100%; max-width: none; margin: 0; padding: 0; }
  .card, .report-card { padding: 0; background: #fff; border: 0; border-radius: 0; box-shadow: none; }
  .report-card { overflow: visible; }
  .report-header, .content-field, .comment-row, .stat-grid, .data-table tr { break-inside: avoid; }
  .report-header { margin-bottom: 24pt; }
  .content-text { color: #000; font-size: 11pt; }
  .digest-embed-toolbar { display: none !important; }
  .team-digest { margin: 0; padding: 0; overflow: visible; }
  .digest-frame, .digest-embed-frame { width: 100%; min-height: 100vh; border: 0; border-radius: 0; }
  .watermark-layer { position: fixed; opacity: .035; }
  .report-divider { margin: 20pt 0 14pt; background: #aaa; }
  .chart-card, .table-card { overflow: visible; margin-top: 20pt; }
  .bar-chart { overflow: visible; }
  .data-table { min-width: 0; }
  a { color: inherit; text-decoration: none; }
  .badge, .chip { border: 1px solid currentColor; background: transparent; }
  .bar-fill { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
