:root {
  color-scheme: light;
  --page: #f3f6f3;
  --surface: #ffffff;
  --surface-soft: #eef3ef;
  --surface-strong: #e4ece6;
  --text: #173b2e;
  --text-secondary: #607269;
  --text-muted: #8a9790;
  --brand: #2f604b;
  --brand-hover: #254f3d;
  --brand-soft: #e5eee7;
  --border: #dfe7e2;
  --danger: #9d4d45;
  --warning: #9b6d31;
  --shadow: 0 18px 48px rgba(24, 58, 44, 0.08);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

button, input, textarea { font: inherit; }
button { cursor: pointer; }

[hidden] { display: none !important; }

.login-layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.08fr) minmax(440px, 0.92fr);
  background: var(--surface);
}

.login-brand {
  position: relative;
  display: flex;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
  padding: 8vw;
  color: #f6fbf7;
  background: linear-gradient(145deg, #173e2f 0%, #285a45 58%, #3f705a 100%);
}

.login-brand::before,
.login-brand::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 50%;
}

.login-brand::before { width: 560px; height: 560px; right: -240px; top: -190px; }
.login-brand::after { width: 360px; height: 360px; right: -120px; top: -90px; }

.brand-mark {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  color: var(--brand);
  font-size: 30px;
  font-weight: 760;
  background: #eef8f0;
  border-radius: 22px;
  box-shadow: 0 16px 34px rgba(0,0,0,.12);
}

.brand-mark-small { width: 44px; height: 44px; font-size: 20px; border-radius: 14px; box-shadow: none; }
.brand-eyebrow, .card-eyebrow { margin: 26px 0 0; font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .72; }
.login-brand h1 { margin: 24px 0 0; font-size: clamp(46px, 5vw, 72px); line-height: 1.13; letter-spacing: -.04em; }
.brand-summary { max-width: 560px; margin: 28px 0 0; color: rgba(246,251,247,.73); font-size: 18px; line-height: 1.8; }
.security-note { align-self: flex-start; margin-top: 48px; padding: 12px 16px; color: rgba(255,255,255,.76); font-size: 13px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.13); border-radius: 14px; }

.login-panel { display: grid; place-items: center; padding: 56px; }
.login-card { width: min(420px, 100%); padding: 42px; background: var(--surface); border: 1px solid var(--border); border-radius: 28px; box-shadow: var(--shadow); }
.login-card .card-eyebrow { margin-top: 0; color: var(--brand); }
.login-card h2 { margin: 10px 0 0; font-size: 34px; }
.card-copy { margin: 10px 0 30px; color: var(--text-secondary); line-height: 1.6; }
.field-label { display: block; margin-bottom: 10px; font-size: 14px; font-weight: 650; }
.password-field { display: flex; align-items: center; min-height: 54px; padding: 0 12px 0 16px; border: 1px solid #cbd8d0; border-radius: 14px; transition: .18s ease; }
.password-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,96,75,.12); }
.password-field input { flex: 1; min-width: 0; height: 50px; color: var(--text); background: transparent; border: 0; outline: 0; }
.text-button, .icon-button { color: var(--brand); background: transparent; border: 0; }
.form-error { min-height: 22px; margin: 10px 0; color: var(--danger); font-size: 13px; }

.primary-action, .secondary-action, .logout-button, .sidebar-setting-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  font-weight: 680;
  border-radius: 13px;
  transition: .16s ease;
}

