:root {
  --bg: #eef6f2;
  --panel: #ffffff;
  --ink: #0b2b25;
  --muted: #6b867d;
  --soft: #dcece6;
  --line: #d6e5df;
  --green: #0f8f7c;
  --green-strong: #087566;
  --mint: #e6f7f1;
  --red: #d94a5f;
  --amber: #c88312;
  --shadow: 0 12px 28px rgba(24, 88, 74, 0.08);
}

* { box-sizing: border-box; }

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

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

button { cursor: pointer; }

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  background: #073f36;
  color: #fff;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 22px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #dff8ed;
  color: #073f36;
  font-weight: 900;
  font-size: 22px;
}

.brand-title { font-size: 18px; font-weight: 850; }
.brand-sub { margin-top: 3px; font-size: 12px; color: rgba(255,255,255,0.62); }

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.72);
  background: transparent;
  text-align: left;
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active { background: #e9fff6; color: #073f36; font-weight: 800; }
.nav-ico { width: 22px; text-align: center; font-weight: 900; }

.sidebar-foot {
  margin-top: auto;
  padding: 14px 8px 0;
}

.config-row {
  display: grid;
  margin-top: 8px;
  margin-bottom: 12px;
}

.config-row-save {
  grid-template-columns: 1fr 36px;
  gap: 8px;
  margin-bottom: 0;
}

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

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

.page-kicker {
  color: var(--green);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.06em;
}

h1 {
  margin: 4px 0 0;
  font-size: 30px;
  line-height: 1.2;
}

h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.35;
}

p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.health-pill {
  min-width: 74px;
  height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #7f5b0c;
  background: #fff5d8;
  border: 1px solid #f0d99b;
}

.admin-user-pill {
  min-width: 86px;
  height: 34px;
  border-radius: 999px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #076456;
  background: #dff8ed;
  border: 1px solid #bce6d6;
  font-size: 13px;
  font-weight: 800;
}

.health-pill.ok {
  color: #076456;
  background: #dff8ed;
  border-color: #bce6d6;
}

.btn,
.icon-btn {
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
}

.btn {
  height: 38px;
  padding: 0 14px;
}

.btn-xs {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-primary {
  background: var(--green);
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 143, 124, 0.24);
}

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

.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-secondary:hover { background: var(--mint); }
.btn-danger { background: #fff1f3; color: #ad2238; border: 1px solid #f2c3cb; }
.btn-warning { background: #fff5df; color: #915d00; border: 1px solid #edd1a2; }
.btn:disabled { opacity: 0.48; cursor: not-allowed; }

.icon-btn {
  height: 36px;
  width: 36px;
  background: #e9fff6;
  color: #073f36;
}

.input,
.select {
  height: 38px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.input:focus,
.select:focus {
  border-color: rgba(15,143,124,0.72);
  box-shadow: 0 0 0 3px rgba(15,143,124,0.12);
}

.input-sm {
  height: 36px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-color: rgba(255,255,255,0.18);
}

.table-input,
.table-select {
  width: 100%;
  min-width: 112px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 9px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.table-input:focus,
.table-select:focus {
  border-color: rgba(15,143,124,0.72);
  box-shadow: 0 0 0 3px rgba(15,143,124,0.1);
}

.toggle-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 7px;
}

.sidebar .field-label { color: rgba(255,255,255,0.66); }

.view { display: none; }
.view.active { display: block; }

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

.metric-card,
.panel {
  background: var(--panel);
  border: 1px solid rgba(15, 143, 124, 0.08);
  box-shadow: var(--shadow);
}

.metric-card {
  min-height: 118px;
  padding: 18px;
  border-radius: 8px;
}

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

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 34px;
  letter-spacing: 0;
}

.metric-card small { color: #8aa199; }

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

.two-col-form {
  grid-template-columns: minmax(320px, 0.8fr) minmax(0, 1.2fr);
  margin-bottom: 16px;
}

.panel {
  border-radius: 8px;
  padding: 18px;
  min-width: 0;
}

.panel + .panel { margin-top: 16px; }

.compliance-banner {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #7a5710;
  background: #fff8e8;
  border: 1px solid rgba(200, 131, 18, 0.24);
  font-size: 13px;
  line-height: 1.55;
}

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

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

.split-view {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.18fr);
  gap: 16px;
}

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

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

.salon-column {
  min-width: 0;
}

.column-head {
  height: 34px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-weight: 900;
}

.column-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.list-card,
.todo-item,
.post-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
}

.list-card {
  padding: 13px;
}

.list-card.active {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15,143,124,0.1);
}

