:root {
  --nu-accent: #fe4a23;
  --nu-accent-strong: #e5421f;
  --nu-bg: #f3f4f6;
  --nu-panel: #ffffff;
  --nu-border: #e5e7eb;
  --nu-ink: #111827;
  --nu-muted: #6b7280;
  --nu-success: #0f766e;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--nu-bg);
  color: var(--nu-ink);
  font-family: var(--nu-font-mono, "JetBrains Mono", ui-monospace), SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.top-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--nu-border);
  background: var(--nu-panel);
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--nu-border);
  border-radius: 10px;
  background: #fff;
  color: inherit;
  text-decoration: none;
  flex-shrink: 0;
}

.header-brand:hover {
  background: #f9fafb;
}

.brand-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.brand-text {
  line-height: 1;
}

.brand-text p {
  margin: 0;
}

.brand-text p:first-child {
  font-size: 10px;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: #6b7280;
}

.brand-text p:last-child {
  margin-top: 2px;
  font-size: 11px;
  font-weight: 700;
  color: #374151;
}

.top-nav {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
}

.top-nav button {
  border: 0;
  background: transparent;
  color: var(--nu-ink);
  padding: 6px 10px;
  border-radius: 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 72px;
  transition: 0.2s ease;
}

.top-nav button svg {
  width: 20px;
  height: 20px;
}

