:root {
  color-scheme: dark;
  --bg: #0a101a;
  --panel: #111a29;
  --panel-2: #172338;
  --line: #2a3952;
  --text: #eef3fa;
  --muted: #95a5ba;
  --accent: #55d6be;
  --accent-dark: #0d806e;
  --danger: #f04438;
  --warning: #fdb022;
  --success: #32d583;
  --teams: #6264a7;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }

.app-shell { display: grid; grid-template-rows: 64px 1fr; height: 100%; }
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 9px 16px; background: #0d1624; border-bottom: 1px solid var(--line); z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand strong { display: block; font-size: 15px; }
.brand small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 430px; }
.brand-mark { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, #55d6be, #318fca); color: #07131d; font-weight: 900; letter-spacing: -1px; box-shadow: 0 8px 20px #55d6be22; }
.session-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px #95a5ba18; }
.status-dot.active { background: var(--success); box-shadow: 0 0 0 4px #32d58322; }
.status-dot.suspended { background: var(--warning); box-shadow: 0 0 0 4px #fdb02222; }
.status-dot.ended { background: var(--danger); box-shadow: 0 0 0 4px #f0443822; }
.heartbeat-countdown { color: var(--accent); font-variant-numeric: tabular-nums; }
.owner-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.drawing-status { margin: 0; padding: 8px 10px; border: 1px solid #55d6be66; border-radius: 7px; color: var(--accent); font-size: 12px; line-height: 1.35; overflow-wrap: anywhere; }

.workspace { display: grid; grid-template-columns: 76px minmax(0, 1fr) 320px; min-height: 0; }
.tools { padding: 10px 8px; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; }
.tool { width: 58px; min-height: 52px; margin-bottom: 7px; border: 1px solid transparent; border-radius: 9px; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer; font-size: 20px; }
.tool span { font-size: 10px; color: var(--muted); }
.tool:hover { background: var(--panel-2); }
.tool.active { border-color: var(--accent); background: #55d6be14; color: var(--accent); }
.tool.active span { color: var(--accent); }
.tool:disabled { opacity: .35; cursor: not-allowed; }
.tool-divider { height: 1px; margin: 7px 5px 12px; background: var(--line); }
.color-palette { margin: 0 0 9px; padding: 7px 5px; border: 1px solid var(--line); border-radius: 9px; }
.color-palette legend { padding: 0 3px; color: var(--muted); font-size: 9px; text-align: center; }
.color-swatches { display: grid; grid-template-columns: repeat(3, 14px); justify-content: center; gap: 4px; }
.color-swatch { width: 14px; height: 14px; padding: 0; border: 1px solid #ffffff55; border-radius: 50%; background: var(--swatch); cursor: pointer; }
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.custom-color { display: grid; justify-items: center; gap: 3px; margin: 8px 0 0; color: var(--muted); font-size: 9px; cursor: pointer; }
.custom-color input { width: 26px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: none; cursor: pointer; }

.viewer { position: relative; min-width: 0; min-height: 0; overflow: hidden; background-color: #09101a; background-image: radial-gradient(#25324a 1px, transparent 1px); background-size: 20px 20px; user-select: none; }
#drawingCanvas { display: block; width: 100%; height: 100%; touch-action: none; }
.navigation-controls { position: absolute; right: 14px; bottom: 14px; z-index: 5; width: min(490px, calc(100% - 28px)); padding: 8px; border: 1px solid #ffffff2b; border-radius: 12px; background: #0b1421e8; box-shadow: 0 12px 34px #0009; backdrop-filter: blur(10px); }
.navigation-buttons { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.navigation-button { min-width: 42px; height: 40px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text); font: 700 13px/1 "Segoe UI", sans-serif; cursor: pointer; }
.navigation-button:hover { border-color: #55d6be88; background: #20314d; }
.navigation-button:focus-visible { outline: 3px solid #55d6be66; outline-offset: 2px; }
.navigation-button:disabled { opacity: .38; cursor: not-allowed; }
.navigation-button.active { border-color: var(--accent); background: #55d6be22; color: var(--accent); }
.navigation-button.pan-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 76px; }
.navigation-button.zoom-button { padding: 0; font-size: 23px; }
.navigation-button.text-button { min-width: 52px; }
.zoom-level { display: grid; place-items: center; min-width: 58px; height: 40px; padding: 0 7px; border: 1px solid var(--line); border-radius: 8px; background: #07101c; color: var(--accent); font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.navigation-hint { margin-top: 7px; color: var(--muted); font-size: 10px; line-height: 1.3; text-align: right; }
.watermark { position: absolute; inset: 0; pointer-events: none; z-index: 3; opacity: .16; overflow: hidden; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 140px; transform: rotate(-12deg) scale(1.15); transform-origin: center; }
.watermark span { display: grid; place-items: center; padding: 10px; text-align: center; color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .03em; white-space: pre-line; }
.empty-state { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; padding: 32px; z-index: 2; }
.empty-state h1 { margin: 8px 0; font-size: 25px; }
.empty-state p { color: var(--muted); max-width: 480px; }
.empty-icon { font-size: 64px; color: var(--accent); }
.lock-overlay { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 24px; background: #07101be8; backdrop-filter: blur(8px); }
.lock-card { width: min(440px, 100%); padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); text-align: center; box-shadow: 0 25px 70px #0009; }
.lock-card h2 { margin: 8px 0; }
.lock-card p { margin-bottom: 0; color: var(--muted); line-height: 1.5; }
.lock-card .button { margin-top: 18px; }
.lock-icon { color: var(--warning); font-size: 44px; }
.toast { position: absolute; left: 50%; bottom: 24px; z-index: 20; transform: translateX(-50%); max-width: min(520px, 90%); padding: 11px 16px; border-radius: 9px; background: #fef3f2; color: #912018; box-shadow: 0 15px 40px #0008; }

.review-panel { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; }
.panel-section { padding: 14px; border-bottom: 1px solid var(--line); }
.panel-section.grow { flex: 1; min-height: 180px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 11px; }
.section-heading h2 { margin: 0; font-size: 14px; }
.owner-badge, .count-badge { padding: 3px 7px; border-radius: 999px; background: #55d6be1c; color: var(--accent); font-size: 10px; font-weight: 700; text-transform: uppercase; }
label { display: grid; gap: 5px; margin: 10px 0; color: var(--muted); font-size: 12px; }
select, textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: #0b1421; color: var(--text); outline: none; }
select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #55d6be18; }
#previousReviewSelect { margin-top: 6px; }
#previousReviewMessage { min-height: 1.5em; }
.help-text { color: var(--muted); font-size: 11px; line-height: 1.45; }
.annotation-list { display: grid; gap: 7px; }
.annotation-item { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #0c1523; cursor: pointer; }
.annotation-item:hover, .annotation-item.selected { border-color: var(--accent); }
.annotation-item.resolved { opacity: .55; }
.annotation-number { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 50%; background: var(--danger); color: white; font-size: 11px; font-weight: 800; }
.annotation-item strong { display: block; font-size: 12px; text-transform: capitalize; }
.annotation-item small { color: var(--muted); }
.comment-list { display: grid; gap: 8px; max-height: 230px; overflow-y: auto; margin-bottom: 10px; }
.comment { padding: 9px; border-radius: 8px; background: #0b1421; }
.comment strong { display: block; font-size: 11px; color: var(--accent); }
.comment p { margin: 4px 0 0; font-size: 12px; white-space: pre-wrap; }
.comment time { color: var(--muted); font-size: 10px; }
.placeholder { color: var(--muted); font-size: 12px; line-height: 1.5; }
.comment-form { margin-bottom: 8px; }
.participant-list { display: grid; gap: 8px; }
.participant-item { padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #0b1421; }
.participant-item strong, .participant-item small { display: block; overflow: hidden; text-overflow: ellipsis; }
.participant-item small { color: var(--muted); margin-top: 2px; }
.participant-actions { display: flex; gap: 6px; margin-top: 8px; }
.participant-actions .button { flex: 1; padding: 6px 8px; }

.button { appearance: none; border: 1px solid transparent; border-radius: 8px; padding: 8px 12px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button.primary { background: var(--accent); color: #062018; }
.button.secondary { border-color: var(--line); background: var(--panel-2); }
.button.success { background: var(--success); color: #032417; }
.button.danger { background: var(--danger); color: white; }
.button.full { width: 100%; }
.button.compact { padding: 5px 9px; font-size: 11px; }
.file-button { display: flex; align-items: center; justify-content: center; margin: 8px 0 12px; color: var(--text); text-align: center; }
.item-delete-button { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 8px; }
.item-delete-button kbd { min-width: 30px; padding: 2px 6px; border: 1px solid #ffffff66; border-bottom-width: 2px; border-radius: 5px; background: #0002; color: inherit; font: 700 10px/1.2 "Segoe UI", sans-serif; }
.shortcut-hint { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; text-align: center; }
.icon-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 20px; }
.hidden { display: none !important; }

.confirm-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: #02060dbf; backdrop-filter: blur(5px); }
.confirm-card { width: min(430px, 100%); padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 24px 80px #000c; }
.confirm-card h2 { margin: 0 0 10px; font-size: 18px; }
.confirm-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.export-card { width: min(560px, 100%); }
.export-choice { display: grid; gap: 5px; width: 100%; margin-top: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #0b1421; color: var(--text); text-align: left; cursor: pointer; }
.export-choice:hover, .export-choice:focus-visible { border-color: var(--accent); background: #122238; outline: none; }
.export-choice strong { color: var(--accent); font-size: 13px; }
.export-choice span { color: var(--muted); font-size: 11px; line-height: 1.45; }
.export-location { margin: 15px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; }
.export-location legend { padding: 0 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.export-location label { display: flex; align-items: center; gap: 8px; margin: 7px 0; cursor: pointer; }
.export-location input { accent-color: var(--accent); }
.export-location .help-text { margin: 8px 0 0; }

body.stage-view .workspace { grid-template-columns: 76px minmax(0, 1fr); }
body.stage-view .review-panel, body.stage-view .owner-actions { display: none !important; }

body.side-panel-view .app-shell { grid-template-rows: auto minmax(0, 1fr); }
body.side-panel-view .topbar { display: flex; flex-direction: column; align-items: stretch; gap: 9px; padding: 10px 12px; }
body.side-panel-view .brand-mark, body.side-panel-view .brand small { display: none; }
body.side-panel-view .session-status { display: flex; }
body.side-panel-view .owner-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.side-panel-view .drawing-status { grid-column: 1 / -1; }
body:not(.side-panel-view) .drawing-status { display: none; }
body.side-panel-view .owner-actions .button { min-width: 0; padding-inline: 7px; }
body.side-panel-view .workspace { display: block; overflow-y: auto; }
body.side-panel-view .tools, body.side-panel-view .viewer { display: none; }
body.side-panel-view .review-panel { position: static; width: auto; min-height: 100%; border: 0; overflow: visible; box-shadow: none; }

.configuration-page { overflow: auto; display: grid; place-items: center; padding: 32px; background: radial-gradient(circle at top, #1f3854, #0a101a 60%); }
.configuration-card { width: min(620px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 30px 80px #0008; }
.configuration-card h1 { margin: 18px 0 8px; }
.configuration-card p, .configuration-card li { color: var(--muted); line-height: 1.55; }
.notice { padding: 10px 12px; border-radius: 8px; background: #fdb02218; color: var(--warning); }
.success-notice { background: #32d58318; color: var(--success); }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 64px minmax(0, 1fr); }
  .review-panel { position: absolute; right: 0; top: 64px; bottom: 0; width: 300px; z-index: 8; box-shadow: -10px 0 40px #0006; }
  .topbar { grid-template-columns: 1fr auto; }
  .session-status { display: none; }
  .tool { width: 46px; }
  .navigation-controls { right: 8px; bottom: 8px; width: calc(100% - 16px); }
  .navigation-buttons { justify-content: center; gap: 4px; }
  .navigation-button { min-width: 38px; height: 38px; padding-inline: 8px; }
  .navigation-button.pan-button { min-width: 66px; }
  .zoom-level { min-width: 52px; height: 38px; }
  .navigation-hint { text-align: center; }
}

@media print { body { display: none !important; } }
