:root {
  --bg: #f6f8f5;
  --surface: #ffffff;
  --surface-2: #eef3ef;
  --line: #d9e2dc;
  --line-strong: #b9c7bd;
  --text: #17211c;
  --muted: #65716a;
  --green: #1f7a4d;
  --green-soft: #dff2e8;
  --blue: #236e9f;
  --blue-soft: #dfedf6;
  --amber: #b35d12;
  --amber-soft: #f7ead9;
  --red: #b83232;
  --red-soft: #f8dfdf;
  --shadow: 0 14px 42px rgba(23, 33, 28, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 440px) 1fr;
  background: var(--surface);
}

.login-panel {
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
}

.login-art {
  background:
    linear-gradient(90deg, rgba(23, 33, 28, 0.55), rgba(23, 33, 28, 0.04) 44%, rgba(23, 33, 28, 0.02)),
    url("/assets/operations-workspace.png") center / cover no-repeat;
  min-height: 420px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  margin-bottom: 30px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--green);
  color: white;
  font-size: 13px;
  line-height: 1;
}

.login-panel h1 {
  margin: 0 0 8px;
  font-size: 2rem;
  line-height: 1.1;
}

.login-panel p {
  margin: 0 0 26px;
  color: var(--muted);
}

.login-form,
.stack-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span,
.field label {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 10px 11px;
  outline: none;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(35, 110, 159, 0.14);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.icon-btn {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 38px;
  padding: 9px 13px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary-btn {
  background: var(--green);
  color: white;
}

.secondary-btn {
  background: var(--blue);
  color: white;
}

.ghost-btn {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-strong);
}

.icon-btn {
  width: 38px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-strong);
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.icon-btn:hover {
  filter: brightness(0.97);
  text-decoration: none;
}

.form-error {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid #edbcbc;
  border-radius: 8px;
  padding: 9px 11px;
  min-height: 38px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: auto;
}

.sidebar .brand {
  margin-bottom: 0;
  padding: 4px 4px 8px;
}

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

.user-chip strong {
  line-height: 1.15;
}

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

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

.nav-btn {
  border: 0;
  border-radius: 8px;
  padding: 10px 11px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 750;
}

.nav-btn:hover,
.nav-btn.active {
  background: var(--surface-2);
  color: var(--text);
}

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

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

.topbar h1 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.1;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

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

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

.metric-card,
.panel,
.row-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(23, 33, 28, 0.03);
}

.metric-card {
  padding: 14px;
  min-height: 104px;
  display: grid;
  align-content: space-between;
  gap: 10px;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.metric-card strong {
  display: block;
  font-size: 1.75rem;
  line-height: 1;
}

.metric-card small {
  color: var(--muted);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.panel {
  padding: 16px;
  min-width: 0;
}

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

.panel-header h2 {
  margin: 0;
  font-size: 1rem;
}

.panel-header span {
  color: var(--muted);
  font-size: 0.84rem;
}

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

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

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

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

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

.list-row strong {
  display: block;
}

.list-row span,
.muted {
  color: var(--muted);
}

.status,
.priority {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.78rem;
  font-weight: 800;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-green {
  background: var(--green-soft);
  color: #145d39;
  border-color: #bfe4cf;
}

.status-blue {
  background: var(--blue-soft);
  color: #1a587e;
  border-color: #c1ddec;
}

.status-amber {
  background: var(--amber-soft);
  color: #87450c;
  border-color: #edcfa7;
}

.status-red {
  background: var(--red-soft);
  color: var(--red);
  border-color: #edbcbc;
}

.status-gray {
  background: #edf0ee;
  color: #4e5b54;
  border-color: #d7ded9;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f2f5f3;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #f8faf8;
}

.click-row {
  cursor: pointer;
}

.filters {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(150px, 0.6fr));
  gap: 10px;
  margin-bottom: 12px;
}

.detail-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

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

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

.number-tile {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-height: 82px;
}

.number-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.number-tile strong {
  display: block;
  margin-top: 5px;
  font-size: 1.1rem;
}

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

.info-item {
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.info-item span {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
}

.pipeline-list {
  display: grid;
  gap: 12px;
}

.pipeline-row {
  display: grid;
  gap: 6px;
}

.pipeline-row header {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.bar {
  height: 10px;
  background: #e7ece8;
  border-radius: 999px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  min-width: 4px;
  background: var(--green);
}

.budget-table input {
  width: 120px;
  min-height: 34px;
  padding: 6px 8px;
}

.task-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(230px, 1fr));
  gap: 12px;
  overflow: auto;
  padding-bottom: 4px;
}

.task-column {
  background: #f2f5f3;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 360px;
  padding: 10px;
}

.task-column h3 {
  margin: 2px 2px 10px;
  font-size: 0.92rem;
}

.task-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  margin-bottom: 9px;
  display: grid;
  gap: 8px;
}

.task-card strong {
  line-height: 1.25;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.doc-drop {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 14px;
  display: grid;
  gap: 10px;
}

.activity-list {
  display: grid;
}

.activity-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-time {
  color: var(--muted);
  font-size: 0.8rem;
}

.empty {
  padding: 20px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fbfcfb;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 33, 28, 0.38);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 20;
}

.modal {
  width: min(760px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.modal h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-body {
  padding: 16px;
}

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

.field-full {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

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

.kbd-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

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

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

  .dashboard-grid,
  .detail-shell,
  .split-grid,
  .three-grid {
    grid-template-columns: 1fr;
  }

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

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

  .login-panel {
    padding: 26px;
    border-right: 0;
  }

  .login-art {
    min-height: 260px;
    order: -1;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 10px;
  }

  .sidebar .brand,
  .user-chip {
    display: none;
  }

  .nav-list {
    display: flex;
    overflow: auto;
    padding-bottom: 2px;
  }

  .nav-btn {
    flex: 0 0 auto;
  }

  .main {
    padding: 16px;
  }

  .topbar {
    display: grid;
  }

  .toolbar {
    justify-content: flex-start;
    overflow: auto;
    padding-bottom: 2px;
  }

  .metrics-grid,
  .number-grid,
  .filters,
  .form-grid,
  .info-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .activity-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
