:root {
  --bg: #f7f7f4;
  --panel: #ffffff;
  --panel-soft: #f0f4ef;
  --text: #1f2523;
  --muted: #66706b;
  --faint: #8b948f;
  --line: #dfe4df;
  --line-strong: #cbd3cc;
  --green: #2f7d55;
  --green-soft: #e2f2e7;
  --blue: #3268a8;
  --blue-soft: #e2ebf7;
  --amber: #a46420;
  --amber-soft: #f4ead7;
  --red: #ad3f3f;
  --red-soft: #f4e0df;
  --ink: #111514;
  --shadow: 0 18px 44px rgba(26, 35, 31, 0.08);
  --radius: 8px;
  --radius-sm: 6px;
  --sidebar: 276px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(47, 125, 85, 0.07), transparent 280px),
    var(--bg);
  letter-spacing: 0;
}

.is-hidden {
  display: none !important;
}

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

button {
  cursor: pointer;
}

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

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-panel {
  width: min(420px, 100%);
  padding: 24px;
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.login-brand {
  padding: 0 0 10px;
}

.login-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 740;
}

.login-panel input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  outline: none;
}

.login-panel input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 125, 85, 0.14);
}

.login-button {
  width: 100%;
  margin-top: 4px;
}

.login-message {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.74);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 4px 6px 18px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: #ffffff;
  background: linear-gradient(135deg, #1f2523, #2f7d55);
  font-weight: 800;
  font-size: 15px;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.2;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.nav-item {
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 14px;
  font-weight: 650;
}

.nav-item svg,
.icon-button svg,
.primary-button svg,
.secondary-button svg,
.tiny-button svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  flex: 0 0 auto;
}

.nav-item:hover {
  color: var(--text);
  background: rgba(47, 125, 85, 0.08);
}

.nav-item.is-active {
  color: var(--ink);
  border-color: var(--line);
  background: var(--panel);
  box-shadow: 0 8px 18px rgba(31, 37, 35, 0.06);
}

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

.mini-stat {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
}

.mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.mini-stat strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
}

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

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.date-line {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 5px;
}

.sync-line {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.sync-line.is-error {
  color: var(--red);
}

.sync-line.is-ok {
  color: var(--green);
}

.topbar h2 {
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.05;
  font-weight: 850;
}

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

.user-chip {
  min-height: 42px;
  max-width: 220px;
  padding: 7px 10px;
  display: grid;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
}

.user-chip strong {
  display: block;
  font-size: 13px;
}

.icon-button,
.primary-button,
.secondary-button,
.tiny-button {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 720;
  white-space: nowrap;
}

.icon-button {
  width: 42px;
  height: 42px;
}

.primary-button {
  min-height: 42px;
  padding: 0 14px;
  color: #ffffff;
  border-color: #1f6244;
  background: #2f7d55;
}

.secondary-button {
  min-height: 38px;
  padding: 0 12px;
}

.tiny-button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.icon-button:hover,
.secondary-button:hover,
.tiny-button:hover {
  border-color: var(--line-strong);
  background: #f9faf8;
}

.primary-button:hover {
  background: #286b49;
}

.ghost {
  background: transparent;
}

.file-trigger input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

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

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

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

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

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 24px rgba(24, 32, 28, 0.05);
}

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

.panel-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.panel-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel-body {
  padding: 16px;
}

.metric {
  min-height: 136px;
  padding: 16px;
  display: grid;
  align-content: space-between;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(24px, 4vw, 36px);
  line-height: 1;
}

.metric small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

.progress-track {
  height: 8px;
  border-radius: 99px;
  background: #e7ebe6;
  overflow: hidden;
  margin-top: 14px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.8fr);
  gap: 14px;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar .search,
.toolbar select,
.toolbar input {
  min-height: 38px;
}

.search,
.field,
.toolbar select,
.toolbar input,
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text);
  padding: 9px 10px;
  outline: none;
  font-size: 14px;
}

.search:focus,
.field:focus,
.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 125, 85, 0.14);
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

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

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

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  background: #fbfcfa;
  position: sticky;
  top: 0;
  z-index: 1;
}

