:root {
  color-scheme: dark;
  --brand: #10aae0;
  --brand-dark: #7bdcff;
  --ink: #ecf8fb;
  --muted: #93a8b2;
  --line: #223946;
  --paper: #071219;
  --soft: #0d202a;
  --warm: #1b2527;
  --danger: #ff8a7e;
  --success: #62d6a7;
  --warning: #ffc36b;
  --white: #10232d;
  --panel: #0c1b24;
  --panel-2: #112834;
  --radius: 8px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  font-family: Montserrat, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 22% 0%, rgba(16, 170, 224, 0.16), transparent 32%),
    linear-gradient(180deg, #071219 0%, #0a1821 54%, #071219 100%);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(7, 18, 25, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), #08779f);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
}

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

.brand small,
.side-box small,
.muted {
  color: var(--muted);
}

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

.nav-btn {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.nav-btn:hover,
.nav-btn.active {
  border-color: var(--line);
  background: rgba(16, 170, 224, 0.08);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

.nav-btn.active .nav-icon {
  color: var(--brand);
}

.nav-count {
  min-width: 28px;
  border-radius: 999px;
  padding: 3px 7px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.side-box {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--panel);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.22);
}

.side-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.side-box strong {
  display: block;
  margin: 5px 0 10px;
  font-size: 25px;
}

.progress {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #071820;
}

.progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--brand-dark));
  transition: width 180ms ease;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 18, 25, 0.88);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 29px;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(390px, 42vw);
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  background: var(--panel);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.btn,
.icon-btn {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 14px;
  font-weight: 800;
}

.btn.primary {
  background: var(--brand);
  color: #fff;
}

.btn.primary:hover {
  background: #08779f;
}

.btn.ghost {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.btn.danger {
  border-color: rgba(255, 138, 126, 0.24);
  background: rgba(255, 138, 126, 0.1);
  color: var(--danger);
}

.btn.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-btn {
  display: grid;
  width: 36px;
  min-height: 36px;
  padding: 0;
  place-items: center;
  background: var(--panel);
  color: var(--ink);
}

.content-view {
  padding: 24px 28px 36px;
}

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

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

.two-col {
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
}

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

.panel,
.metric-card,
.record-card,
.hero-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

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

.panel-head p,
.metric-card p,
.record-card p {
  color: var(--muted);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(16, 170, 224, 0.12), transparent 46%),
    var(--panel);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 270px;
  padding: 24px;
}

.hero-copy h2 {
  max-width: 820px;
  font-size: 35px;
  line-height: 1.06;
}

.hero-copy p:not(.eyebrow) {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.6;
}

.hero-panel img {
  width: 100%;
  height: 100%;
  min-height: 270px;
  object-fit: cover;
  object-position: center top;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.metric-card {
  min-height: 132px;
  padding: 16px;
}

.metric-card strong {
  display: block;
  margin: 8px 0 10px;
  font-size: 29px;
  line-height: 1.05;
}

.metric-row,
.record-top,
.line-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.delta,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.pill.success {
  background: rgba(98, 214, 167, 0.12);
  color: var(--success);
}

.pill.warn {
  background: rgba(255, 195, 107, 0.12);
  color: var(--warning);
}

.pill.danger {
  background: rgba(255, 138, 126, 0.12);
  color: var(--danger);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

td strong {
  display: block;
}

.number,
.money {
  font-variant-numeric: tabular-nums;
}

.records {
  display: grid;
  gap: 10px;
}

.record-card {
  display: grid;
  gap: 9px;
  padding: 13px;
}

.record-card.pinned {
  border-left: 4px solid var(--brand);
}

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

.task-line:last-child,
.routine-line:last-child {
  border-bottom: 0;
}

.task-line input,
.routine-line input {
  width: 18px;
  height: 18px;
}

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

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

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

.form-grid label,
.inline-field {
  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: var(--radius);
  background: #071820;
  color: var(--ink);
}

input::placeholder,
textarea::placeholder {
  color: #718994;
}

input,
select {
  min-height: 40px;
  padding: 8px 10px;
}

textarea {
  min-height: 110px;
  padding: 10px;
  resize: vertical;
}

.form-actions {
  display: flex;
  align-items: end;
}

.form-actions .btn {
  width: 100%;
}

.editable-number {
  max-width: 112px;
}

.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.section-tabs button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
}

.section-tabs button.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.empty-state {
  display: grid;
  min-height: 150px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.csv-help {
  display: grid;
  gap: 5px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(16, 170, 224, 0.08);
  color: var(--muted);
  line-height: 1.45;
}

.csv-help strong {
  color: var(--ink);
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
}

.kanban-column {
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  padding: 10px;
}

.kanban-column h3 {
  display: flex;
  justify-content: space-between;
  margin: 0 0 10px;
}

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

.compact-item {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--panel);
}

.tasks-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: 16px;
  align-items: start;
}

.tasks-page {
  display: grid;
  gap: 16px;
}

.tasks-main-panel {
  min-width: 0;
}

.notes-main-panel {
  min-width: 0;
}

.add-note-panel textarea {
  min-height: 180px;
}

.side-stack {
  display: grid;
  gap: 16px;
}

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

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

.panel-head.compact {
  margin-bottom: 12px;
}

.task-table {
  min-width: 860px;
}

.task-title-cell {
  min-width: 280px;
}

.task-title-cell strong,
.task-title-cell span {
  display: block;
}

.task-status-select {
  min-width: 150px;
}

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

.move-task-btn {
  width: 34px;
  min-width: 34px;
  padding: 0;
}

.move-task-btn:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.routine-section {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.routine-section h3 {
  margin: 0;
}

.weekly-plan-panel {
  overflow: hidden;
}

.weekly-plan-wrap {
  overflow-x: auto;
}

.weekly-plan-table {
  width: 100%;
  min-width: 940px;
  border: 1px solid var(--line);
  border-collapse: collapse;
  table-layout: fixed;
}

.weekly-plan-table th,
.weekly-plan-table td {
  border: 1px solid var(--line);
  padding: 9px;
  vertical-align: top;
}

.weekly-plan-table th {
  background: rgba(16, 170, 224, 0.06);
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  text-transform: none;
}

.weekly-plan-table textarea {
  min-height: 210px;
  border: 0;
  border-radius: 0;
  padding: 6px 2px;
  background: transparent;
  line-height: 1.55;
  resize: vertical;
  white-space: pre-wrap;
}

.weekly-plan-table textarea:focus {
  outline: 1px solid var(--brand);
  outline-offset: 4px;
}

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

  .sidebar {
    min-height: auto;
    padding: 14px;
  }

  .brand,
  .side-box {
    display: none;
  }

  .nav-list {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
  }

  .nav-btn {
    grid-template-columns: 24px 1fr;
  }

  .nav-count {
    display: none;
  }

  .kpi-grid,
  .two-col,
  .three-col,
  .tasks-layout,
  .hero-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tasks-layout {
    grid-template-columns: 1fr;
  }
}

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

  .topbar-actions,
  .search-box {
    width: 100%;
  }

  .content-view {
    padding: 18px;
  }

  .kpi-grid,
  .two-col,
  .three-col,
  .hero-panel,
  .form-grid,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    min-height: auto;
    padding: 18px;
  }

  .hero-copy h2 {
    font-size: 27px;
  }
}
