:root {
  color-scheme: dark;
  --bg: #101216;
  --surface: #181c22;
  --surface-2: #20262e;
  --surface-3: #2a313b;
  --line: #343d49;
  --text: #eef3f8;
  --muted: #9ca8b6;
  --accent: #43c6ac;
  --accent-2: #f4b860;
  --danger: #ef6461;
  --ok: #7bd88f;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  color: var(--text);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
}

body.locked {
  display: block;
}

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

button {
  cursor: pointer;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #15191f;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(67, 198, 172, 0.44);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #f7d488);
  object-fit: cover;
}

.brand-mark.large {
  width: 64px;
  height: 64px;
}

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

.lock-card {
  width: min(460px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.lock-card h1,
.lock-card p {
  margin: 0;
}

.lock-error {
  border: 1px solid rgba(239, 100, 97, 0.48);
  border-radius: 8px;
  padding: 10px;
  color: #ffd5d4;
  background: rgba(239, 100, 97, 0.12);
}

.login-link {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.eyebrow,
.panel-heading span,
.stat span,
.person-meta,
.muted {
  color: var(--muted);
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item,
.ghost-button,
.primary-button,
.danger-button,
.icon-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 13px;
  color: var(--text);
  background: transparent;
}

.nav-item {
  text-align: left;
}

.nav-item.active,
.nav-item:hover,
.ghost-button:hover {
  border-color: var(--line);
  background: var(--surface-2);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.current-user {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.current-user span,
.current-user a {
  color: var(--muted);
  font-size: 13px;
}

.file-button {
  display: grid;
  place-items: center;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.shell {
  min-width: 0;
  padding: 28px;
}

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

.topbar h1,
.dialog-form h2,
.panel h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.primary-button {
  color: #091210;
  background: var(--accent);
  font-weight: 800;
}

.danger-button {
  color: #fff;
  background: rgba(239, 100, 97, 0.18);
  border-color: rgba(239, 100, 97, 0.4);
}

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 24px;
}

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

.view {
  display: none;
}

.view.active {
  display: block;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}

.stat,
.panel,
.people-list,
.profile-panel,
.training-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat {
  padding: 18px;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
}

.dashboard-layout,
.people-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 16px;
  margin-top: 16px;
}

.panel,
.profile-panel {
  padding: 18px;
}

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

.attention-list,
.timeline {
  display: grid;
  gap: 10px;
}

.attention-item,
.timeline-item,
.person-row,
.training-person {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-2);
}

.attention-item strong,
.timeline-item strong,
.person-row strong {
  display: block;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.search-box {
  min-width: 240px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
}

.search-box input,
.toolbar select,
.dialog-form input,
.dialog-form select,
.dialog-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-2);
}

.search-box input {
  height: 42px;
  border: 0;
  outline: 0;
}

.toolbar select {
  max-width: 220px;
  padding: 0 10px;
}

.people-layout {
  grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr);
  align-items: start;
}

.people-list {
  overflow: hidden;
}

.person-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border-width: 0 0 1px;
  border-radius: 0;
  text-align: left;
}

.person-row.active {
  background: rgba(67, 198, 172, 0.14);
}

.person-status,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 9px;
  color: #091210;
  background: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
}

.person-status.active {
  background: var(--ok);
}

.profile-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.profile-title h2 {
  margin: 0 0 4px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.profile-section {
  margin-top: 18px;
}

.profile-section h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.training-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.training-card {
  padding: 16px;
}

.training-card h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.training-person {
  margin-top: 8px;
}

dialog {
  width: min(860px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
}

.dialog-form {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.dialog-form header,
.dialog-form footer {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
}

.dialog-form footer {
  grid-template-columns: auto 1fr auto auto;
}

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

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

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

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

.stack-form input,
.stack-form select,
.stack-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  background: var(--surface-2);
}

.muted-chip {
  color: var(--muted);
  background: var(--surface-3);
}

.dialog-form input,
.dialog-form select,
.dialog-form textarea {
  padding: 10px;
  color: var(--text);
  font-weight: 400;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

legend {
  color: var(--muted);
  font-weight: 800;
}

.training-editor {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.training-editor label {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-2);
}

.training-editor input[type="checkbox"] {
  width: auto;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

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

  .stats-grid,
  .dashboard-layout,
  .people-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .shell,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar select {
    max-width: none;
    height: 42px;
  }

  .form-grid,
  .dialog-form footer {
    grid-template-columns: 1fr;
  }
}
