:root {
  color-scheme: dark;
  --bg: #070707;
  --surface: #111111;
  --surface-2: #171717;
  --surface-3: #202020;
  --line: #2d2a26;
  --text: #f6f3ed;
  --muted: #a9a29a;
  --muted-2: #7d756d;
  --orange: #ff7a18;
  --orange-2: #ff9b3e;
  --danger: #f04444;
  --good: #30d158;
  --warn: #ffd166;
  --info: #4da3ff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
  --radius: 8px;
  --sidebar: 280px;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  min-height: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at top left, rgba(255, 122, 24, 0.2), transparent 30rem),
    linear-gradient(135deg, #050505 0%, #0a0a0a 45%, #15100c 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

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

.auth-panel {
  width: min(100%, 980px);
  display: grid;
  grid-template-columns: 1fr 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(12, 12, 12, 0.92);
  box-shadow: var(--shadow);
}

.auth-brand {
  min-height: 560px;
  padding: 38px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(135deg, rgba(255, 122, 24, 0.24), transparent 42%),
    repeating-linear-gradient(
      120deg,
      rgba(255, 255, 255, 0.035) 0,
      rgba(255, 255, 255, 0.035) 1px,
      transparent 1px,
      transparent 12px
    ),
    #090909;
}

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

.logo-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--orange), #8a2d00);
  color: #100905;
  font-weight: 900;
  box-shadow: 0 12px 32px rgba(255, 122, 24, 0.26);
}

