:root {
  --bg: #f7f8f6;
  --surface: #ffffff;
  --surface-strong: #eef4ef;
  --ink: #202124;
  --muted: #626a67;
  --line: #d9dfdc;
  --primary: #126c57;
  --primary-dark: #0e523f;
  --accent: #c73d35;
  --warning: #b77b00;
  --shadow: 0 12px 30px rgba(32, 33, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

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

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
}

h3 {
  font-size: 18px;
  line-height: 1.25;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar-actions,
.modal-actions,
.detail-actions,
.task-input-row,
.assignment-list {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.button,
.icon-button {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 40px;
  font-weight: 800;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.button {
  padding: 10px 14px;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button.primary {
  background: var(--primary);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button.secondary {
  background: #ffffff;
  border-color: var(--line);
  color: var(--ink);
}

.button.secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.button.compact {
  min-height: 34px;
  padding: 7px 10px;
}

.button.full {
  width: 100%;
}

.button.danger {
  color: #ffffff;
  background: var(--accent);
}

.icon-button {
  width: 40px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 22px;
}

.app-shell {
  padding: 22px 32px 32px;
}

.overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-panel,
.sidebar,
.project-list-panel,
.detail-panel,
.modal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat-panel {
  min-height: 118px;
  padding: 18px;
  display: grid;
  align-content: space-between;
  gap: 8px;
}

.stat-panel.alert {
  border-color: rgba(183, 123, 0, 0.35);
}

.stat-label,
.stat-note,
.meta,
.person-meta,
.empty-state p,
.task-meta {
  color: var(--muted);
}

.stat-panel strong {
  font-size: 34px;
  line-height: 1;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.sidebar,
.project-list-panel,
.detail-panel {
  padding: 18px;
}

.sidebar {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.stacked-form,
.form-grid {
  display: grid;
  gap: 12px;
}

.hidden {
  display: none;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  padding: 10px 11px;
  min-height: 42px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 108, 87, 0.14);
}

.people-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.person-row {
  display: grid;
  grid-template-columns: 48px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.person-row:last-child {
  border-bottom: 0;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-strong);
}

.person-name {
  font-weight: 900;
}

.workload {
  display: grid;
  justify-items: end;
  gap: 5px;
  min-width: 58px;
}

.workload-bar {
  width: 54px;
  height: 8px;
  overflow: hidden;
  background: var(--surface-strong);
  border-radius: 8px;
}

.workload-bar span {
  display: block;
  height: 100%;
  max-width: 100%;
  background: var(--primary);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px 180px 150px;
  gap: 12px;
  margin-bottom: 14px;
}

.project-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(360px, 1.05fr);
  gap: 18px;
  align-items: start;
}

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

.project-item {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

.project-item:hover,
.project-item.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 108, 87, 0.1);
}

.project-title-row,
.project-footer,
.detail-title-row,
.task-row,
.note-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-pill,
.priority-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-da-assegnare {
  color: #7a5200;
  background: #fff0cf;
}

.status-assegnato {
  color: #075985;
  background: #dff4ff;
}

.status-lavorazione {
  color: #0e523f;
  background: #dff1e9;
}

.status-chiuso {
  color: #4d5552;
  background: #e9ecea;
}

.priority-alta {
  color: #8f231d;
  background: #ffe0dd;
}

.priority-media {
  color: #7a5200;
  background: #fff0cf;
}

.priority-bassa {
  color: #1f6f39;
  background: #e2f5df;
}

.progress-track {
  height: 9px;
  background: var(--surface-strong);
  border-radius: 8px;
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  background: var(--primary);
}

.detail-panel {
  min-height: 520px;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 240px;
  text-align: center;
  gap: 8px;
}

.detail-panel > .empty-state {
  min-height: 470px;
}

.detail-content {
  display: grid;
  gap: 18px;
}

.detail-block {
  display: grid;
  gap: 10px;
}

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

.meta-box {
  padding: 12px;
  background: var(--surface-strong);
  border-radius: 8px;
}

.meta-box span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.meta-box strong {
  display: block;
  margin-top: 2px;
}

.assignment-list {
  align-items: stretch;
}

.assignment-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.assignment-chip input {
  width: auto;
  min-height: auto;
}

.task-list,
.note-list {
  display: grid;
  gap: 8px;
}

.task-row,
.note-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.task-row:last-child,
.note-row:last-child {
  border-bottom: 0;
}

.task-left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.task-left input {
  width: auto;
  min-height: 22px;
  margin-top: 2px;
}

.task-done {
  color: var(--muted);
  text-decoration: line-through;
}

.small-danger {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 900;
  padding: 4px;
}

.modal {
  width: min(760px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(32, 33, 36, 0.4);
}

.modal-card {
  padding: 20px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 18px;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid .wide {
  grid-column: 1 / -1;
}

@media (max-width: 1180px) {
  .overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    max-height: none;
  }
}

@media (max-width: 820px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 22px 18px 16px;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .button {
    flex: 1 1 150px;
  }

  .app-shell {
    padding: 16px 14px 24px;
  }

  .overview,
  .toolbar,
  .form-grid,
  .detail-meta-grid {
    grid-template-columns: 1fr;
  }

  .project-title-row,
  .project-footer,
  .detail-title-row,
  .task-row,
  .note-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Dark operations dashboard */
:root {
  --bg: #050610;
  --panel: #0b0c16;
  --panel-soft: #11131f;
  --panel-strong: #161927;
  --line: #202337;
  --line-strong: #2d3350;
  --ink: #e8e8ef;
  --muted: #777b93;
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.1);
  --green: #00e08a;
  --green-soft: rgba(0, 224, 138, 0.1);
  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.12);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.12);
  --blue: #4f8cff;
  --purple: #7c5cff;
  --shadow: none;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
  color: var(--ink);
}

body:not(.is-authenticated) .app-layout {
  display: none;
}

body.is-authenticated .login-screen {
  display: none;
}

body:not(.is-admin) .admin-only {
  display: none;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(430px, 100%);
  display: grid;
  gap: 16px;
  padding: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(10, 11, 24, 0.94);
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-brand img {
  width: min(280px, 100%);
  max-height: 90px;
  object-fit: contain;
}

.login-card h1 {
  color: #f2f2f7;
  font-size: 26px;
}

.login-card p {
  color: #7b8098;
}

.login-kicker {
  color: var(--cyan) !important;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.login-error {
  min-height: 20px;
  color: #fca5a5 !important;
  font-size: 13px;
  font-weight: 800;
}

.login-help {
  font-size: 12px;
  text-align: center;
}

.app-layout {
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

body.menu-collapsed .app-layout {
  grid-template-columns: 86px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-height: 100vh;
  padding: 18px 6px 8px;
  overflow: auto;
  background: rgba(10, 11, 24, 0.94);
  border-right: 1px solid var(--line-strong);
  border-radius: 0;
  box-shadow: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 8px;
}

.brand {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  height: 44px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
}

.brand-logo-full {
  width: 146px;
  height: 34px;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
}

.brand-logo-icon {
  display: none;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  object-fit: contain;
}

.menu-toggle {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #111320;
  color: #a2a7be;
}

.menu-toggle span {
  width: 14px;
  height: 2px;
  background: currentColor;
  border-radius: 8px;
}

.menu-toggle:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

body.menu-collapsed .sidebar-header {
  padding: 0 4px;
}

body.menu-collapsed .brand {
  flex: 0 0 28px;
}

body.menu-collapsed .brand-logo-full {
  display: none;
}

body.menu-collapsed .brand-logo-icon {
  display: block;
}

.main-nav {
  display: grid;
  gap: 4px;
  margin-top: 18px;
}

.nav-link {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  color: #9296ad;
  border: 1px solid transparent;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
}

body.menu-collapsed .main-nav {
  gap: 8px;
}

body.menu-collapsed .nav-link {
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 0;
  padding: 0;
  font-size: 0;
}

body.menu-collapsed .nav-link span {
  font-size: 16px;
}

body.menu-collapsed .nav-link strong,
body.menu-collapsed .nav-link small {
  position: absolute;
  right: 7px;
  min-width: 17px;
  min-height: 16px;
  font-size: 10px;
}

.nav-link.active,
.nav-link:hover {
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.55);
}

.nav-link strong,
.nav-link small {
  min-width: 20px;
  min-height: 18px;
  display: inline-grid;
  place-items: center;
  color: #9ba0b8;
  background: #181b2b;
  border-radius: 8px;
  font-size: 11px;
}

.logout-button {
  margin-top: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: #777b93;
}

.session-box {
  display: grid;
  gap: 2px;
  margin-top: auto;
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 19, 31, 0.7);
}

.session-box span {
  color: #70758d;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.session-box strong {
  overflow: hidden;
  color: #f2f2f7;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.menu-collapsed .logout-button {
  font-size: 0;
}

body.menu-collapsed .logout-button::before {
  content: "⎋";
  font-size: 15px;
}

body.menu-collapsed .session-box {
  justify-items: center;
  padding: 8px 4px;
}

body.menu-collapsed .session-box span {
  display: none;
}

body.menu-collapsed .session-box strong {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(34, 211, 238, 0.34);
  border-radius: 8px;
  color: var(--cyan);
  font-size: 11px;
}

.main-shell {
  min-width: 0;
  padding-bottom: 34px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 0 24px;
  background: rgba(5, 6, 16, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.page-header h1 {
  font-size: 18px;
  color: #f2f2f7;
}

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

.theme-toggle,
.icon-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #111320;
  color: #a2a7be;
  font-size: 15px;
}

.button {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: #121421;
  color: var(--ink);
  font-size: 13px;
}

.button:hover,
.icon-button:hover {
  transform: none;
  border-color: var(--cyan);
  color: var(--cyan);
}

.button.primary {
  border-color: rgba(34, 211, 238, 0.5);
  background: #0a3140;
  color: #d9fbff;
}

body[data-current-view="team"] #newActivityBtn {
  display: none;
}

body[data-current-view="controlRoom"] #newActivityBtn {
  display: none;
}

body[data-current-view="settings"] #newActivityBtn {
  display: none;
}

.button.ghost {
  background: transparent;
}

.button.slim {
  min-height: 30px;
  padding: 5px 10px;
}

.button.danger {
  border-color: rgba(239, 68, 68, 0.45);
  background: var(--red-soft);
  color: #fecaca;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 26px 24px 18px;
}

.metric-card {
  min-height: 82px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 17, 29, 0.68);
}

.metric-card strong {
  display: block;
  color: #f2f2f7;
  font-size: 30px;
  line-height: 1;
}

.metric-card span,
.column-header span,
.modal-header span {
  display: block;
  margin-top: 7px;
  color: #626780;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metric-card.cyan {
  border-color: rgba(34, 211, 238, 0.32);
  background: var(--cyan-soft);
}

.metric-card.cyan strong {
  color: var(--cyan);
}

.metric-card.blue {
  border-color: rgba(79, 140, 255, 0.32);
  background: rgba(79, 140, 255, 0.1);
}

.metric-card.blue strong {
  color: var(--blue);
}

.metric-card.amber {
  border-color: rgba(245, 158, 11, 0.32);
  background: var(--amber-soft);
}

.metric-card.amber strong {
  color: var(--amber);
}

.metric-card.green {
  border-color: rgba(0, 224, 138, 0.32);
  background: var(--green-soft);
}

.metric-card.green strong {
  color: var(--green);
}

.metric-card.red {
  border-color: rgba(239, 68, 68, 0.32);
  background: var(--red-soft);
}

.metric-card.red strong {
  color: #fca5a5;
}

.filters {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px 160px 190px;
  gap: 10px;
  padding: 0 24px 18px;
}

label {
  color: #80859b;
  font-size: 12px;
  font-weight: 900;
}

input,
select,
textarea {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c0e19;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.13);
}

.activity-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 0 24px;
}