.top-nav button span {
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

.top-nav button:hover {
  background: #f3f4f6;
}

.top-nav button.active {
  background: rgba(254, 74, 35, 0.1);
  color: var(--nu-accent);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-action {
  width: 32px;
  height: 32px;
  border: 1px solid var(--nu-border);
  border-radius: 8px;
  background: #fff;
  color: #374151;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-action svg {
  width: 17px;
  height: 17px;
}

.icon-action:hover {
  background: #f9fafb;
}

.header-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.header-clock span:first-child {
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.header-clock span:last-child {
  margin-top: 2px;
  font-size: 10px;
  color: #9ca3af;
  text-transform: uppercase;
}

.workspace {
  padding: 16px;
}

.module {
  display: none;
  gap: 14px;
}

.module.active {
  display: grid;
}

.module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.module-head h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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

.module-actions input[type="search"] {
  min-width: 220px;
}

.folder-chips {
  display: flex;
  gap: 6px;
}

.folder-chips button {
  border: 1px solid var(--nu-border);
  background: #fff;
  color: #4b5563;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.folder-chips button.active {
  color: var(--nu-accent);
  border-color: rgba(254, 74, 35, 0.35);
  background: rgba(254, 74, 35, 0.08);
}

.btn {
  border-radius: 10px;
  border: 1px solid var(--nu-border);
  padding: 8px 12px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  transition: 0.2s ease;
}

.btn-primary {
  background: var(--nu-accent);
  border-color: var(--nu-accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--nu-accent-strong);
  border-color: var(--nu-accent-strong);
}

.btn-ghost {
  background: #fff;
  color: #374151;
}

.btn-ghost:hover {
  background: #f9fafb;
}

.card {
  border: 1px solid var(--nu-border);
  border-radius: 14px;
  background: var(--nu-panel);
  padding: 14px;
}

.card h3 {
  margin: 0 0 12px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #374151;
}

.inbox-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 12px;
  min-height: calc(100vh - 200px);
}

.message-list {
  padding: 8px;
  overflow: auto;
}

.message-row {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 6px;
  cursor: pointer;
  background: transparent;
  width: 100%;
  text-align: left;
}

.message-row:hover {
  border-color: var(--nu-border);
  background: #f9fafb;
}

.message-row.active {
  border-color: rgba(254, 74, 35, 0.35);
  background: rgba(254, 74, 35, 0.08);
}

.message-row.unread .subject {
  font-weight: 700;
}

.message-topline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.subject {
  font-size: 12px;
}

.meta {
  color: var(--nu-muted);
  font-size: 10px;
}

.snippet {
  color: #4b5563;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-view {
  min-height: 420px;
}

.empty-state {
  color: var(--nu-muted);
  font-size: 12px;
  border: 1px dashed var(--nu-border);
  border-radius: 10px;
  min-height: 250px;
  display: grid;
  place-items: center;
}

.mail-body {
  margin-top: 12px;
  border-top: 1px solid var(--nu-border);
  padding-top: 12px;
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 12px;
}

.hidden {
  display: none !important;
}

.vault-layout,
.room-layout,
.pulse-layout {
  display: grid;
  gap: 12px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.stat {
  border: 1px solid var(--nu-border);
  border-radius: 10px;
  padding: 10px;
}

.stat strong {
  display: block;
  color: var(--nu-accent);
  font-size: 18px;
}

.stat small {
  color: var(--nu-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid var(--nu-border);
  padding: 10px 8px;
  font-size: 11px;
}

th {
  color: var(--nu-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.stack-form {
  display: grid;
  gap: 10px;
}

.stack-form label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4b5563;
}

input,
textarea {
  border: 1px solid var(--nu-border);
  border-radius: 10px;
  padding: 9px 10px;
  background: #fff;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--nu-accent);
  box-shadow: 0 0 0 3px rgba(254, 74, 35, 0.12);
}

.room-home {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.room-home-left > h2 {
  margin: 0;
  font-size: 40px;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-transform: none;
}

.room-home-left > p {
  margin: 10px 0 0;
  color: #4b5563;
  font-size: 18px;
}

.room-home-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.room-join-inline {
  display: flex;
  gap: 8px;
}

.room-join-inline input {
  min-width: 270px;
}

.room-list-wrap {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.room-list {
  display: grid;
  gap: 10px;
}

.room-home-right {
  display: grid;
  gap: 10px;
}

.room-display-label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #4b5563;
}

.room-create-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px;
  gap: 8px;
}

.room-create-inline .btn {
  grid-column: 1 / -1;
}

.room-call {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  background: #101418;
  border-color: #1f2937;
  color: #e5e7eb;
  border: 1px solid #1f2937;
  border-radius: 14px;
  padding: 14px;
  min-height: 0;
}

.room-preview-video {
  width: 100%;
  min-height: 180px;
  border-radius: 10px;
  border: 1px solid var(--nu-border);
  background: #111827;
  object-fit: cover;
  margin-bottom: 10px;
}

.room-preview-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.meet-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #1f2937;
}

.meet-topbar strong {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.meet-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.room-status {
  border: 1px solid #334155;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #cbd5e1;
  background: #0f172a;
}

.room-status.on {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(16, 185, 129, 0.12);
}

.room-status.off {
  color: #94a3b8;
  background: #0f172a;
}

.room-live-meta {
  margin: 4px 0 0;
  font-size: 11px;
  color: #94a3b8;
}

.meet-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 10px;
  min-height: 0;
}

.meet-stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 0;
}

.meet-main-stage {
  border: 1px solid #334155;
  border-radius: 12px;
  aspect-ratio: 16 / 9;
  min-height: 220px;
  max-height: min(68vh, 680px);
  background: #0b1020;
  overflow: hidden;
  display: grid;
}

.meet-main-stage .video-tile {
  min-height: 0;
  height: 100%;
  border-radius: 0;
  border: 0;
}

.meet-main-stage .video-tile video {
  object-fit: contain;
}

.meet-main-stage.grid-mode {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  padding: 8px;
}

.meet-main-stage.grid-mode .video-tile {
  min-height: 140px;
  height: auto;
  border: 1px solid #334155;
  border-radius: 10px;
}

.meet-filmstrip {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  grid-auto-rows: minmax(96px, 18vh);
}

.meet-filmstrip.hidden {
  display: none;
}

.meet-sidebar {
  border: 1px solid #334155;
  border-radius: 12px;
  background: #0b1020;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
}

.meet-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid #1f2937;
}

.meet-tabs button {
  border: 0;
  background: transparent;
  color: #94a3b8;
  padding: 9px 10px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.meet-tabs button.active {
  color: #fff;
  background: rgba(254, 74, 35, 0.2);
}

.meet-panel {
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow: auto;
  padding: 10px;
}

#roomParticipantsPanel {
  display: grid;
  align-content: start;
}

#roomChatPanel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
}

.video-tile {
  border: 1px solid #334155;
  border-radius: 10px;
  background: #0b1020;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.video-tile.small {
  min-height: 96px;
  aspect-ratio: 16 / 9;
}

.video-tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #111827;
}