.list-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.list-title {
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-meta {
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.badge {
  height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
  color: #076456;
  background: #def7ed;
}

.badge.warn { color: #8a5a02; background: #fff1cd; }
.badge.danger { color: #a32337; background: #ffe1e6; }
.badge.gray { color: #64736f; background: #eef2f0; }

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

.todo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 13px;
}

.todo-title { font-weight: 800; }
.todo-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }

.panel-note {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: 999px;
  background: #edf6f2;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.chat-box {
  min-height: 440px;
  max-height: 62vh;
  overflow: auto;
  background: #edf6f2;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.reply-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 12px;
}

.chat-box-tall {
  min-height: 360px;
}

.msg {
  max-width: 76%;
  margin-bottom: 11px;
}

.msg.self { margin-left: auto; }

.msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.msg-name {
  color: var(--muted);
  font-size: 12px;
  min-width: 0;
}

.link-danger {
  border: 0;
  background: transparent;
  color: #dc2626;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  padding: 2px 0;
  white-space: nowrap;
}

.link-danger:hover { color: #991b1b; }

.msg-bubble {
  display: inline-block;
  border-radius: 8px;
  padding: 9px 12px;
  line-height: 1.55;
  font-size: 14px;
  background: #fff;
  border: 1px solid rgba(15,143,124,0.08);
}

.msg.self .msg-bubble {
  background: #c9f6d2;
  border-color: #b0eabe;
}

.msg-plan {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #076456;
  background: #def7ed;
  font-size: 13px;
  line-height: 1.5;
}

.msg-disclaimer {
  margin-top: 5px;
  color: #8aa199;
  font-size: 12px;
  line-height: 1.45;
}

.empty {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
  padding: 32px 12px;
}

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

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

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

th {
  position: sticky;
  top: 0;
  background: #f7fbf9;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.03em;
}

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

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

.community-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
  gap: 16px;
  align-items: start;
}

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

.post-card {
  padding: 14px;
  min-height: 210px;
  display: flex;
  flex-direction: column;
}

.post-card.active {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15,143,124,0.1);
}

.post-title {
  margin-top: 10px;
  font-weight: 900;
  line-height: 1.35;
}

.post-content {
  margin-top: 8px;
  color: #395851;
  font-size: 14px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-foot {
  margin-top: auto;
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.comment-admin-panel {
  position: sticky;
  top: 24px;
}

.comment-admin-list {
  max-height: calc(100vh - 190px);
  overflow: auto;
  display: grid;
  gap: 10px;
  padding-right: 2px;
}

.comment-admin-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.comment-admin-item.is-reply {
  margin-left: 24px;
  background: #f7fbf9;
}

.comment-admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.comment-admin-author {
  font-size: 13px;
  font-weight: 850;
  color: var(--ink);
  line-height: 1.35;
  word-break: break-all;
}

.comment-admin-meta,
.comment-admin-stats {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.comment-admin-content {
  margin-top: 10px;
  color: #274b44;
  font-size: 14px;
  line-height: 1.58;
  white-space: pre-wrap;
  word-break: break-word;
}

.search-input { max-width: 280px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%) translateY(20px);
  min-width: 260px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 14px 18px;
  border-radius: 8px;
  background: #062f29;
  color: #fff;
  text-align: center;
  box-shadow: 0 18px 42px rgba(0,0,0,0.34);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 90;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
  word-break: break-word;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 63, 54, 0.72);
  backdrop-filter: blur(8px);
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 15px;
  padding: 28px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
}

.login-card h2 {
  font-size: 24px;
}

.login-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #073f36;
  background: #dff8ed;
  font-size: 24px;
  font-weight: 900;
}

.login-submit {
  width: 100%;
  margin-top: 2px;
}

.login-foot {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 1100px) {
  .admin-shell { grid-template-columns: 88px 1fr; }
  .brand div:not(.brand-mark),
  .nav-item span:last-child,
  .sidebar-foot { display: none; }
  .nav-item { justify-content: center; }
  .metric-grid,
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col,
  .two-col-form,
  .split-view,
  .community-layout,
  .salon-columns { grid-template-columns: 1fr; }
  .comment-admin-panel { position: static; }
}

@media (max-width: 720px) {
  .admin-shell { display: block; }
  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
  }
  .brand { padding-bottom: 10px; }
  .brand div:not(.brand-mark),
  .nav-item span:last-child { display: block; }
  .nav-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .nav-item { justify-content: flex-start; }
  .workspace { padding: 18px 14px 28px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .metric-grid,
  .post-grid,
  .community-layout .post-grid { grid-template-columns: 1fr; }
  .panel-head { flex-direction: column; }
}
