:root {
  --ink: #18212f;
  --muted: #657184;
  --line: #dfe5ee;
  --panel: #ffffff;
  --bg: #f5f7fb;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #b45309;
  --danger: #b42318;
  --ok: #047857;
  --shadow: 0 18px 45px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.92), rgba(24, 33, 47, 0.85)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='800' viewBox='0 0 1200 800'%3E%3Crect width='1200' height='800' fill='%23d9e8e2'/%3E%3Cpath d='M0 620C220 520 360 650 560 550S880 320 1200 410v390H0z' fill='%23f2c879' opacity='.7'/%3E%3Cpath d='M0 270c180-80 350-40 520 30s370 90 680-80v580H0z' fill='%230f766e' opacity='.22'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
}

.login-panel {
  width: min(430px, 100%);
  padding: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.password-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(24, 33, 47, 0.58);
}

.password-panel {
  width: min(430px, 100%);
  padding: 28px;
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.password-panel h3 {
  margin: 0 0 8px;
  font-size: 24px;
}

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

.brand-mark {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 12px;
  color: white;
  background: var(--brand);
  border-radius: 4px;
  font-weight: 700;
}

.login-panel h1 {
  margin: 22px 0 8px;
  font-size: 30px;
}

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

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.primary-btn,
.ghost-btn,
.small-btn,
.danger-btn {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 650;
}

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

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

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

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

.form-tip {
  min-height: 20px;
  color: var(--danger);
}

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

.shell.no-project {
  grid-template-columns: minmax(0, 1fr);
}

.shell.no-project .sidebar {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
  color: white;
  background: #15212d;
}

.side-title {
  display: grid;
  gap: 4px;
  padding: 10px 10px 18px;
}

.side-title strong {
  font-size: 22px;
}

.side-title span {
  color: #b8c2d2;
  font-size: 13px;
}

nav {
  display: grid;
  gap: 14px;
  overflow-y: auto;
  max-height: calc(100vh - 110px);
  padding-right: 2px;
}

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

.nav-label {
  padding: 10px 10px 4px;
  color: #8795a8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
}

nav button {
  width: 100%;
  padding: 11px 12px;
  color: #d6deeb;
  text-align: left;
  border: 0;
  border-radius: 6px;
  background: transparent;
}

nav button.active,
nav button:hover {
  color: white;
  background: rgba(255, 255, 255, 0.12);
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  background: rgba(245, 247, 251, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar h2 {
  margin: 0 0 4px;
  font-size: 24px;
}

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

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.content {
  padding: 24px;
}

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

.metric {
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 10px 22px rgba(16, 24, 40, 0.04);
}

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

.metric strong {
  display: block;
  margin-top: 12px;
  font-size: 26px;
}

.panel {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

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

.panel-title h3 {
  margin: 0;
  font-size: 18px;
}

.overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.overview-head h3 {
  margin: 0 0 6px;
  font-size: 22px;
}

.overview-head p {
  margin: 0;
  color: var(--muted);
}

.section-label {
  margin: 18px 0 10px;
  color: #344054;
  font-weight: 800;
}

.filters,
.editor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

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

th {
  color: #42526b;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 700;
}

td input,
td select {
  min-width: 110px;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.status {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--ok);
  background: #ecfdf3;
  font-size: 12px;
  font-weight: 700;
}

.status.off {
  color: #7a271a;
  background: #fef3f2;
}

.lock-state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 14px;
  color: var(--muted);
}

.muted-note {
  margin: -2px 0 16px;
  color: var(--muted);
}

.sub-panel {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.paste-panel {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.paste-panel textarea {
  min-height: 150px;
  margin-bottom: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.daily-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
}

.daily-title h3 {
  margin: 0;
  font-size: 24px;
}

.daily-title p {
  margin: 0;
  color: var(--muted);
}

.daily-block {
  margin-top: 18px;
}

.daily-legion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  color: white;
  background: var(--brand);
  border-radius: 6px 6px 0 0;
}

.daily-legion span {
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
}

.daily-block .table-wrap {
  border-top: 0;
  border-radius: 0 0 8px 8px;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

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

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

  nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    max-height: none;
    overflow: visible;
  }

  .nav-group {
    align-content: start;
  }

  .nav-label {
    padding: 4px 0;
    text-align: center;
  }

  nav button {
    text-align: center;
  }

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

  .cards,
  .filters,
  .editor-grid,
  .split {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 14px;
  }
}

@media print {
  .sidebar,
  .topbar,
  .filters,
  .panel-title button,
  .panel-title,
  .row-actions {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .shell {
    display: block;
  }

  .content {
    padding: 0;
  }

  .cards {
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
  }

  .panel,
  .metric {
    box-shadow: none;
    border-color: #999;
    break-inside: avoid;
  }

  .panel {
    border: 0;
    padding: 0;
  }

  .metric {
    min-height: auto;
    padding: 10px;
  }

  .metric strong {
    font-size: 18px;
  }

  .daily-title {
    margin-top: 0;
  }

  .daily-block {
    break-inside: avoid;
  }

  th,
  td {
    padding: 6px 8px;
    font-size: 11px;
  }
}