.video-label {
  position: absolute;
  left: 8px;
  bottom: 8px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.78);
  color: #fff;
  padding: 3px 8px;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.room-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.room-controls .btn {
  border-radius: 999px;
}

.room-call .btn-ghost {
  background: #0f172a;
  color: #cbd5e1;
  border-color: #334155;
}

.room-call .btn-ghost:hover {
  background: #1e293b;
}

.room-call .btn-primary {
  background: #dc2626;
  border-color: #dc2626;
}

.room-call .btn-primary:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.participant-row {
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 8px 9px;
  margin-bottom: 8px;
  color: #e2e8f0;
  font-size: 11px;
}

.participant-row .meta {
  color: #94a3b8;
}

.room-chat-messages {
  display: grid;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.chat-msg {
  border: 1px solid #334155;
  border-radius: 10px;
  padding: 8px;
}

.chat-msg .meta {
  color: #94a3b8;
  margin-bottom: 4px;
}

.room-chat-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.room-reactions-layer {
  position: relative;
  min-height: 0;
}

.room-reaction {
  position: absolute;
  bottom: 0;
  font-size: 28px;
  animation: room-float 2.2s ease forwards;
}

@keyframes room-float {
  0% { transform: translateY(0); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(-120px); opacity: 0; }
}

.meeting-row {
  border: 1px solid var(--nu-border);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.meeting-row p {
  margin: 0;
  font-size: 11px;
  color: #4b5563;
}

.pulse-layout {
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.cal-weekday,
.cal-day {
  border: 1px solid var(--nu-border);
  border-radius: 10px;
  min-height: 88px;
  padding: 8px;
  background: #fff;
}

.cal-weekday {
  min-height: auto;
  text-align: center;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--nu-muted);
}

.cal-day {
  cursor: pointer;
}

.cal-day.inactive {
  color: #9ca3af;
  background: #f9fafb;
}

.cal-day.selected {
  border-color: rgba(254, 74, 35, 0.5);
  box-shadow: inset 0 0 0 1px rgba(254, 74, 35, 0.45);
}

.cal-day strong {
  display: block;
  font-size: 11px;
}

.event-dot {
  margin-top: 6px;
  display: block;
  font-size: 10px;
  color: var(--nu-accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-item {
  border: 1px solid var(--nu-border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
}

.agenda-item strong {
  display: block;
  font-size: 11px;
}

.agenda-item p {
  margin: 5px 0 0;
  font-size: 10px;
  color: #4b5563;
}

dialog {
  border: 1px solid var(--nu-border);
  border-radius: 14px;
  padding: 0;
  max-width: 560px;
  width: calc(100% - 24px);
}

dialog::backdrop {
  background: rgba(17, 24, 39, 0.45);
}

dialog form {
  padding: 14px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #111827;
  color: #fff;
  font-size: 11px;
  letter-spacing: 0.05em;
  z-index: 60;
}

.toast.success {
  background: var(--nu-success);
}

.hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  .header-clock {
    display: none;
  }

  .inbox-layout,
  .pulse-layout {
    grid-template-columns: 1fr;
  }

  .room-home {
    grid-template-columns: 1fr;
  }

  .meet-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .meet-sidebar {
    max-height: 300px;
  }

  .room-home-left > h2 {
    font-size: 34px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .top-header {
    padding: 0 10px;
    gap: 8px;
  }

  .header-brand {
    padding: 5px 8px;
  }

  .top-nav button {
    min-width: 62px;
    padding: 6px 8px;
  }

  .top-nav button span {
    display: none;
  }

  .module-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .module-actions {
    width: 100%;
  }

  .module-actions input[type="search"] {
    width: 100%;
    min-width: 0;
  }

  .room-home-left > h2 {
    font-size: 30px;
  }

  .room-join-inline {
    width: 100%;
  }

  .room-join-inline input {
    width: 100%;
    min-width: 0;
  }

  .room-call {
    border-radius: 12px;
    padding: 10px;
    min-height: 0;
  }

  .meet-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .meet-topbar-right {
    width: 100%;
  }

  .meet-main-stage {
    min-height: 200px;
    max-height: 52vh;
  }

  .room-controls {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .room-controls .btn {
    white-space: nowrap;
  }
}