.board-column,
.team-page {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 11, 22, 0.5);
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.column-header h2 {
  margin-top: 2px;
  color: #f2f2f7;
  font-size: 16px;
}

.activity-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.activity-card {
  width: 100%;
  display: grid;
  gap: 12px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-radius: 8px;
  background: rgba(17, 19, 31, 0.88);
  color: var(--ink);
  text-align: left;
}

.activity-card:hover {
  border-color: var(--line-strong);
  border-left-color: var(--cyan);
  background: #121421;
}

.activity-main {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.activity-text {
  min-width: 0;
}

.activity-title {
  display: block;
  overflow: hidden;
  color: #f4f4f7;
  font-size: 15px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-client,
.activity-meta {
  color: #6f748c;
  font-size: 12px;
}

.activity-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.activity-footer > .activity-meta {
  min-width: 180px;
  max-width: 72%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.priority-alta {
  color: #fecaca;
  background: var(--red-soft);
  border: 1px solid rgba(239, 68, 68, 0.34);
}

.priority-media {
  color: #fed7aa;
  background: var(--amber-soft);
  border: 1px solid rgba(245, 158, 11, 0.34);
}

.priority-bassa {
  color: #bbf7d0;
  background: var(--green-soft);
  border: 1px solid rgba(0, 224, 138, 0.34);
}

.status-da-assegnare {
  color: #bae6fd;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.32);
}

.status-assegnato {
  color: #bfdbfe;
  background: rgba(79, 140, 255, 0.12);
  border: 1px solid rgba(79, 140, 255, 0.34);
}

.status-lavorazione {
  color: #fed7aa;
  background: var(--amber-soft);
  border: 1px solid rgba(245, 158, 11, 0.34);
}

.status-chiuso {
  color: #bbf7d0;
  background: var(--green-soft);
  border: 1px solid rgba(0, 224, 138, 0.34);
}

.assignees {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mini-avatar {
  border-radius: 8px;
}

.mini-avatar {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  background: #0a3140;
  color: var(--cyan);
  font-size: 10px;
  font-weight: 900;
}

.empty-state {
  min-height: 128px;
  padding: 22px;
  color: #6f748c;
}

.team-page {
  margin: 18px 24px 0;
}

.single-page {
  padding: 26px 24px 0;
}

.single-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 132px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 11, 22, 0.62);
}

.single-hero span {
  color: #626780;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.single-hero h2 {
  margin-top: 6px;
  color: #f2f2f7;
  font-size: 24px;
}

.single-hero p {
  max-width: 620px;
  margin-top: 6px;
  color: #777b93;
}

.single-hero strong {
  min-width: 88px;
  color: var(--cyan);
  font-size: 46px;
  line-height: 1;
  text-align: right;
}

.project-hero {
  border-color: rgba(34, 211, 238, 0.25);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.1), rgba(17, 19, 31, 0.7));
}

