:root {
  color-scheme: light;
  --bg: #f4f2ed;
  --panel: #fffdfa;
  --panel-strong: #171717;
  --ink: #191817;
  --muted: #706b63;
  --line: #ded8ce;
  --line-strong: #b9b1a6;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --accent-soft: #d7f1ec;
  --warn: #b45309;
  --danger: #b42318;
  --danger-soft: #ffe4df;
  --ok: #166534;
  --ok-soft: #dcfce7;
  --disabled: #8a8175;
  --shadow: 0 18px 45px rgba(39, 33, 24, 0.12);
  font-family: "Aptos", "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 34%),
    linear-gradient(45deg, rgba(180, 83, 9, 0.08), transparent 42%),
    var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

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

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

.login-panel {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 18px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--accent-soft);
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 22px;
  line-height: 1.25;
}

h3 {
  font-size: 17px;
  line-height: 1.35;
}

.muted {
  color: var(--muted);
}

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

.sidebar {
  background: #181612;
  color: #f8f3ea;
  padding: 22px 16px;
  border-right: 1px solid #2f2b24;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 4px 6px 20px;
}

.sidebar .brand-mark {
  width: 38px;
  height: 38px;
  margin: 0;
  color: var(--ink);
}

.sidebar-title {
  font-weight: 800;
  line-height: 1.15;
}

.sidebar-subtitle {
  margin-top: 3px;
  color: #bfb6a7;
  font-size: 12px;
}

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

.nav button {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #efe8dd;
  text-align: left;
  padding: 9px 10px;
}

.nav button:hover,
.nav button.active {
  background: #2b261f;
}

.nav button.active {
  color: #ffffff;
  box-shadow: inset 3px 0 0 var(--accent-soft);
}

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

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

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

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

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(39, 33, 24, 0.07);
}

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

.panel-body {
  padding: 16px;
}

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

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.stat-value {
  margin-top: 8px;
  font-size: 30px;
  font-weight: 800;
}

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

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

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

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

label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 8px 10px;
  outline: none;
}

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

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

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

.btn {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 8px 12px;
  font-weight: 700;
}

.btn:hover {
  border-color: var(--ink);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

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

.btn.danger {
  border-color: #f2b8b5;
  background: var(--danger-soft);
  color: var(--danger);
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tabs {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  overflow: hidden;
  background: #ffffff;
}

.tabs button {
  min-height: 34px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  padding: 7px 11px;
}

.tabs button:last-child {
  border-right: 0;
}

.tabs button.active {
  background: var(--ink);
  color: #ffffff;
}

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

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

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

th {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

td {
  font-size: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  background: #ece6dc;
  color: #4b4137;
  white-space: nowrap;
}

.pill.active,
.pill.approved,
.pill.cook {
  background: var(--ok-soft);
  color: var(--ok);
}

.pill.pending,
.pill.member {
  background: #fef3c7;
  color: var(--warn);
}

.pill.disabled,
.pill.removed,
.pill.rejected {
  background: #e7e5e4;
  color: var(--disabled);
}

.pill.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.notice {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 7px;
  background: #ffffff;
  padding: 12px;
  color: var(--muted);
}

.notice.error {
  border-left-color: var(--danger);
  color: var(--danger);
  background: #fff8f6;
}

.notice.success {
  border-left-color: var(--ok);
  color: var(--ok);
  background: #f5fff7;
}

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

.checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.check-item {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 8px 10px;
}

.check-item input {
  width: auto;
  min-height: auto;
}

.tag-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.kbd {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 1px 6px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
}

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

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

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

  .split-grid,
  .stat-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main {
    padding: 16px;
  }

  .login-panel {
    padding: 20px;
  }

  .topbar {
    display: grid;
  }

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