.brand-kicker,
.eyebrow {
  margin: 0 0 8px;
  color: var(--orange-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand-title {
  margin: 0;
  font-size: clamp(42px, 6vw, 68px);
  line-height: 0.94;
  max-width: 620px;
}

.brand-copy {
  max-width: 540px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.auth-form-panel {
  padding: 34px;
  background: var(--surface);
  border-left: 1px solid var(--line);
}

.auth-form-panel h1,
.page-title h1,
.modal-title h2 {
  margin: 0;
}

.auth-form-panel h1 {
  font-size: 27px;
}

.auth-form-panel p {
  color: var(--muted);
  line-height: 1.5;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: rgba(10, 10, 10, 0.96);
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.sidebar-header strong {
  display: block;
  font-size: 15px;
}

.sidebar-header span {
  color: var(--muted);
  font-size: 12px;
}

.mobile-topbar {
  display: none;
}

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

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  border-color: rgba(255, 122, 24, 0.34);
  background: rgba(255, 122, 24, 0.1);
  color: var(--text);
}

.nav-icon,
.btn-icon {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--orange-2);
  font-weight: 800;
  font-size: 12px;
}

.sidebar-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.user-chip {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.user-chip strong {
  display: block;
}

.user-chip span {
  color: var(--muted);
  font-size: 12px;
}

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

.global-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.global-search {
  min-width: min(100%, 420px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(9, 9, 9, 0.9);
}

.global-search .input {
  border: 0;
  min-height: 30px;
  padding: 4px 6px;
  background: transparent;
}

.global-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.save-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid rgba(48, 209, 88, 0.22);
  border-radius: var(--radius);
  background: rgba(48, 209, 88, 0.07);
  color: #98f2ad;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.refresh-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 125, 0, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 125, 0, 0.09);
  color: #ffb66b;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.global-results {
  margin-bottom: 18px;
}

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

.result-item {
  width: 100%;
  display: grid;
  grid-template-columns: max-content minmax(140px, 0.6fr) 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0d0d0d;
  color: var(--text);
  text-align: left;
}

.result-item:hover {
  border-color: rgba(255, 122, 24, 0.5);
  background: #17110c;
}

.result-item span:last-child {
  color: var(--muted);
}

.debug-panel {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid rgba(77, 163, 255, 0.35);
  border-radius: var(--radius);
  background: rgba(77, 163, 255, 0.07);
}

.debug-panel strong {
  display: block;
  margin-bottom: 4px;
}

.debug-panel span {
  color: #bfdcff;
  font-size: 12px;
}

.debug-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.error-card {
  width: min(100%, 760px);
}

.page-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-title h1 {
  font-size: clamp(27px, 4vw, 42px);
  line-height: 1.05;
}

.page-title p {
  margin: 8px 0 0;
  color: var(--muted);
}

.toolbar,
.filters,
.button-row,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar {
  justify-content: space-between;
  margin-bottom: 16px;
}

.filters {
  flex: 1;
}

.filters .input {
  max-width: 320px;
}

.filters .select {
  max-width: 210px;
}

.list-summary {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.progress-wrap {
  position: relative;
  height: 28px;
  margin: 14px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #090909;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--good));
}

.progress-wrap span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text);
  font-size: 12px;
  font-weight: 850;
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

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

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(17, 17, 17, 0.94);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}

.card-body {
  padding: 16px;
}

.dashboard-top,
.dashboard-strip,
.dashboard-secondary {
  margin-top: 14px;
}

.dashboard-top {
  align-items: stretch;
}

.dashboard-top .card-body,
.dashboard-secondary .card-body {
  padding: 14px;
}

.dashboard-priority {
  border-left: 3px solid var(--orange);
}

.dashboard-hero {
  margin-top: 4px;
  border-color: rgba(255, 122, 24, 0.25);
  background: linear-gradient(135deg, rgba(255, 122, 24, 0.11), rgba(17, 17, 17, 0.94) 42%);
}

.dashboard-hero-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 32px;
  align-items: end;
  padding: 28px;
}

.dashboard-hero h2 {
  max-width: 780px;
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
}

.dashboard-hero p:not(.eyebrow) {
  max-width: 720px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.dashboard-hero-side {
  display: grid;
  gap: 12px;
}

.dashboard-hero-side > span {
  color: var(--orange-2);
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
}

.dashboard-key-grid {
  margin-top: 22px;
}

.dashboard-key-grid .card-body {
  padding: 14px;
}

.dashboard-actions,
.dashboard-activity {
  margin-top: 28px;
}

.section-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dashboard-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-action-row .btn {
  min-height: 36px;
  padding: 8px 10px;
}

.dashboard-activity .card {
  box-shadow: none;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 0;
}

.dashboard-link {
  margin: -1px -1px 0;
  padding: 16px;
  border: 1px solid transparent;
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.dashboard-link:hover,
.dashboard-link:focus-visible {
  border-color: rgba(255, 122, 24, 0.45);
  background: rgba(255, 122, 24, 0.08);
  outline: none;
}

.dashboard-link:hover .link-arrow,
.dashboard-link:focus-visible .link-arrow {
  opacity: 1;
  transform: translateX(2px);
}

.link-arrow {
  display: inline-block;
  color: var(--orange-2);
  opacity: 0.7;
  transition:
    opacity 140ms ease,
    transform 140ms ease;
}

.card-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

.card-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.card-text {
  margin: 12px 0 0;
  color: #d7d0c8;
  line-height: 1.55;
  white-space: pre-wrap;
}

.clamp-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.section-title {
  margin: 24px 0 12px;
  font-size: 18px;
}

.compact-heading {
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card {
  min-height: 82px;
  padding: 13px;
  border-left: 3px solid var(--orange);
}

.stat-link {
  cursor: pointer;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

.stat-link:hover,
.stat-link:focus-visible {
  border-color: rgba(255, 122, 24, 0.5);
  background: rgba(255, 122, 24, 0.08);
  outline: none;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
}

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

.view-all-chip {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 4px 7px;
  border: 1px solid rgba(255, 122, 24, 0.28);
  border-radius: var(--radius);
  color: var(--orange-2);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.dashboard-summary-item {
  width: 100%;
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0d0d0d;
  color: var(--text);
  text-align: left;
}

.dashboard-summary-item:hover,
.dashboard-summary-item:focus-visible {
  border-color: rgba(255, 122, 24, 0.45);
  background: #17110c;
  outline: none;
}

.dashboard-summary-item span {
  color: var(--muted);
  font-size: 13px;
}

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

.quick-grid .btn {
  min-height: 36px;
  justify-content: flex-start;
  padding: 8px 9px;
}

.empty-state {
  padding: 28px;
  border: 1px dashed #3a332d;
  border-radius: var(--radius);
  background: rgba(255, 122, 24, 0.04);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}

.btn {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.btn:hover {
  border-color: rgba(255, 122, 24, 0.5);
  background: #21160e;
}

.btn.primary {
  border-color: #e16612;
  background: linear-gradient(180deg, #ff831f, #d95508);
  color: #140a03;
  font-weight: 850;
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  border-color: rgba(240, 68, 68, 0.55);
  background: rgba(240, 68, 68, 0.12);
  color: #ffb4b4;
}

.btn.icon-only {
  width: 38px;
  padding: 0;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
}

.field label {
  color: #d9d2ca;
  font-size: 13px;
  font-weight: 700;
}

.field small {
  color: var(--muted-2);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0b0b0b;
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}

.textarea {
  min-height: 98px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255, 122, 24, 0.14);
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0d0d0d;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pill.orange {
  border-color: rgba(255, 122, 24, 0.44);
  color: var(--orange-2);
}

.pill.good {
  border-color: rgba(48, 209, 88, 0.44);
  color: #8df0a5;
}

.pill.warn {
  border-color: rgba(255, 209, 102, 0.44);
  color: #ffe19a;
}

.pill.danger {
  border-color: rgba(240, 68, 68, 0.44);
  color: #ffb4b4;
}

.detail-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.compact-details {
  margin-top: 10px;
  gap: 8px;
}

.detail-row {
  display: grid;
  gap: 5px;
}

.detail-row span {
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-row p {
  margin: 0;
  color: #e8e0d6;
  line-height: 1.45;
  white-space: pre-wrap;
}

.compact-details .detail-row p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.activity-list {
  display: grid;
  gap: 9px;
}

.activity-item {
  width: 100%;
  display: flex;
  gap: 10px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: #dfd8cf;
  line-height: 1.45;
  text-align: left;
}

.clickable-activity,
.activity-item[title] {
  cursor: pointer;
}

.activity-item:hover,
.activity-item:focus-visible {
  border-color: rgba(255, 122, 24, 0.35);
  background: rgba(255, 122, 24, 0.06);
  outline: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--orange);
  flex: 0 0 8px;
}

.activity-item time {
  display: block;
  color: var(--muted-2);
  font-size: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
}

.modal {
  width: min(100%, 720px);
  max-height: min(90vh, 900px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101010;
  box-shadow: var(--shadow);
}

.modal-title {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: #101010;
}

.modal-content {
  padding: 18px;
}

.modal-actions {
  justify-content: flex-end;
  padding-top: 10px;
}

#toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
}

.toast {
  padding: 12px 14px;
  border: 1px solid rgba(255, 122, 24, 0.45);
  border-radius: var(--radius);
  background: #14110f;
  color: var(--text);
  box-shadow: var(--shadow);
}

.hidden-file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

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

.compact-item {
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0d0d0d;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.compact-item:hover,
.compact-item:focus-visible {
  border-color: rgba(255, 122, 24, 0.45);
  background: #17110c;
  outline: none;
}

.compact-item span {
  color: var(--muted);
  font-size: 13px;
}

.section-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0c0c0c;
  color: #dcd5cc;
  font-size: 13px;
  font-weight: 700;
}

.check-row input {
  accent-color: var(--orange);
}

@media (max-width: 1100px) {
  .grid.cols-4,
  .grid.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-hero-content {
    grid-template-columns: 1fr;
    align-items: start;
  }

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

@media (max-width: 840px) {
  .auth-panel {
    grid-template-columns: 1fr;
  }

  .auth-brand {
    min-height: 360px;
  }

  .auth-form-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .app-shell {
    display: block;
  }

  .mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: rgba(8, 8, 8, 0.96);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 25;
    width: min(88vw, 320px);
    transform: translateX(-100%);
    transition: transform 160ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    padding: 18px 14px 28px;
  }

  .global-bar,
  .global-meta {
    display: grid;
    justify-content: stretch;
  }

  .global-search {
    min-width: 0;
  }

  .filters .input,
  .filters .select,
  .global-meta .btn {
    max-width: none;
    width: 100%;
  }

  .save-status {
    justify-content: center;
  }

  .refresh-status {
    justify-content: center;
  }

  .dashboard-hero-content {
    padding: 22px;
    gap: 22px;
  }

  .dashboard-hero h2 {
    font-size: 28px;
  }
}

@media (max-width: 620px) {
  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4 {
    grid-template-columns: 1fr;
  }

  .page-title,
  .toolbar {
    display: grid;
  }

  .page-title {
    gap: 12px;
  }

  .card-header {
    display: grid;
  }

  .button-row,
  .modal-actions {
    width: 100%;
  }

  .button-row .btn:not(.icon-only),
  .modal-actions .btn {
    flex: 1 1 140px;
  }

  .result-item {
    grid-template-columns: 1fr;
  }

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

  .section-picker {
    grid-template-columns: 1fr;
  }

  .dashboard-action-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .auth-shell {
    padding: 12px;
  }

  .auth-brand,
  .auth-form-panel {
    padding: 24px;
  }
}