.system-hero {
  border-color: rgba(245, 158, 11, 0.25);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.11), rgba(17, 19, 31, 0.7));
}

.system-hero strong {
  color: var(--amber);
}

.single-board {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 11, 22, 0.5);
}

.events-page {
  padding: 26px 24px 0;
}

.people-stats-page {
  padding: 26px 24px 0;
}

.stats-hero {
  border-color: rgba(0, 224, 138, 0.25);
  background: linear-gradient(135deg, rgba(0, 224, 138, 0.1), rgba(17, 19, 31, 0.7));
}

.stats-hero strong {
  color: var(--green);
}

.people-stats-summary {
  padding: 16px 0 0;
}

.stats-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 11, 22, 0.5);
}

.people-stats-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 12px;
  padding: 14px;
}

.person-stat-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 19, 31, 0.72);
}

.person-stat-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.person-stat-head strong {
  color: #f2f2f7;
}

.person-stat-head span {
  display: block;
  color: #737891;
  font-size: 12px;
}

.stat-load {
  color: var(--cyan) !important;
  font-size: 22px;
}

.stat-progress {
  height: 7px;
}

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

.stat-grid span {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #737891;
  background: rgba(5, 6, 16, 0.22);
  font-size: 12px;
}

.stat-grid strong {
  display: block;
  color: #f2f2f7;
  font-size: 18px;
}

