/* Shared visual system for the application and its operator views. */
:root {
  --bg: #f8f6f1; --surface: #fffefa; --surface-alt: #f0eee7;
  --text: #1e343b; --text-secondary: #51646a; --text-muted: #677a7e;
  --accent: #203f49; --accent-hover: #132e37; --accent-light: #dce9e8;
  --gold: #b77736; --gold-hover: #985f26; --gold-light: #f6eadb;
  --facilitator: #203f49; --facilitator-light: #eaf0ee;
  --border: #dcded5; --border-focus: #416770;
  --shadow: rgba(30,52,59,.035); --shadow-md: rgba(30,52,59,.07);
  --radius: 10px; --radius-lg: 18px;
}
html { color-scheme: light; scroll-padding-top: 24px; }
body { -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
:focus-visible { outline: 3px solid #56828a; outline-offset: 4px; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: -100px; left: 20px; z-index: 10000; padding: 14px 20px; background: var(--accent); color: white; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.app-body { background: var(--bg); padding: 24px 40px; }
.app-body #welcome-screen { max-width: 1160px; padding: 0; gap: 28px; }
.app-body .welcome-header { padding: 0; margin: 0; text-align: left; background: none; border: 0; box-shadow: none; animation: none; }
.welcome-brand-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 0 26px; border-bottom: 1px solid var(--border); }
.app-body .welcome-logo { width: 155px; margin: 0; }
.quiet-link { font-size: 13px; color: var(--text-secondary); text-decoration: none; }
.quiet-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 5px; }
.quiet-link span { margin-left: 10px; }
.welcome-intro { display: grid; grid-template-columns: 1.15fr 1fr; gap: 70px; padding: 55px 0 40px; align-items: center; }
.eyebrow { display: block; color: #8c592b; font-size: 10px; font-weight: 600; line-height: 1.5; letter-spacing: .14em; text-transform: uppercase; }
.app-body #welcome-screen .welcome-copy h1 { font-family: 'Playfair Display', Georgia, serif; font-size: clamp(38px,4vw,55px); font-weight: 500; line-height: 1.14; letter-spacing: -.04em; margin: 18px 0; color: var(--text); }
.welcome-copy h1 em { color: #55736c; font-weight: 400; }
.app-body #welcome-screen .welcome-copy p { font-size: 15px; max-width: 400px; line-height: 1.8; margin: 0; }
.welcome-details { display: flex; flex-wrap: wrap; gap: 17px; margin-top: 23px; font-size: 10px; color: var(--text-secondary); }
.welcome-details span::before { content: '·'; color: #a16c39; margin-right: 8px; }
.conversation-preview { position: relative; padding: 27px; background: #fffefa; border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 20px 60px rgba(42,61,54,.045); transform: rotate(1deg); }
.conversation-preview::before { content: ''; position: absolute; inset: 10px -10px -10px 10px; border: 1px solid #e4e3d9; border-radius: 16px; z-index: -1; }
.preview-heading { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 500; color: var(--text-secondary); border-bottom: 1px solid #ebece4; padding-bottom: 18px; }
.preview-dot { width: 6px; height: 6px; background: #6a8f7e; border-radius: 50%; }
.preview-example { margin-left: auto; color: #657774; font-size: 10px; border: 1px solid var(--border); padding: 3px 7px; border-radius: 4px; }
.preview-person, .preview-plato { display: flex; align-items: flex-start; gap: 12px; padding: 22px 0 17px; }
.preview-person strong, .preview-plato strong { font-size: 11px; font-weight: 600; }
.preview-avatar { flex-shrink: 0; display: grid; place-items: center; width: 28px; height: 28px; background: #eee6da; color: #786248; border-radius: 50%; font-size: 11px; }
.app-body #welcome-screen .conversation-preview p { font-size: 12px; line-height: 1.75; margin: 6px 0 0; }
.preview-plato { background: #edf2ec; padding: 16px 14px; border-radius: 9px; }
.preview-plato img { object-fit: contain; flex-shrink: 0; }
.preview-plato strong span { margin-left: 7px; color: #526b65; font-weight: 400; font-size: 9px; }
.preview-footer { display: flex; align-items: center; gap: 10px; color: #697c77; font-size: 10px; padding-top: 22px; }
.preview-line { width: 26px; height: 1px; background: #afbfb7; }
.app-body .welcome-columns { grid-template-columns: 1fr 1fr; gap: 24px; align-items: stretch; }
.app-body .welcome-columns > *::before { display: none; }
.app-body .auth-card, .app-body #guest-panel { padding: 30px; border: 1px solid var(--border); background: var(--surface); border-radius: 14px; box-shadow: none; margin: 0; min-width: 0; }
.app-body #guest-panel { order: -1; background: #edf1eb; border-color: #dce4d9; }
.entry-heading { margin-bottom: 23px; }
.app-body #welcome-screen .entry-heading h2 { font-family: 'Playfair Display', Georgia, serif; color: var(--text); font-size: 25px; line-height: 1.2; font-weight: 500; margin: 10px 0; letter-spacing: -.025em; }
.app-body #welcome-screen .entry-heading p { font-size: 12px; line-height: 1.65; max-width: 100%; }
.app-body .auth-tabs { margin-bottom: 24px; background: transparent; border-bottom: 1px solid var(--border); gap: 24px; border-radius: 0; padding: 0; }
.app-body .auth-tab { flex: none; padding: 10px 0 13px; font-size: 12px; border-radius: 0; color: var(--text-secondary); }
.app-body .auth-tab.active { color: var(--accent); background: transparent; box-shadow: inset 0 -2px var(--accent); }
.app-body .form-group { margin-bottom: 18px; }
.app-body .form-group label, .app-body .paste-text-panel > label { font-size: 12px; font-weight: 500; color: var(--text); margin-bottom: 8px; }
.app-body input:not([type=checkbox]):not([type=range]), .app-body textarea, .app-body select { border: 1px solid #cfd8d0; background: #fffefa; color: var(--text); border-radius: 8px; font-size: 13px; padding: 13px 14px; min-height: 46px; box-shadow: none; width: 100%; }
.app-body input::placeholder, .app-body textarea::placeholder { color: #6f7c7b; opacity: 1; }
.app-body input:focus, .app-body textarea:focus, .app-body select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(65,103,112,.12); }
.app-body .btn { border-radius: 8px; min-height: 44px; font-size: 12px; font-weight: 500; padding: 12px 19px; letter-spacing: 0; box-shadow: none; }
.app-body .btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.app-body .btn-primary:hover { background: var(--accent-hover); transform: none; }
.app-body .btn-secondary { background: transparent; border: 1px solid #c1cec5; color: var(--accent); }
.app-body .btn-secondary:hover { background: #e4ebe3; transform: none; }
.app-body .btn-small { min-height: 38px; padding: 9px 13px; font-size: 11px; }
.app-body #guest-panel .btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.app-body #guest-panel .btn-row > * { flex: 1; white-space: nowrap; }
.app-body .join-code-helper { font-size: 12px !important; margin: 8px 0 14px; }
.app-body .auth-demo { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 16px; }
.app-body #demo-login-copy { font-size: 11px !important; margin-bottom: 10px; }
.app-body .role-chip { font-size: 11px; border-radius: 6px; }
.app-body .user-header { background: none; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 15px 0 24px; box-shadow: none; }
.app-body .user-brand h1 { font-size: 27px !important; }
.app-body .user-avatar { background: #e6e9dd; color: var(--accent); }
.app-body .dashboard-section { background: transparent; border: 0; padding: 6px 0; box-shadow: none; }
.app-body .class-grid-header h3, .app-body .workspace-header h3 { font-family: 'Playfair Display', Georgia, serif; font-weight: 500; font-size: 26px; }
.app-body .class-card, .app-body .class-expanded-card, .app-body .workspace-card { border: 1px solid var(--border); border-radius: 12px; box-shadow: none; background: var(--surface); }
.app-body .class-card:hover { border-color: #819b8c; box-shadow: 0 7px 20px var(--shadow); }
.app-body .workspace-kicker { font-size: 10px; }
.app-body .workspace-meta, .app-body .helper-text { font-size: 12px; line-height: 1.7; }
.app-body .empty-state { padding: 30px 20px; border: 1px dashed #c8d3c9; border-radius: 10px; background: #f4f5ee; font-size: 13px; }
.app-body #setup-screen { max-width: 1100px; padding: 25px 0; }
.app-body .setup-topbar { margin-bottom: 30px; }
.app-body .setup-kicker, .app-body .setup-context-kicker { color: #8c592b; letter-spacing: .12em; font-size: 10px; }
.app-body .setup-topbar h2 { font-family: 'Playfair Display', Georgia, serif; font-size: clamp(28px,3.6vw,42px); font-weight: 500; letter-spacing: -.03em; margin: 12px 0; }
.app-body .setup-subtitle { font-size: 14px; max-width: 650px; line-height: 1.7; }
.app-body .setup-section, .app-body .setup-context-card, .app-body .primed-preview { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: none; padding: 25px; }
.app-body .setup-context-card { background: #edf1eb; }
.app-body .setup-section h3 { font-family: 'Playfair Display', Georgia, serif; font-size: 22px; font-weight: 500; }
.app-body .upload-area { border: 1px dashed #92aa9b; background: #f2f5ee; border-radius: 10px; padding: 27px 15px; }
.app-body .upload-icon { font-weight: 300; color: #557467; }
.app-body .upload-area:hover, .app-body .upload-area:focus { background: #e7eee2; }
.app-body .paste-text-panel { background: #f8f7f1; border: 1px solid var(--border); border-radius: 10px; }
.app-body .setup-actions { position: sticky; bottom: 0; background: rgba(248,246,241,.97); border-top: 1px solid var(--border); padding: 18px 0; z-index: 4; margin-top: 20px; }
.app-body .modal-content, .app-body .readonly-card { background: var(--surface); border-radius: 16px; border: 1px solid var(--border); box-shadow: 0 30px 90px rgba(30,52,59,.2); }
.app-body .modal-header { border-bottom: 1px solid var(--border); }
.app-body .modal-header h2 { font-family: 'Playfair Display', Georgia, serif; font-weight: 500; }
.app-body .modal-close { width: 40px; height: 40px; border-radius: 50%; }
.app-body.video-active { padding: 0; background: #142b32; }
.app-body .video-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.app-body .video-sidebar { background: var(--surface); border-left: 1px solid var(--border); }
.app-body .sidebar-header { border-bottom: 1px solid var(--border); }
.app-body .plato-status { color: #526f64; }
.app-body .feed-msg { border-radius: 10px; box-shadow: none; }
.app-body .feed-msg.facilitator { background: #eaf0e5; border-color: #d6e1cf; }
.app-body .sidebar-chat-input { background: var(--surface); }
.app-body .sidebar-controls { border-top: 1px solid var(--border); background: #f3f3eb; }
.app-body .connection-notice { background: #fff0d4; color: #6c4b1e; border-color: #e7d5b2; }
.app-body .app-notice { background: var(--accent); border: 0; color: #fff; box-shadow: 0 10px 35px rgba(30,52,59,.15); }
.app-body .app-notice .btn { color: #fff; border-color: #6b858b; }
.admin-body { background: var(--bg); color: var(--text); }
.admin-body .admin-header { padding: 24px 5%; background: var(--surface); border-bottom: 1px solid var(--border); }
.admin-brand { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.admin-body .admin-header h1 { font-family: 'Playfair Display', Georgia, serif; font-weight: 500; font-size: 25px; }
.admin-brand h1 span { display: block; font: 10px 'Inter',sans-serif; text-transform: uppercase; letter-spacing: .12em; color: var(--text-secondary); margin-top: 4px; }
.admin-body .admin-tabs { padding: 0 5%; background: var(--surface); border-bottom: 1px solid var(--border); }
.admin-body .admin-tab { font-size: 12px; padding: 17px 20px; }
.admin-body .admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.admin-body .admin-content { padding: 38px 5%; max-width: 1600px; margin: 0 auto; }
.admin-body h2 { font-family: 'Playfair Display',Georgia,serif; font-size: 33px; font-weight: 500; letter-spacing: -.025em; }
.admin-body .stat-card, .admin-body .detail-card, .admin-body .data-table-container { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: none; }
.admin-body .stat-value { font-family: 'Playfair Display',Georgia,serif; font-weight: 500; color: var(--accent); }
.admin-body .stat-label { font-size: 11px; color: var(--text-secondary); }
.admin-body .data-table th { background: #eef1e8; color: var(--text-secondary); font-size: 11px; }
.admin-body .data-table td { border-color: #e6e8df; font-size: 12px; }
.admin-body .btn, .admin-body .btn-back, .admin-body .btn-logout { border-radius: 7px; min-height: 38px; font-size: 12px; font-weight: 500; }
.admin-body .btn-primary { background: var(--accent); color: white; }
.admin-body .admin-content input:not([type=checkbox]), .admin-body .admin-content select, .admin-body .admin-content textarea { border-color: #c8d3ca; border-radius: 7px; min-height: 40px; font-size: 13px; }
.workspace-body { background: var(--bg); color: var(--text); --ink: #1e343b; --muted: #51646a; --panel: #fffefa; --line: #dcded5; --blue: #203f49; }
.workspace-body .dash-header, .workspace-body .dash-card, .workspace-body .join-card { border: 1px solid var(--border); background: var(--surface); box-shadow: none; border-radius: 12px; }
.workspace-body .dash-header { border-radius: 0; border-width: 0 0 1px; }
.workspace-body .dash-hero { background: #edf1eb; border: 1px solid #dce4d9; border-radius: 14px; box-shadow: none; }
.workspace-body .dash-hero h2 { font-family: 'Playfair Display',Georgia,serif; font-weight: 500; font-size: 29px; }
.workspace-body .ctrl-btn { border-radius: 7px; font-weight: 500; min-height: 40px; }
.workspace-body .ctrl-primary { background: var(--accent); }
.workspace-body .join-card h1 { font-family: 'Playfair Display',Georgia,serif; font-weight: 500; }
@media (max-width: 900px) {
  .app-body { padding: 20px 25px; }
  .welcome-intro { gap: 30px; padding: 38px 0 20px; }
  .conversation-preview { padding: 20px; }
  .app-body .auth-card, .app-body #guest-panel { padding: 24px; }
}
@media (max-width: 650px) {
  .app-body { padding: 17px; }
  .app-body #welcome-screen { padding: 0; gap: 20px; }
  .welcome-brand-row { padding-bottom: 18px; }
  .app-body .welcome-logo { width: 133px; }
  .welcome-intro { grid-template-columns: 1fr; padding: 28px 0 8px; gap: 28px; }
  .app-body #welcome-screen .welcome-copy h1 { font-size: 40px; }
  .conversation-preview { display: none; }
  .welcome-details { font-size: 9px; gap: 13px; margin-top: 18px; }
  .app-body .welcome-columns { grid-template-columns: 1fr; gap: 16px; }
  .app-body .auth-card, .app-body #guest-panel { padding: 24px 20px; }
  .app-body .user-header { gap: 15px; flex-wrap: wrap; }
  .app-body .user-header-right { gap: 9px; }
  .app-body .setup-section, .app-body .setup-context-card { padding: 20px; }
  .app-body .setup-actions .btn { flex: 1; }
  .app-body .workspace-header { flex-wrap: wrap; }
  .admin-body .admin-header { padding: 20px; }
  .admin-body .admin-tabs { padding: 0 10px; }
  .admin-body .admin-tab { padding: 15px 13px; }
  .admin-body .admin-content { padding: 25px 18px; }
  .admin-body .admin-header-right { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.app-body .plato-avatar-small { background: #e5e9d8; color: var(--accent); border: 1px solid #d5ddc6; }

.app-body .welcome-columns { animation: none; min-width: 0; }
.app-body .auth-card, .app-body #guest-panel { animation: none; }
.app-body .auth-card input { max-width: none; }
.app-body #welcome-screen, .welcome-intro, .welcome-copy { min-width: 0; }
@media (max-width: 650px) {
  .app-body #welcome-screen .welcome-copy h1 { font-size: clamp(30px, 9.6vw, 40px); }
  .app-body input:not([type=checkbox]):not([type=range]), .app-body textarea, .app-body select { font-size: 16px; }
}

.app-body .auth-tab-content { animation: none; }

.admin-body .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.admin-body .btn-action { min-height: 40px; padding: 9px 14px; border: 1px solid #c8d3ca; border-radius: 7px; background: #f0f2e9; color: var(--accent); font: 500 12px 'Inter', sans-serif; }
.admin-body .btn-action:hover:not(:disabled) { background: #e2e9dd; border-color: #93ab9d; }
.admin-body .admin-toolbar label:has(input[type=checkbox]) { flex-direction: row; align-items: center; gap: 8px; }
.admin-body input[type=checkbox] { accent-color: var(--accent); width: 17px; height: 17px; }
@media (min-width: 1200px) { .admin-body .stats-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 650px) { .admin-body .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.app-body .setup-context-card, .app-body .setup-context-card h3, .app-body .setup-context-row strong { color: var(--text); }
.app-body .setup-context-row span, .app-body .setup-context-note { color: var(--text-secondary); }
.app-body .setup-context-row { border-color: #d6dfd2; background: #f6f8f0; }
.app-body .plato-tile { background: rgba(24,47,53,.96); border-color: #507368; }
.app-body .plato-tile.speaking { border-color: #b8c9a3; box-shadow: 0 0 20px rgba(172,195,150,.12); }
.app-body .plato-tile-icon { background: #edf1d9; }
.app-body .plato-tile.speaking #plato-tile-status { color: #d2debb; }
@media (max-width: 600px) {
  .app-body .video-main { flex: 0 0 min(35dvh, 280px); min-height: 0; }
  .app-body .video-sidebar { flex: 1; height: auto; max-height: none; min-height: 0; }
  .app-body .sidebar-transcript { max-height: none; }
  .app-body .plato-tile { width: 178px; padding: 12px; display: grid; grid-template-columns: 40px 1fr; gap: 8px; bottom: 12px; left: 12px; }
  .app-body .plato-tile-avatar { width: 40px; height: 40px; }
  .app-body .plato-tile-icon { width: 36px; height: 36px; }
  .app-body .plato-speaking-rings { width: 40px; height: 40px; }
  .app-body .plato-tile-info { text-align: left; }
  .app-body .plato-tile-text { grid-column: 1 / -1; font-size: 11px; }
}

.app-body #setup-screen { max-height: none; overflow: visible; }

.video-fallback { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 30px; text-align: center; background: #e9eee5; color: var(--text); }
.video-fallback h2 { font: 500 clamp(23px,3vw,36px)/1.2 'Playfair Display',Georgia,serif; letter-spacing: -.025em; }
.video-fallback p { max-width: 400px; font-size: 13px; line-height: 1.7; color: var(--text-secondary); }
.video-main:has(.video-fallback) .plato-tile { display: none; }
