:root {
  --bg: #f4f7f2;
  --surface: #ffffff;
  --surface-soft: #f8faf7;
  --text: #18221d;
  --muted: #667066;
  --line: #dfe7dc;
  --primary: #266a4c;
  --primary-strong: #1d523b;
  --blue: #2d6cdf;
  --green: #2c9a60;
  --red: #c94d55;
  --amber: #b7791f;
  --shadow: 0 18px 45px rgba(28, 48, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(241, 246, 237, 0.94), rgba(232, 240, 236, 0.9)),
    url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23d5dfd2' stroke-width='1'%3E%3Cpath d='M0 30h120M0 90h120M30 0v120M90 0v120'/%3E%3C/g%3E%3C/svg%3E");
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC",
    "Helvetica Neue", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
a.link-btn {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: 0.18s ease;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(38, 106, 76, 0.14);
}

label {
  display: grid;
  gap: 7px;
  color: #3c463e;
  font-size: 14px;
  font-weight: 650;
}

.hidden {
  display: none !important;
}

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

.login-panel {
  width: min(920px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 36px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  padding: 54px;
  background:
    linear-gradient(140deg, rgba(255,255,255,0.94), rgba(255,255,255,0.74)),
    linear-gradient(45deg, rgba(38, 106, 76, 0.13), rgba(45, 108, 223, 0.08));
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin: 10px 0 18px;
  font-size: clamp(32px, 6vw, 56px);
  line-height: 1.08;
  letter-spacing: 0;
}

.login-form {
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.message {
  margin: 0;
  min-height: 22px;
  color: var(--primary);
  font-size: 14px;
}

.message.error {
  color: var(--red);
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px;
  color: #eef8f1;
  background: #163726;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #123623;
  background: #d7f4df;
  font-weight: 900;
}

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

.brand small,
.account-box small {
  color: rgba(238, 248, 241, 0.72);
}

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

.nav-item {
  justify-content: flex-start;
  width: 100%;
  color: rgba(238, 248, 241, 0.78);
  background: transparent;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.account-box {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

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

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

.secondary-btn {
  color: var(--primary);
  border: 1px solid rgba(38, 106, 76, 0.28);
  background: #eef8f1;
}

.secondary-btn:hover {
  background: #e2f2e8;
}

.ghost-btn {
  color: inherit;
  border: 1px solid rgba(102, 112, 102, 0.28);
  background: transparent;
}

.sidebar .ghost-btn {
  color: #eef8f1;
  border-color: rgba(255, 255, 255, 0.22);
}

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

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

.topbar h2 {
  margin: 4px 0 0;
  font-size: 30px;
  letter-spacing: 0;
}

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

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

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

.stat-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 14px 35px rgba(28, 48, 36, 0.08);
}

.stat-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--primary);
}

.stat-card span,
.stat-card small {
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: clamp(24px, 4vw, 36px);
  letter-spacing: 0;
}

.accent-green::before { background: var(--green); }
.accent-blue::before { background: var(--blue); }
.accent-red::before { background: var(--red); }
.accent-amber::before { background: var(--amber); }

.daily-panel {
  padding-bottom: 16px;
}

.daily-list {
  display: grid;
  grid-template-columns: repeat(14, minmax(48px, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 126px;
}

.daily-item {
  display: grid;
  justify-items: center;
  align-items: end;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.daily-item strong {
  color: var(--text);
  font-size: 15px;
}

.daily-bar {
  width: 100%;
  max-width: 28px;
  min-height: 8px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--blue), var(--primary));
}

.compact-empty {
  grid-column: 1 / -1;
  align-self: center;
}

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

.panel {
  padding: 18px;
}

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

.panel-head h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  color: var(--primary);
  background: #eef8f1;
  font-size: 12px;
  font-weight: 700;
}

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

.summary-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.summary-item strong {
  font-size: 15px;
}

.summary-item small {
  color: var(--muted);
}

.bar {
  grid-column: 1 / -1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eee6;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--blue));
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(5, minmax(130px, 1fr)) auto;
  gap: 10px;
  margin-bottom: 14px;
}

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

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #4a554c;
  background: #f3f7f1;
  font-size: 13px;
  white-space: nowrap;
}

td {
  color: #26312a;
}

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

.title-cell {
  max-width: 340px;
  line-height: 1.45;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.status.done {
  color: #1b6845;
  background: #e4f6ea;
}

.status.todo {
  color: #9f323b;
  background: #fdecef;
}

.status-toggle {
  border: 0;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.status-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(38, 49, 42, 0.12);
}

.status-toggle:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

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

.row-actions button {
  min-height: 32px;
  padding: 0 10px;
}

.password-note {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--muted);
  font-size: 12px;
}

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

.recognizer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.recognizer-field textarea {
  width: 100%;
  min-height: 82px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.recognizer-field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(38, 106, 76, 0.14);
}

.recognizer-actions {
  display: grid;
  gap: 8px;
  min-width: 180px;
}

.wide {
  grid-column: span 2;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 26px;
}

.check-field input {
  width: 18px;
  min-height: 18px;
}

.form-actions {
  display: flex;
  gap: 14px;
  align-items: center;
}

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

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

@media (max-width: 1180px) {
  .stat-grid,
  .panel-row,
  .order-form,
  .user-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .daily-list {
    grid-template-columns: repeat(7, minmax(44px, 1fr));
  }

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

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

  .login-panel {
    padding: 28px;
  }

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

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

  .nav-item {
    justify-content: center;
    padding: 0 10px;
  }

  .main {
    padding: 20px;
  }

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

  .top-actions {
    justify-content: stretch;
  }

  .top-actions > * {
    flex: 1;
  }

  .stat-grid,
  .panel-row,
  .order-form,
  .user-form,
  .filter-bar,
  .recognizer {
    grid-template-columns: 1fr;
  }

  .daily-list {
    overflow-x: auto;
    grid-template-columns: repeat(14, minmax(44px, 1fr));
  }

  .wide {
    grid-column: auto;
  }
}