td strong {
  display: block;
  font-size: 13px;
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.status,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.status.todo,
.status.active,
.tag.neutral {
  color: var(--blue);
  background: var(--blue-soft);
}

.status.doing,
.status.warm,
.tag.warning {
  color: var(--amber);
  background: var(--amber-soft);
}

.status.done,
.status.won,
.tag.good {
  color: var(--green);
  background: var(--green-soft);
}

.status.blocked,
.status.lost,
.tag.bad {
  color: var(--red);
  background: var(--red-soft);
}

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

.task-column {
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.task-column h3 {
  margin: 0;
  padding: 13px;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}

.task-list {
  padding: 10px;
  display: grid;
  gap: 10px;
}

.task-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.task-card h4 {
  margin: 0;
  font-size: 14px;
  line-height: 1.35;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.task-progress {
  display: grid;
  gap: 8px;
}

.task-progress input {
  accent-color: var(--green);
}

.goal-timeline {
  display: grid;
  gap: 10px;
}

.goal-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 132px;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.goal-row h3 {
  margin: 0;
  font-size: 15px;
}

.goal-row p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.calendar-shell {
  display: grid;
  gap: 12px;
}

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

.calendar-head h3 {
  margin: 0;
  font-size: 20px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.weekday,
.day-cell {
  min-width: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.weekday:nth-child(7n),
.day-cell:nth-child(7n) {
  border-right: 0;
}

.weekday {
  padding: 10px 8px;
  color: var(--muted);
  background: #fbfcfa;
  font-size: 12px;
  font-weight: 780;
  text-align: center;
}

.day-cell {
  min-height: 138px;
  padding: 8px;
  display: grid;
  align-content: start;
  gap: 6px;
}

.day-cell.is-muted {
  background: #fafaf8;
  color: var(--faint);
}

.day-cell.is-today {
  box-shadow: inset 0 0 0 2px rgba(47, 125, 85, 0.42);
}

.day-top {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
}

.event-chip {
  min-height: 22px;
  padding: 4px 6px;
  border-left: 3px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #f4f6f3;
  color: var(--text);
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
}

.event-chip.fixed {
  border-color: var(--blue);
}

.event-chip.sales {
  border-color: var(--green);
}

.event-chip.delivery {
  border-color: var(--amber);
}

.event-chip.milestone {
  border-color: var(--red);
}

.event-chip.custom {
  border-color: #6d5aa8;
}

.event-more {
  color: var(--muted);
  font-size: 11px;
}

.note-list,
.review-list,
.focus-list {
  display: grid;
  gap: 10px;
}

.note-item,
.review-item,
.focus-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.note-item h4,
.review-item h4,
.focus-item h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.note-item p,
.review-item p,
.focus-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

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

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

.form-grid textarea {
  min-height: 96px;
  resize: vertical;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 6px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(17, 21, 20, 0.38);
  z-index: 100;
}

.modal.is-open {
  display: flex;
}

.modal-panel {
  width: min(760px, 100%);
  max-height: min(820px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 62px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: var(--radius);
  color: #ffffff;
  background: #1f2523;
  box-shadow: var(--shadow);
  transform: translateY(24px);
  opacity: 0;
  pointer-events: none;
  transition: 160ms ease;
  z-index: 120;
  font-size: 13px;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.58);
}

.risk-box {
  padding: 14px;
  border: 1px solid #ead2ba;
  border-radius: var(--radius);
  background: #fff8ed;
  color: #5c3b19;
  font-size: 13px;
  line-height: 1.65;
}

.number-input {
  max-width: 130px;
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .sidebar-footer {
    display: none;
  }

  .split-layout,
  .grid.cols-4,
  .grid.cols-3,
  .grid.cols-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .workspace {
    padding: 16px;
  }

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

  .top-actions {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .brand {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

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

  .nav-item {
    min-width: 118px;
  }

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

  .weekday {
    display: none;
  }

  .day-cell {
    min-height: 112px;
    border-right: 0;
  }

  .day-cell.is-muted {
    display: none;
  }

  .goal-row {
    grid-template-columns: 1fr;
  }

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