:root {
  --c-bg: #f4efec;
  --c-bg-deep: #e5dcd8;
  --c-surface: rgba(255, 255, 255, 0.84);
  --c-surface-strong: rgba(255, 255, 255, 0.94);
  --c-surface-soft: #faf6f3;
  --c-accent: #f25822;
  --c-accent-dark: #d35615;
  --c-accent-glow: rgba(242, 88, 34, 0.1);
  --c-gold: #b19c7d;
  --c-gold-soft: rgba(177, 156, 125, 0.14);
  --c-text: #323232;
  --c-text-2: #5a4c43;
  --c-text-3: #7d5d50;
  --c-text-4: #aa9489;
  --c-border: rgba(125, 93, 80, 0.09);
  --c-border-strong: rgba(125, 93, 80, 0.18);
  --c-shadow-lg: 0 18px 40px rgba(70, 44, 28, 0.08);
  --c-shadow-md: 0 8px 20px rgba(70, 44, 28, 0.07);
  --c-shadow-sm: 0 2px 8px rgba(70, 44, 28, 0.05);
  --c-r-sm: 8px;
  --c-r: 12px;
  --c-r-lg: 16px;
  --c-max: 1180px;
  --c-content-max: 900px;
  --c-font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --c-font-serif: "Noto Serif SC", "PingFang SC", "Microsoft YaHei", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  font-family: var(--c-font-sans);
  font-size: 15px;
  color: var(--c-text);
  background: #f7f5f3;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

/* ── LOGIN ─────────────────────────────────────────────────────────── */

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

.c-login-shell {
  width: 100%;
  max-width: 460px;
}

.c-login-panel {
  padding: 40px 36px 34px;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #ffffff;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04), 0 20px 40px rgba(0, 0, 0, 0.06);
}

.c-login-header {
  margin-bottom: 26px;
  display: grid;
  justify-items: center;
  gap: 14px;
}

.c-login-title {
  font-family: var(--c-font-serif);
  font-size: 40px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--c-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.c-title-suffix {
  font-size: 0.58em;
  line-height: 1;
}

.c-login-accent {
  width: 72px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(242, 88, 34, 0.18), rgba(242, 88, 34, 0.72), rgba(242, 88, 34, 0.18));
}

.c-login-form-area {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.c-lr-form {
  display: grid;
  gap: 20px;
}

.c-field {
  display: grid;
  gap: 8px;
}

.c-field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-2);
}

.c-input {
  width: 100%;
  min-height: 54px;
  padding: 0 18px;
  border-radius: 18px;
  border: 1px solid rgba(177, 156, 125, 0.2);
  background: #fffaf6;
  color: var(--c-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.c-input::placeholder {
  color: #b4a094;
}

.c-input:focus {
  outline: none;
  border-color: rgba(242, 88, 34, 0.3);
  box-shadow: 0 0 0 4px rgba(242, 88, 34, 0.07);
}

.c-input:-webkit-autofill,
.c-input:-webkit-autofill:hover,
.c-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--c-text);
  -webkit-box-shadow: 0 0 0 1000px #fffaf6 inset;
  transition: background-color 9999s ease-out 0s;
}

.c-btn-login {
  min-height: 54px;
  margin-top: 4px;
  border: 0;
  border-radius: 18px;
  color: #fff;
  background: var(--c-accent);
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.08em;
  transition: transform 0.2s, opacity 0.2s, background 0.2s;
}

.c-btn-login:hover {
  transform: translateY(-1px);
  background: var(--c-accent-dark);
}

.c-btn-login:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.c-message {
  min-height: 20px;
  margin-top: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--c-accent-dark);
}

.c-message.is-error {
  color: #a44732;
}

/* ── TOPBAR ─────────────────────────────────────────────────────────── */

.c-main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.c-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 60px;
  background: rgba(247, 245, 243, 0.94);
  backdrop-filter: blur(16px) saturate(1.5);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.04);
}

.c-topbar-inner {
  height: 100%;
  max-width: var(--c-max);
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.c-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.c-brand-title {
  font-family: var(--c-font-serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--c-accent);
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
  line-height: 1;
}

.c-brand-title .c-title-suffix {
  font-size: 0.68em;
}

.c-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 12px 0 8px;
  border: 1px solid var(--c-border-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--c-text-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
  flex-shrink: 0;
}

.c-back-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.c-back-btn:hover {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(242, 88, 34, 0.2);
  color: var(--c-accent);
  transform: translateX(-1px);
}

.c-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ── USER CHIP ──────────────────────────────────────────────────────── */

.c-admin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--c-border-strong);
  background: rgba(255, 255, 255, 0.65);
  color: var(--c-text-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: transform 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
}

.c-admin-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(242, 88, 34, 0.2);
  color: var(--c-accent);
}

.c-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 3px 4px 3px 4px;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
}

.c-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--c-accent);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.c-avatar.is-admin {
  cursor: pointer;
}

.c-avatar.is-admin:hover {
  opacity: 0.86;
}

.c-user-label {
  color: var(--c-text-2);
  font-size: 14px;
}

.c-btn-out {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--c-text-3);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}