.events-hero {
  border-color: rgba(124, 92, 255, 0.25);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.12), rgba(17, 19, 31, 0.7));
}

.events-hero strong {
  color: #a78bfa;
}

.events-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 11, 22, 0.5);
}

.settings-hero {
  border-color: rgba(79, 140, 255, 0.25);
  background: linear-gradient(135deg, rgba(79, 140, 255, 0.1), rgba(17, 19, 31, 0.7));
}

.settings-hero strong {
  color: var(--blue);
  font-size: 28px;
}

.settings-status-grid {
  padding: 16px 0 0;
}

.settings-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 11, 22, 0.5);
}

.control-room-hero {
  border-color: rgba(239, 68, 68, 0.25);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.11), rgba(17, 19, 31, 0.7));
}

.control-room-hero strong {
  color: #fca5a5;
  font-size: 24px;
  min-width: 120px;
}

.control-room-metrics {
  padding: 16px 0 0;
}

.control-room-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  margin-top: 16px;
}

.control-room-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 11, 22, 0.5);
}

.control-room-grid .control-room-panel {
  margin-top: 0;
}

.control-room-timeseries,
.control-room-team,
.control-room-alerts {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.control-room-timeseries-row {
  display: grid;
  grid-template-columns: 68px 1fr auto;
  gap: 10px;
  align-items: center;
}

.control-room-timeseries-row time {
  color: #8d93aa;
  font-size: 12px;
}

.control-room-bar {
  position: relative;
  height: 12px;
  border-radius: 8px;
  background: rgba(79, 140, 255, 0.12);
  overflow: hidden;
}

.control-room-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
}

