:root {
  --slate-950: #0f172a;
  --slate-900: #111827;
  --slate-800: #1f2937;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --red: #b91c1c;
  --amber: #92400e;
  --green: #166534;
  --blue: #1d4ed8;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--slate-900);
  background: #e5e7eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #e5e7eb;
}

.login-panel {
  width: 420px;
  background: var(--white);
  border: 1px solid var(--slate-300);
  border-radius: 6px;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

.login-panel h1 {
  margin: 0 0 4px;
  font-size: 20px;
}

.login-panel p {
  margin: 0 0 14px;
  color: var(--slate-600);
  font-size: 13px;
}

.field {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.field label {
  color: var(--slate-700);
  font-size: 12px;
  font-weight: 700;
}

.field input {
  height: 34px;
  border: 1px solid var(--slate-300);
  border-radius: 4px;
  padding: 0 9px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}

.sidebar {
  background: var(--slate-950);
  color: var(--white);
  padding: 14px 12px;
}

.brand {
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  padding-bottom: 12px;
  margin-bottom: 12px;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
}

.brand-subtitle {
  margin-top: 3px;
  color: #cbd5e1;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 2px;
}

.nav button,
.nav a {
  height: 32px;
  text-align: left;
  padding: 0 10px;
  background: transparent;
  color: #dbe4f0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  text-decoration: none;
  font-size: 13px;
}

.nav button.active,
.nav button:hover,
.nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.nav button.message-alert {
  color: var(--white);
  font-weight: 700;
  text-transform: uppercase;
}

.workspace {
  display: grid;
  grid-template-rows: 54px 1fr;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 18px;
  background: var(--white);
  border-bottom: 1px solid var(--slate-300);
}

.topbar h1 {
  margin: 0;
  font-size: 18px;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 12px;
  padding: 12px;
}

.panel {
  background: var(--white);
  border: 1px solid var(--slate-300);
  border-radius: 6px;
}

.panel-header {
  min-height: 38px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--slate-200);
}

.panel-header h2 {
  margin: 0;
  font-size: 14px;
}

.panel-body {
  padding: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.metric {
  background: var(--white);
  border: 1px solid var(--slate-300);
  border-radius: 6px;
  padding: 9px 10px;
}

.portal-warning {
  display: grid;
  gap: 2px;
  margin-bottom: 12px;
  border: 1px solid #fcd34d;
  border-left: 4px solid var(--amber);
  border-radius: 6px;
  background: #fffbeb;
  padding: 8px 10px;
  font-size: 12px;
}

.portal-warning span {
  color: var(--slate-700);
}

.metric-label {
  color: var(--slate-600);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 700;
}

.record-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.record-table th,
.record-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--slate-200);
  text-align: left;
}

.record-table th {
  color: var(--slate-600);
  font-size: 11px;
  text-transform: uppercase;
  background: var(--slate-50);
}

.timer-panel {
  margin-bottom: 12px;
}

.timer-body {
  display: grid;
  gap: 10px;
}

.timer-readout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 8px;
  border: 1px solid var(--slate-200);
  border-radius: 4px;
  background: var(--slate-50);
  padding: 8px;
}

.timer-value {
  margin-top: 3px;
  color: var(--slate-950);
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.timer-subvalue {
  margin-top: 5px;
  color: var(--slate-700);
  font-size: 13px;
  font-weight: 700;
}

.timer-form {
  display: grid;
  grid-template-columns: minmax(160px, 210px) minmax(240px, 1fr) auto;
  align-items: end;
  gap: 8px;
}

.field.compact {
  margin-bottom: 0;
}

.timer-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  min-height: 34px;
}

.timer-note {
  color: var(--slate-600);
  font-size: 12px;
}

.timer-entries {
  display: grid;
  gap: 5px;
}

.timer-entry {
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(0, 1fr) 190px;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--slate-200);
  border-radius: 4px;
  padding: 6px 7px;
  font-size: 12px;
}