.primary-action { color: #fff; background: var(--brand); border: 1px solid var(--brand); }
.primary-action:hover { background: var(--brand-hover); }
.login-card .primary-action { width: 100%; min-height: 52px; }
.secondary-action { color: var(--brand); background: var(--surface); border: 1px solid #c8d6cd; }
.secondary-action:hover { background: var(--brand-soft); }
.full-width { width: 100%; }

.admin-layout { display: grid; min-height: 100vh; grid-template-columns: 252px minmax(0,1fr); }
.sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 26px 18px 20px; color: #eaf3ed; background: #143327; }
.sidebar-brand { display: flex; align-items: center; gap: 13px; padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand strong { font-size: 18px; }
.sidebar-brand span { margin-top: 4px; color: rgba(234,243,237,.58); font-size: 12px; }
.status-nav { display: flex; flex-direction: column; gap: 7px; margin-top: 24px; }
.status-nav-item { display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: space-between; padding: 0 14px; color: rgba(238,247,241,.7); background: transparent; border: 0; border-radius: 12px; text-align: left; }
.status-nav-item b { min-width: 27px; padding: 4px 7px; color: inherit; font-size: 11px; background: rgba(255,255,255,.08); border-radius: 9px; text-align: center; }
.status-nav-item:hover, .status-nav-item.is-active { color: #fff; background: rgba(255,255,255,.1); }
.sidebar-footer { margin-top: auto; padding: 18px 8px 0; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-footer p { margin: 0 0 12px; color: rgba(234,243,237,.52); font-size: 11px; line-height: 1.5; }
.sidebar-footer-actions { display: flex; flex-direction: column; gap: 8px; }
.sidebar-setting-button,
.logout-button { width: 100%; min-height: 40px; color: rgba(255,255,255,.75); background: transparent; border: 1px solid rgba(255,255,255,.18); }
.sidebar-setting-button:hover, .logout-button:hover { color: #fff; background: rgba(255,255,255,.08); }

.workspace { min-width: 0; padding: 42px clamp(24px, 4vw, 58px) 64px; }
.workspace-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.workspace-actions { display: flex; align-items: center; gap: 10px; }
.workspace-header .card-eyebrow { margin: 0; color: var(--brand); }
.workspace-header h1 { margin: 8px 0 0; font-size: 38px; letter-spacing: -.03em; }
.workspace-copy { margin: 8px 0 0; color: var(--text-muted); font-size: 13px; }
.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin-top: 30px; }
.metric-card { display: flex; min-height: 138px; flex-direction: column; padding: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 10px 30px rgba(26,60,46,.04); }
.metric-card-primary { background: linear-gradient(145deg,#295c46,#3e735b); border-color: transparent; color: #fff; }
.metric-card span { color: var(--text-secondary); font-size: 13px; }
.metric-card-primary span, .metric-card-primary small { color: rgba(255,255,255,.7); }
.metric-card strong { margin-top: 11px; font-size: 38px; line-height: 1; }
.metric-card small { margin-top: auto; color: var(--text-muted); }

.feedback-panel { margin-top: 22px; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: 0 12px 36px rgba(26,60,46,.04); }
.feedback-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 26px; border-bottom: 1px solid var(--border); }
.feedback-toolbar h2 { margin: 0; font-size: 20px; }
.feedback-toolbar p { margin: 6px 0 0; color: var(--text-muted); font-size: 12px; }
.search-field { display: flex; width: min(330px,45%); height: 44px; align-items: center; gap: 10px; padding: 0 14px; background: var(--surface-soft); border: 1px solid transparent; border-radius: 13px; }
.search-field span { color: var(--text-muted); font-size: 12px; }
.search-field input { flex: 1; min-width: 0; color: var(--text); background: transparent; border: 0; outline: 0; }
.table-wrap { width: 100%; overflow-x: auto; }
.feedback-table { width: 100%; border-collapse: collapse; }
.feedback-table th, .feedback-table td { padding: 17px 20px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.feedback-table th { color: var(--text-muted); font-size: 11px; font-weight: 650; letter-spacing: .04em; background: #fbfcfb; }
.feedback-table td { font-size: 13px; }
.feedback-table tbody tr { transition: .14s ease; }
.feedback-table tbody tr:hover { background: #f8faf8; }
.feedback-number { font-weight: 680; white-space: nowrap; }
.feedback-type { display: block; color: var(--brand); font-size: 12px; font-weight: 650; }
.feedback-preview { display: block; max-width: 450px; margin-top: 5px; overflow: hidden; color: var(--text-secondary); line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.row-action { color: var(--brand); font-weight: 650; background: transparent; border: 0; white-space: nowrap; }

.status-badge { display: inline-flex; min-height: 28px; align-items: center; padding: 0 10px; color: var(--text-secondary); font-size: 12px; font-weight: 680; background: var(--surface-soft); border-radius: 14px; white-space: nowrap; }
.status-submitted { color: #8d5a23; background: #f8ead8; }
.status-processing { color: #315a7a; background: #e3edf4; }
.status-replied { color: #2d684c; background: #e1efe6; }
.status-resolved { color: #647069; background: #edf0ee; }

.loading-state, .empty-state { display: flex; min-height: 320px; align-items: center; justify-content: center; flex-direction: column; padding: 50px; text-align: center; }
.loading-spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
.loading-state p, .empty-state p { color: var(--text-muted); }
.empty-state h3 { margin: 16px 0 0; }
.empty-icon { display: grid; width: 58px; height: 58px; place-items: center; color: var(--brand); font-size: 24px; font-weight: 750; background: var(--brand-soft); border-radius: 18px; }
.empty-state .secondary-action { margin-top: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

.detail-overlay { position: fixed; z-index: 50; inset: 0; }
.detail-backdrop { position: absolute; inset: 0; width: 100%; background: rgba(10,24,18,.48); border: 0; backdrop-filter: blur(2px); }
.detail-drawer { position: absolute; top: 0; right: 0; display: flex; width: min(620px,100%); height: 100%; flex-direction: column; background: var(--surface); box-shadow: -22px 0 60px rgba(15,43,31,.18); animation: drawer-in .2s ease-out; }
@keyframes drawer-in { from { transform: translateX(100%); } }
.detail-header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; padding: 25px 28px; border-bottom: 1px solid var(--border); }
.detail-header .card-eyebrow { margin: 0; color: var(--brand); }
.detail-header h2 { margin: 7px 0 0; }
.icon-button { display: grid; width: 42px; height: 42px; place-items: center; font-size: 28px; background: var(--surface-soft); border-radius: 13px; }
.detail-scroll { flex: 1; overflow-y: auto; padding: 24px 28px 48px; }
.detail-status-row { display: flex; align-items: center; justify-content: space-between; }
.detail-muted, .detail-meta { color: var(--text-muted); font-size: 12px; }
.detail-section { margin-top: 28px; }
.detail-section h3 { margin: 0 0 12px; font-size: 15px; }
.content-block, .reply-history { padding: 18px; color: var(--text-secondary); line-height: 1.75; white-space: pre-wrap; background: var(--surface-soft); border-radius: 16px; }
.supplement-list { display: flex; flex-direction: column; gap: 10px; }
.supplement-item { padding: 15px 17px; color: var(--text-secondary); line-height: 1.65; background: #fafbfa; border: 1px solid var(--border); border-radius: 14px; }
.supplement-item time { display: block; margin-top: 7px; color: var(--text-muted); font-size: 11px; }
.environment-list { display: grid; grid-template-columns: 140px 1fr; margin: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 15px; }
.environment-list dt, .environment-list dd { margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.environment-list dt { color: var(--text-muted); font-size: 12px; background: #fafbfa; }
.environment-list dd { color: var(--text-secondary); font-size: 12px; word-break: break-all; }
.environment-list dt:last-of-type, .environment-list dd:last-of-type { border-bottom: 0; }
.action-section { padding-top: 24px; border-top: 1px solid var(--border); }
.reply-form { margin-top: 18px; }
.reply-form label { display: block; margin-bottom: 10px; font-size: 13px; font-weight: 650; }
.reply-form textarea { width: 100%; padding: 15px; resize: vertical; color: var(--text); line-height: 1.65; border: 1px solid #cbd8d0; border-radius: 14px; outline: 0; }
.reply-form textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,96,75,.1); }
.reply-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 10px; }
.reply-footer span { color: var(--text-muted); font-size: 11px; }

.toast { position: fixed; z-index: 100; right: 24px; bottom: 24px; max-width: 360px; padding: 14px 18px; color: #fff; font-size: 13px; background: #183a2d; border-radius: 13px; box-shadow: 0 12px 34px rgba(0,0,0,.16); }

.password-overlay { position: fixed; z-index: 70; inset: 0; display: grid; place-items: center; padding: 24px; }
.password-backdrop { position: absolute; inset: 0; width: 100%; background: rgba(10,24,18,.5); border: 0; backdrop-filter: blur(3px); }
.password-dialog { position: relative; width: min(460px,100%); overflow: hidden; background: var(--surface); border-radius: 22px; box-shadow: 0 24px 70px rgba(12,40,28,.24); }
.password-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 26px; border-bottom: 1px solid var(--border); }
.password-dialog-header .card-eyebrow { margin: 0; color: var(--brand); }
.password-dialog-header h2 { margin: 6px 0 0; font-size: 22px; }
.password-dialog-form { padding: 24px 26px 26px; }
.password-dialog-form .field-label { margin-top: 18px; }
.password-hint { margin: 0; color: var(--text-secondary); font-size: 13px; line-height: 1.65; }
.password-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }

@media (max-width: 980px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { min-height: 42vh; padding: 64px 36px; }
  .login-brand h1 { font-size: 46px; }
  .login-panel { padding: 38px 22px; }
  .admin-layout { grid-template-columns: 82px minmax(0,1fr); }
  .sidebar { padding-right: 12px; padding-left: 12px; }
  .sidebar-brand { justify-content: center; padding-inline: 0; }
  .sidebar-brand > div:last-child, .status-nav-item span, .sidebar-footer p { display: none; }
  .status-nav-item { justify-content: center; padding: 0; }
  .sidebar-footer { padding-inline: 0; }
  .logout-button, .sidebar-setting-button { padding: 0 8px; font-size: 11px; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 680px) {
  .admin-layout { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 14px; }
  .sidebar-brand, .sidebar-footer { display: none; }
  .status-nav { flex-direction: row; overflow-x: auto; margin: 0; }
  .status-nav-item { flex: 0 0 auto; min-height: 42px; padding: 0 13px; }
  .status-nav-item span { display: block; }
  .workspace { padding: 24px 14px 48px; }
  .workspace-header { align-items: flex-start; }
  .workspace-actions { align-items: stretch; flex-direction: column; }
  .workspace-header h1 { font-size: 30px; }
  .metric-grid { gap: 10px; }
  .metric-card { min-height: 118px; padding: 17px; }
  .feedback-toolbar { align-items: flex-start; flex-direction: column; }
  .search-field { width: 100%; }
  .feedback-table th:nth-child(4), .feedback-table td:nth-child(4) { display: none; }
}