.control-room-timeseries-row strong {
  color: #f2f2f7;
  font-size: 12px;
}

.control-room-team-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 19, 31, 0.72);
}

.control-room-team-row strong {
  color: #f2f2f7;
}

.control-room-team-row span {
  color: #7f849b;
  font-size: 12px;
}

.control-room-alert-row {
  display: grid;
  gap: 4px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 19, 31, 0.68);
}

.control-room-alert-row strong {
  color: #f2f2f7;
}

.control-room-alert-row span {
  color: #7b8097;
  font-size: 12px;
}

.control-room-alert-row.level-critical {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.1);
}

.control-room-alert-row.level-warning {
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1);
}

.control-room-alert-row.level-info {
  border-color: rgba(34, 211, 238, 0.36);
  background: rgba(34, 211, 238, 0.1);
}

.settings-body {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.settings-note {
  color: #8b90a7;
  font-size: 13px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input[type="checkbox"] {
  min-height: auto;
  width: 16px;
  height: 16px;
  accent-color: var(--cyan);
}

#radiusEnvPreview {
  min-height: 170px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
}

.event-list {
  display: grid;
  gap: 0;
  padding: 8px 18px 14px;
}

.event-row {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.event-row:last-child {
  border-bottom: 0;
}

.event-dot {
  width: 9px;
  height: 9px;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.1);
}

.event-row strong {
  display: block;
  color: #f2f2f7;
}

.event-row span {
  display: block;
  margin-top: 3px;
  color: #737891;
  font-size: 12px;
}

.single-list {
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
}

.people-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.people-form .button {
  align-self: end;
}

.people-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 14px;
}

.person-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 19, 31, 0.72);
}

.person-initials {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(34, 211, 238, 0.34);
  border-radius: 8px;
  background: rgba(34, 211, 238, 0.1);
  color: var(--cyan);
  font-weight: 900;
}

.person-name {
  color: #f2f2f7;
}

.person-meta {
  color: #737891;
  font-size: 12px;
}

.role-badge,
.visibility-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  width: max-content;
  margin-top: 5px;
  padding: 2px 8px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: 8px;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.08);
  font-size: 11px;
  font-weight: 900;
}

.visibility-badge {
  border-color: rgba(245, 158, 11, 0.28);
  color: var(--amber);
  background: rgba(245, 158, 11, 0.08);
}

.workload {
  min-width: 72px;
  justify-items: end;
  color: #9ca3af;
}

.workload-bar {
  width: 66px;
  background: #070812;
}

.workload-bar span {
  background: var(--cyan);
}

.small-danger {
  border: 0;
  background: transparent;
  color: #fca5a5;
  font-size: 12px;
  font-weight: 900;
}

.small-action {
  border: 0;
  background: transparent;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
}

.small-action:hover,
.small-danger:hover {
  text-decoration: underline;
}

.modal {
  width: min(760px, calc(100vw - 28px));
  border: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.58);
}

.modal-card {
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #090b15;
  color: var(--ink);
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-actions > span {
  flex: 1;
}

.modal-header {
  margin-bottom: 16px;
}

.modal-header h2 {
  color: #f2f2f7;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.assignment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0c0e19;
}

.assignment-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 5px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #121421;
  color: var(--ink);
}

.assignment-chip input {
  width: auto;
  min-height: auto;
}

.assignment-chip.locked {
  opacity: 0.75;
}

.permission-note {
  padding: 10px 12px;
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 8px;
  color: #fed7aa;
  background: rgba(245, 158, 11, 0.08);
  font-size: 13px;
  font-weight: 800;
}

.hidden {
  display: none;
}

@media (max-width: 1120px) {
  .activity-board,
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .filters,
  .people-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
    max-height: none;
  }

  .main-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .logout-button {
    display: none;
  }

  .page-header {
    position: static;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }

  .metric-grid,
  .filters,
  .activity-board,
  .people-form,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .metric-grid,
  .filters,
  .activity-board {
    padding-left: 14px;
    padding-right: 14px;
  }

  .single-page {
    padding-left: 14px;
    padding-right: 14px;
  }

  .events-page {
    padding-left: 14px;
    padding-right: 14px;
  }

  .people-stats-page {
    padding-left: 14px;
    padding-right: 14px;
  }

  .single-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .single-hero strong {
    text-align: left;
  }

  .single-list {
    grid-template-columns: 1fr;
  }

  .team-page {
    margin-left: 14px;
    margin-right: 14px;
  }
}