.timer-entry span {
  color: var(--slate-600);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timer-entry.empty {
  display: block;
  color: var(--slate-600);
}

.status-list {
  display: grid;
  gap: 7px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--slate-300);
  background: var(--slate-50);
  color: var(--slate-700);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.live {
  color: var(--green);
  background: #ecfdf5;
  border-color: #bbf7d0;
}

.pill.paused,
.pill.privacy,
.pill.away {
  color: var(--amber);
  background: #fffbeb;
  border-color: #fde68a;
}

.pill.off {
  color: var(--slate-600);
}

.pill.danger {
  color: var(--red);
  background: #fef2f2;
  border-color: #fecaca;
}

.actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn {
  min-height: 30px;
  border-radius: 4px;
  padding: 0 10px;
  background: var(--slate-900);
  color: var(--white);
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn.secondary {
  background: var(--white);
  color: var(--slate-800);
  border: 1px solid var(--slate-300);
  font-weight: 500;
}

.btn.warning {
  background: #7c2d12;
}

.btn.stream-on {
  background: #166534;
  color: var(--white);
  border: 1px solid #166534;
}

.btn.stream-off {
  background: #e26d5c;
  color: var(--white);
  border: 1px solid #e26d5c;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.connection-badge {
  min-height: 30px;
  border: 1px solid #86efac;
  border-radius: 4px;
  padding: 0 10px;
  background: #dcfce7;
  color: #166534;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
}

.muted {
  color: var(--slate-600);
  font-size: 12px;
}

.side-stack {
  display: grid;
  align-content: start;
  gap: 12px;
}

.contact-card {
  display: grid;
  gap: 9px;
}

.contact-name {
  font-size: 18px;
  font-weight: 700;
}

.contact-list {
  display: grid;
  gap: 6px;
  border: 1px solid var(--slate-200);
  border-radius: 4px;
  padding: 7px;
  background: var(--slate-50);
}

.contact-list div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.contact-list span {
  color: var(--slate-600);
  font-weight: 700;
}

.contact-list strong {
  overflow-wrap: anywhere;
}

.contact-actions {
  display: grid;
  gap: 6px;
}

.work-room-state {
  min-height: 28px;
  border: 1px solid var(--slate-200);
  border-radius: 4px;
  background: var(--slate-50);
  color: var(--slate-700);
  padding: 6px 8px;
  font-size: 12px;
}

.contact-settings {
  display: grid;
  gap: 7px;
  border: 1px solid var(--slate-200);
  border-radius: 4px;
  background: var(--slate-50);
  padding: 8px;
}

.settings-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-700);
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.settings-message {
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.live-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.live-note {
  margin-top: 7px;
  color: var(--slate-600);
  font-size: 12px;
}

.dashboard-messages {
  max-height: 220px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.54);
  padding: 20px;
  z-index: 20;
}

.modal-backdrop.open {
  display: flex;
}

.viewer-modal {
  width: min(1260px, calc(100vw - 40px));
  height: min(760px, calc(100vh - 40px));
  background: var(--white);
  border-radius: 6px;
  border: 1px solid var(--slate-300);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.viewer-modal.positioned {
  position: fixed;
  margin: 0;
}

.draggable-header {
  cursor: move;
}

.room-view-options {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.room-mode-buttons {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
}

.room-mode-buttons button {
  min-height: 24px;
  border: 1px solid var(--slate-300);
  border-radius: 4px;
  background: var(--white);
  color: var(--slate-700);
  padding: 0 7px;
  font-size: 12px;
  cursor: pointer;
}

.room-mode-buttons button.active {
  border-color: var(--slate-900);
  background: var(--slate-900);
  color: var(--white);
  font-weight: 700;
}

.room-view-options label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--slate-700);
  font-size: 12px;
  white-space: nowrap;
}

.room-view-options input {
  width: 14px;
  height: 14px;
}

.conversation-picker {
  display: grid;
  gap: 3px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--slate-200);
  background: var(--slate-50);
  color: var(--slate-700);
  font-size: 12px;
}

.chat-header .conversation-picker {
  padding: 7px 0 0;
  border-bottom: 0;
  background: transparent;
}

.conversation-picker span {
  font-weight: 700;
}

.conversation-picker select {
  height: 30px;
  border: 1px solid var(--slate-300);
  border-radius: 4px;
  background: var(--white);
  color: var(--slate-900);
  padding: 0 8px;
  font-size: 12px;
}

.viewer-modal.hide-chat .chat-column {
  display: none;
}

.viewer-modal.hide-chat .viewer-layout {
  grid-template-columns: 1fr;
}

.settings-modal,
.messages-modal {
  width: min(560px, calc(100vw - 40px));
  max-height: min(720px, calc(100vh - 40px));
  background: var(--white);
  border: 1px solid var(--slate-300);
  border-radius: 6px;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr);
  overflow: hidden;
}

.messages-modal {
  width: min(640px, calc(100vw - 40px));
}

.settings-body,
.messages-body {
  min-height: 0;
  padding: 10px;
}