.c-btn-out:hover {
  color: var(--c-accent-dark);
  background: rgba(242, 88, 34, 0.08);
}

.c-btn-out svg {
  width: 17px;
  height: 17px;
}

/* ── PAGE CONTENT ───────────────────────────────────────────────────── */

.c-page {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.c-page-inner {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  flex-direction: column;
}

/* ── PORTAL VIEW ────────────────────────────────────────────────────── */

.c-portal-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
}

.c-portal-title {
  width: min(540px, 100%);
  font-size: 15px;
  font-weight: 600;
  color: #374151;
  letter-spacing: 0.01em;
  margin-bottom: 16px;
  text-align: left;
}

.c-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: min(540px, 100%);
}

.c-entry-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px;
  min-height: 200px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.07);
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.03);
  text-decoration: none;
  color: var(--c-text);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

button.c-entry-card {
  width: 100%;
  appearance: none;
  text-align: left;
}

.c-entry-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.09), 0 2px 6px rgba(0, 0, 0, 0.04);
  border-color: rgba(242, 88, 34, 0.18);
}

.c-entry-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--c-accent-glow);
  color: var(--c-accent);
  display: grid;
  place-items: center;
  margin-bottom: auto;
  flex-shrink: 0;
  transition: background 0.18s;
}

.c-entry-card:hover .c-entry-icon {
  background: rgba(242, 88, 34, 0.15);
}

.c-entry-icon svg {
  width: 20px;
  height: 20px;
}

.c-entry-body {
  display: grid;
  gap: 5px;
  margin-top: 20px;
}

.c-entry-label {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  line-height: 1.3;
}

.c-entry-desc {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.6;
}

/* ── SHOWCASE VIEW ──────────────────────────────────────────────────── */

.c-showcase-view {
  padding: 40px 0 80px;
  width: 100%;
}

.c-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.c-search-box {
  position: relative;
  width: min(100%, 380px);
}

.c-search-ico {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--c-text-4);
  pointer-events: none;
}

.c-search-ico svg {
  width: 16px;
  height: 16px;
}

.c-search {
  width: 100%;
  min-height: 42px;
  padding: 0 14px 0 42px;
  border-radius: 999px;
  border: 1px solid var(--c-border-strong);
  background: rgba(255, 255, 255, 0.78);
  color: var(--c-text);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.c-search:focus {
  outline: none;
  border-color: rgba(242, 88, 34, 0.22);
  box-shadow: 0 0 0 3px rgba(242, 88, 34, 0.06);
  background: rgba(255, 255, 255, 0.96);
}

.c-list {
  display: grid;
  gap: 8px;
}

.c-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 16px 20px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--c-border);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.c-item:hover {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(125, 93, 80, 0.13);
  box-shadow: var(--c-shadow-sm);
  transform: translateY(-1px);
}

.c-item-body {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.c-item-name {
  font-size: 15px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--c-text);
}

.c-item-meta {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--c-gold-soft);
  color: var(--c-gold);
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
}

.c-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.c-btn-view {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--c-border-strong);
  background: rgba(255, 255, 255, 0.7);
  color: var(--c-text-2);
  font-size: 13px;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.c-btn-view:hover {
  border-color: rgba(242, 88, 34, 0.2);
  background: rgba(242, 88, 34, 0.05);
  color: var(--c-accent-dark);
}

.c-btn-view svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.c-empty {
  padding: 68px 20px;
  text-align: center;
  color: var(--c-text-3);
}

/* ── DIALOGS ────────────────────────────────────────────────────────── */

.c-dialog-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(52, 35, 18, 0.28);
  backdrop-filter: blur(8px);
}

.c-dialog {
  width: min(520px, 100%);
  padding: 26px;
  border-radius: var(--c-r-lg);
  background: var(--c-surface-strong);
  border: 1px solid var(--c-border);
  box-shadow: var(--c-shadow-lg);
}

.c-dialog-header,
.c-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.c-dialog-title {
  font-size: 18px;
  font-weight: 600;
}

.c-dialog-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: rgba(242, 88, 34, 0.08);
  color: var(--c-accent-dark);
  cursor: pointer;
  font-size: 18px;
  display: grid;
  place-items: center;
}

.c-dialog-close:hover {
  background: rgba(242, 88, 34, 0.14);
}

.c-dialog-body {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.c-dialog-hint {
  color: var(--c-text-3);
  line-height: 1.7;
}

.c-checkbox-list {
  display: grid;
  gap: 8px;
}

.c-dialog-footer {
  margin-top: 20px;
  justify-content: flex-end;
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .c-topbar-inner {
    padding: 0 16px;
  }

  .c-page-inner {
    padding: 0 16px;
  }

  .c-brand-title {
    font-size: 16px;
  }

  .c-user-label {
    display: none;
  }

  .c-entry-grid {
    grid-template-columns: 1fr;
  }

  .c-entry-card {
    min-height: 140px;
    padding: 20px;
  }

  .c-item {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .c-item-actions {
    width: 100%;
  }

  .c-btn-view {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .c-login-screen {
    padding: 16px;
  }

  .c-login-panel {
    padding: 28px 22px 24px;
  }

  .c-login-title {
    font-size: 32px;
  }

  .c-admin-btn {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