body[data-theme="light"] {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f0f4f8;
  --panel-strong: #e8eef5;
  --line: #d9e1ea;
  --line-strong: #c4cfdb;
  --ink: #17202a;
  --muted: #667085;
  --cyan: #087ea4;
  --cyan-soft: rgba(8, 126, 164, 0.1);
  --green: #15803d;
  --green-soft: rgba(21, 128, 61, 0.1);
  --amber: #b45309;
  --amber-soft: rgba(180, 83, 9, 0.11);
  --red: #b42318;
  --red-soft: rgba(180, 35, 24, 0.1);
  background:
    linear-gradient(rgba(23, 32, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 32, 42, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px;
  color: var(--ink);
}

body[data-theme="light"] .sidebar,
body[data-theme="light"] .page-header,
body[data-theme="light"] .login-card,
body[data-theme="light"] .modal-card {
  background: rgba(255, 255, 255, 0.94);
}

body[data-theme="light"] .page-header h1,
body[data-theme="light"] .login-card h1,
body[data-theme="light"] .column-header h2,
body[data-theme="light"] .single-hero h2,
body[data-theme="light"] .activity-title,
body[data-theme="light"] .person-name,
body[data-theme="light"] .session-box strong,
body[data-theme="light"] .modal-header h2,
body[data-theme="light"] .metric-card strong {
  color: #111827;
}

body[data-theme="light"] .login-card p,
body[data-theme="light"] .single-hero p,
body[data-theme="light"] .activity-client,
body[data-theme="light"] .activity-meta,
body[data-theme="light"] .person-meta,
body[data-theme="light"] .event-row span,
body[data-theme="light"] .empty-state {
  color: #667085;
}

body[data-theme="light"] .event-row strong {
  color: #111827;
}

body[data-theme="light"] .person-stat-head strong,
body[data-theme="light"] .stat-grid strong {
  color: #111827;
}

body[data-theme="light"] .person-stat-head span,
body[data-theme="light"] .stat-grid span {
  color: #667085;
}

body[data-theme="light"] .board-column,
body[data-theme="light"] .team-page,
body[data-theme="light"] .single-board,
body[data-theme="light"] .events-panel,
body[data-theme="light"] .stats-panel,
body[data-theme="light"] .single-hero,
body[data-theme="light"] .metric-card,
body[data-theme="light"] .activity-card,
body[data-theme="light"] .person-row,
body[data-theme="light"] .person-stat-card,
body[data-theme="light"] .session-box {
  background: rgba(255, 255, 255, 0.82);
}

body[data-theme="light"] .activity-card:hover {
  background: #ffffff;
}

body[data-theme="light"] input,
body[data-theme="light"] select,
body[data-theme="light"] textarea,
body[data-theme="light"] .assignment-list {
  background: #ffffff;
  color: #17202a;
}

body[data-theme="light"] .button,
body[data-theme="light"] .theme-toggle,
body[data-theme="light"] .icon-button,
body[data-theme="light"] .menu-toggle,
body[data-theme="light"] .assignment-chip {
  background: #ffffff;
  color: #17202a;
}

body[data-theme="light"] .button.primary {
  background: #087ea4;
  border-color: #087ea4;
  color: #ffffff;
}

body[data-theme="light"] .nav-link {
  color: #667085;
}

body[data-theme="light"] .nav-link.active,
body[data-theme="light"] .nav-link:hover {
  color: #087ea4;
  background: rgba(8, 126, 164, 0.1);
  border-color: rgba(8, 126, 164, 0.4);
}

body[data-theme="light"] .nav-link strong,
body[data-theme="light"] .nav-link small,
body[data-theme="light"] .workload-bar {
  background: #e8eef5;
}

body[data-theme="light"] .person-initials,
body[data-theme="light"] .mini-avatar {
  background: rgba(8, 126, 164, 0.1);
  color: #087ea4;
  border-color: rgba(8, 126, 164, 0.3);
}

body[data-theme="light"] .project-hero {
  background: linear-gradient(135deg, rgba(8, 126, 164, 0.1), rgba(255, 255, 255, 0.86));
}

body[data-theme="light"] .system-hero {
  background: linear-gradient(135deg, rgba(180, 83, 9, 0.1), rgba(255, 255, 255, 0.86));
}

body[data-theme="light"] .events-hero {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.1), rgba(255, 255, 255, 0.86));
}

body[data-theme="light"] .stats-hero {
  background: linear-gradient(135deg, rgba(21, 128, 61, 0.1), rgba(255, 255, 255, 0.86));
}