.messages-body {
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr) auto;
  padding: 0;
}

.modal-messages {
  max-height: min(520px, calc(100vh - 150px));
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--slate-300);
  background: var(--slate-50);
}

.modal-header h2 {
  margin: 0;
  font-size: 15px;
}

.viewer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 332px;
  min-height: 0;
  overflow: auto;
}

.screen-column {
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(320px, 1fr) auto;
  min-height: 520px;
  background: #111827;
}

.screen-viewer {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  color: var(--white);
  overflow: hidden;
}

.screen-viewer.split-view {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  place-items: stretch;
  align-items: stretch;
  justify-items: stretch;
  gap: 8px;
  padding: 8px;
  overflow: auto;
}

.room-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #020617;
}

.screen-viewer.split-view .room-video {
  position: relative;
  inset: auto;
  min-height: 260px;
  height: 100%;
  border: 1px solid #334155;
}

.camera-overlay-video {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  display: none;
  width: min(230px, 28%);
  aspect-ratio: 16 / 9;
  border: 2px solid #f8fafc;
  border-radius: 6px;
  background: #111827;
  object-fit: cover;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.36);
}

.camera-overlay-video.active {
  display: block;
}

.screen-placeholder {
  position: relative;
  z-index: 1;
  width: 78%;
  aspect-ratio: 16 / 9;
  border: 1px solid #64748b;
  background: #0f172a;
  display: grid;
  place-items: center;
  text-align: center;
}

.screen-viewer.split-view .screen-placeholder {
  grid-column: 1 / -1;
  margin: auto;
}

.screen-viewer.privacy-active .room-video,
.screen-viewer.privacy-active .camera-overlay-video {
  display: none;
}

.privacy-mask {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  background: #020617;
  color: var(--white);
  text-align: center;
  padding: 24px;
}

.privacy-mask strong,
.privacy-mask span {
  display: block;
}

.privacy-mask strong {
  font-size: 20px;
  margin-bottom: 6px;
}

.privacy-mask span {
  color: #cbd5e1;
  font-size: 14px;
}

.screen-placeholder strong {
  display: block;
  font-size: 20px;
  margin-bottom: 6px;
}

.screen-placeholder em {
  display: block;
  margin-top: 8px;
  color: #cbd5e1;
  font-size: 12px;
  font-style: normal;
}

.screen-placeholder.hidden {
  display: none;
}

.screen-toolbar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  background: #f8fafc;
  border-top: 1px solid var(--slate-300);
}

.media-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  min-width: min(260px, 100%);
}

.screen-toolbar .actions {
  justify-content: flex-end;
  align-items: flex-start;
}

.video-tile {
  border: 1px solid var(--slate-300);
  border-radius: 4px;
  background: var(--white);
  padding: 8px;
  min-height: 96px;
}

.video-tile-title {
  font-size: 12px;
  font-weight: 700;
}

.video-tile-state {
  margin-top: 4px;
  color: var(--slate-600);
  font-size: 12px;
}

.video-tile-state.hidden {
  display: none;
}

.video-tile.hidden {
  display: none;
}

.tile-video {
  display: none;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin-top: 6px;
  border-radius: 4px;
  background: #111827;
  object-fit: cover;
}

.tile-video.active {
  display: block;
}

.chat-column {
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  border-left: 1px solid var(--slate-300);
}

.chat-header {
  padding: 10px;
  border-bottom: 1px solid var(--slate-200);
}

.chat-header h3 {
  margin: 0;
  font-size: 14px;
}

.chat-messages {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
  background: var(--slate-50);
}

.message {
  background: var(--white);
  border: 1px solid var(--slate-200);
  border-radius: 4px;
  padding: 7px;
  font-size: 12px;
}

.message strong {
  display: block;
  margin-bottom: 3px;
}

.chat-form {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--slate-200);
}

.chat-form input {
  flex: 1;
  min-width: 0;
  height: 32px;
  border: 1px solid var(--slate-300);
  border-radius: 4px;
  padding: 0 8px;
}

.notice-popup {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: 340px;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: var(--white);
  color: var(--slate-900);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.notice-popup.show {
  opacity: 1;
  transform: translateY(0);
}

.minimized-live-bar {
  position: fixed;
  width: min(430px, calc(100vw - 36px));
  right: 18px;
  top: 58px;
  z-index: 80;
  min-height: 46px;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: var(--white);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.minimized-live-bar span {
  display: block;
  margin-top: 2px;
  color: var(--slate-600);
}

.error {
  margin-top: 8px;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}
