:root {
  --purple-950: #2d0939;
  --purple-900: #480e5a;
  --purple-800: #71178f;
  --purple-700: #8f1db5;
  --purple-600: #b324e2;
  --purple-100: #f5e5fb;
  --purple-50: #fcf5fe;
  --ink: #261f2b;
  --muted: #6e6673;
  --line: #ded8e2;
  --surface: #ffffff;
  --background: #f4f2f6;
  --danger: #a2253a;
  --success: #176b4d;
  --warning: #b45b00;
  --shadow: 0 12px 36px rgba(39, 16, 56, .09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; font-size: 16px; }
body { min-height: 100vh; margin: 0; background: var(--background); line-height: 1.55; }
a { color: var(--purple-700); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-header { position: relative; color: white; background: linear-gradient(120deg, var(--purple-800), var(--purple-600)); border-bottom: 5px solid var(--purple-600); }
.header-inner { max-width: 1180px; min-height: 84px; margin: 0 auto; padding: 12px 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; gap: 4px; color: white; text-decoration: none; line-height: 1.15; }
.brand-logo { display: block; width: 240px; max-width: 100%; height: auto; }
.brand small { color: var(--purple-100); font-size: .85rem; }
.main-nav { display: flex; align-items: center; gap: 6px; }
.main-nav a, .nav-signout { display: inline-flex; align-items: center; min-height: 44px; padding: 9px 13px; color: white; background: transparent; border: 0; border-radius: 8px; text-decoration: none; cursor: pointer; }
.main-nav a:hover, .main-nav a:focus-visible, .nav-signout:hover, .nav-signout:focus-visible { background: rgba(255,255,255,.13); outline: none; }
.main-nav form { margin: 0; }
.nav-badge { min-width: 23px; height: 23px; margin-left: 6px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 99px; color: var(--purple-950); background: #f0cf69; font-size: .78rem; font-weight: 800; }
.nav-toggle { display: none; min-height: 44px; padding: 8px 13px; color: white; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.3); border-radius: 8px; }

.page-shell { width: min(1180px, calc(100% - 40px)); min-height: calc(100vh - 170px); margin: 0 auto; padding: 46px 0 64px; }
.page-heading { margin-bottom: 32px; display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; }
.page-heading.compact { margin-bottom: 24px; }
.page-heading h1, .form-card h1 { margin: 3px 0 8px; font-family: Georgia, "Times New Roman", serif; color: var(--purple-950); font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.05; letter-spacing: -.025em; }
.page-heading.compact h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.page-heading p, .form-card .intro { margin: 0; color: var(--muted); font-size: 1.03rem; }
.eyebrow, .section-kicker { margin: 0; color: var(--purple-700); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.heading-actions, .form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 24px; }
.panel, .form-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.panel { overflow: hidden; }
.panel-heading { min-height: 91px; padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 2px 0 0; color: var(--purple-950); font-size: 1.42rem; line-height: 1.25; }
.text-link, .small-link { font-weight: 750; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.text-link { white-space: nowrap; }

.item-list { display: grid; }
.list-item { min-height: 80px; padding: 15px 24px; display: flex; align-items: center; gap: 14px; color: var(--ink); background: white; border-bottom: 1px solid var(--line); text-decoration: none; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover, a.list-item:focus-visible { background: var(--purple-50); outline: 3px solid transparent; }
.list-item.unread { background: #fbf7e9; }
.file-icon { width: 46px; height: 46px; display: inline-grid; place-items: center; flex: 0 0 auto; border-radius: 10px; color: white; background: var(--purple-700); font-size: .67rem; font-weight: 850; letter-spacing: .05em; }
.notice-dot { width: 13px; height: 13px; flex: 0 0 auto; border: 3px solid var(--purple-100); border-radius: 50%; background: #c9bfd0; box-shadow: 0 0 0 1px #b9afc0; }
.unread .notice-dot { background: #d49d00; box-shadow: 0 0 0 1px #b47a00; }
.item-copy { min-width: 0; display: grid; flex: 1; }
.item-copy strong { overflow-wrap: anywhere; }
.item-copy small, td small { display: block; margin-top: 3px; color: var(--muted); font-size: .82rem; }
.item-action { color: var(--purple-700); font-weight: 750; }
.important-label { display: inline-block; margin-right: 7px; padding: 2px 7px; vertical-align: 1px; color: white; background: var(--danger); border-radius: 5px; font-family: Inter, ui-sans-serif, system-ui, sans-serif; font-size: .66rem; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.notice-labels { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 7px; }
.notice-labels .important-label { margin-right: 0; }
.audience-badge { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 9px; border: 1px solid transparent; border-radius: 99px; font-size: .73rem; font-weight: 750; line-height: 1.5; }
.audience-badge svg { width: 15px; height: 15px; flex: 0 0 auto; }
.audience-badge-global { color: var(--purple-800); background: var(--purple-100); border-color: #e5c1f2; }
.audience-badge-private { color: #0f5b5f; background: #e3f3f1; border-color: #b9ded8; }
.empty-state { padding: 52px 28px; text-align: center; }
.empty-state h2, .empty-state h3 { margin: 0 0 7px; color: var(--purple-950); }
.empty-state p { max-width: 520px; margin: 0 auto 18px; color: var(--muted); }
.contact-strip { margin-top: 24px; padding: 24px 26px; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: var(--purple-950); border-radius: 14px; box-shadow: var(--shadow); color: white; }
.contact-strip .section-kicker { color: #ddcbe9; }
.contact-strip h2 { margin: 3px 0 4px; font-size: 1.35rem; }
.contact-strip p:last-child { margin: 0; color: #e7dceb; }
.contact-strip .button.secondary { flex: 0 0 auto; }

.notice-article { max-width: 780px; padding: clamp(26px, 5vw, 52px); overflow: visible; }
.notice-article h1 { margin: 8px 0 6px; font-family: Georgia, "Times New Roman", serif; color: var(--purple-950); font-size: clamp(2rem, 4.5vw, 3.2rem); line-height: 1.1; }
.notice-meta { margin: 0 0 30px; padding-bottom: 20px; color: var(--muted); border-bottom: 1px solid var(--line); }
.notice-body { font-size: 1.06rem; line-height: 1.75; }
.notice-body p:first-child { margin-top: 0; }
.back-link { display: inline-block; margin-bottom: 18px; font-weight: 750; text-decoration: none; }

.stats-grid { margin-bottom: 24px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card { padding: 23px 24px; display: grid; color: var(--ink); background: white; border: 1px solid var(--line); border-left: 5px solid var(--purple-600); border-radius: 12px; box-shadow: 0 8px 24px rgba(39,16,56,.06); text-decoration: none; }
.stat-card strong { color: var(--purple-800); font-family: Georgia, "Times New Roman", serif; font-size: 2.2rem; line-height: 1; }
.stat-card span { margin-top: 8px; color: var(--muted); }
.static-row { min-height: 78px; }
.static-row form { margin: 0; }
.small-link { padding: 8px 3px; color: var(--purple-700); background: none; border: 0; cursor: pointer; font-size: .86rem; }
.danger-link { color: var(--danger); }
.messages-panel { margin-top: 24px; }
.message-icon { width: 42px; height: 42px; display: inline-grid; place-items: center; flex: 0 0 auto; color: white; background: var(--purple-700); border-radius: 50%; font-size: 1.15rem; }
.conversation-shell { max-width: 820px; margin: 0 auto; overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.conversation-heading { padding: 28px clamp(20px, 5vw, 42px); color: white; background: linear-gradient(120deg, var(--purple-950), var(--purple-700)); }
.conversation-heading .eyebrow { color: #e3cfee; }
.conversation-heading h1 { margin: 4px 0 6px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.8rem, 4vw, 2.7rem); line-height: 1.1; }
.conversation-heading p:last-child { margin: 0; color: #eadff0; }
.conversation { padding: clamp(20px, 5vw, 38px); display: grid; gap: 16px; background: #f7f5f8; }
.message-bubble { width: min(86%, 620px); padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 4px 14px rgba(39,16,56,.05); }
.message-bubble p { margin: 8px 0 0; }
.seller-bubble { justify-self: start; background: white; border-bottom-left-radius: 4px; }
.admin-bubble { justify-self: end; background: var(--purple-100); border-color: #d5bfdf; border-bottom-right-radius: 4px; }
.bubble-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; color: var(--muted); font-size: .8rem; }
.bubble-meta strong { color: var(--purple-900); font-size: .88rem; }
.bubble-meta time { text-align: right; }
.reply-form { padding: 24px clamp(20px, 5vw, 38px) 32px; display: grid; gap: 16px; border-top: 1px solid var(--line); }
.reply-form .field { gap: 8px; }
.reply-form textarea { min-height: 125px; }
.reply-form .button { justify-self: start; }

.form-card { max-width: 700px; margin: 0 auto; padding: clamp(25px, 5vw, 48px); }
.form-card.narrow { max-width: 620px; }
.stacked-form { margin-top: 30px; display: grid; gap: 22px; }
.field { display: grid; gap: 7px; }
.field label { color: var(--purple-950); font-weight: 750; }
.field input:not([type="checkbox"]), .field select, .field textarea { width: 100%; min-height: 50px; padding: 11px 13px; color: var(--ink); background: white; border: 1px solid #aaa0af; border-radius: 8px; }
.field textarea { min-height: 170px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--purple-600); outline: 3px solid rgba(179,36,226,.18); }
.checkbox-row { display: flex; align-items: flex-start; gap: 11px; }
.checkbox-row input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--purple-700); }
.help-text { color: var(--muted); font-size: .86rem; }
.help-text ul { margin: 8px 0 0; padding-left: 21px; }
.field-error { margin: 0; color: var(--danger); font-size: .9rem; font-weight: 650; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger) !important; }
.form-alert { padding: 13px 15px; color: #74172b; background: #fae5e9; border-left: 4px solid var(--danger); border-radius: 6px; }
.form-alert ul { margin: 0; padding-left: 20px; }

.button { min-height: 48px; padding: 11px 18px; display: inline-flex; align-items: center; justify-content: center; border: 2px solid transparent; border-radius: 9px; font-weight: 800; text-align: center; text-decoration: none; cursor: pointer; }
.button.primary { color: white; background: var(--purple-600); }
.button.primary:hover, .button.primary:focus-visible { background: var(--purple-700); }
.button.secondary { color: var(--purple-800); background: white; border-color: var(--purple-700); }
.button.secondary:hover, .button.secondary:focus-visible { background: var(--purple-50); }
.button.quiet { color: var(--purple-800); background: transparent; }
.button.full { width: 100%; }
.button:focus-visible { outline: 3px solid rgba(179,36,226,.25); outline-offset: 2px; }

.credential-box { margin: 26px 0 14px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.credential-box div { padding: 15px 18px; display: grid; gap: 3px; border-bottom: 1px solid var(--line); }
.credential-box div:last-child { border-bottom: 0; }
.credential-box dt { color: var(--muted); font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.credential-box dd { margin: 0; overflow-wrap: anywhere; font-weight: 700; }
.credential-box .password-value { color: var(--purple-800); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.08rem; }

.table-panel { padding: 8px 0; }
.responsive-table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px 18px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); background: #faf9fb; font-size: .76rem; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.table-actions-cell { min-width: 226px; }
.table-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 4px 12px; }
.table-actions form { margin: 0; }
.table-actions a, .table-actions button { display: inline-block; padding: 2px 0; color: var(--purple-700); background: none; border: 0; font-size: .83rem; font-weight: 750; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.table-actions form:last-child button { color: var(--danger); }
.status { display: inline-block; padding: 3px 8px; border-radius: 99px; font-size: .76rem; font-weight: 800; white-space: nowrap; }
.status.active { color: var(--success); background: #dff3eb; }
.status.inactive { color: #5f5863; background: #ece9ee; }

.message-stack { margin-bottom: 20px; display: grid; gap: 8px; }
.message { padding: 13px 16px; color: var(--success); background: #e2f4ed; border-left: 4px solid var(--success); border-radius: 7px; font-weight: 650; }
.site-footer { min-height: 86px; padding: 24px; display: grid; place-items: center; color: var(--muted); background: white; border-top: 1px solid var(--line); text-align: center; }
.site-footer p { margin: 0; }

.login-page { display: grid; place-items: center; padding: 24px; background: linear-gradient(145deg, var(--purple-800) 0 46%, var(--background) 46% 100%); }
.login-shell { width: 100%; display: grid; place-items: center; }
.login-card { width: min(100%, 460px); padding: clamp(30px, 6vw, 48px); background: white; border-radius: 18px; box-shadow: 0 30px 80px rgba(17,6,26,.3); }
.login-brand { margin-bottom: 30px; }
.login-brand .brand-logo { width: 100%; }
.login-card h1 { margin: 0 0 7px; color: var(--purple-950); font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.1rem, 7vw, 3rem); line-height: 1.08; }
.login-card .intro, .login-help { color: var(--muted); }
.login-card .stacked-form { margin-top: 26px; }
.login-help { margin: 24px 0 0; font-size: .88rem; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .header-inner { min-height: 72px; padding: 12px 18px; gap: 16px; }
  .brand-logo { width: 200px; }
  .brand small { font-size: .76rem; }
  .nav-toggle { display: inline-flex; flex: 0 0 auto; align-items: center; }
  .main-nav { position: absolute; z-index: 10; top: 100%; left: 14px; right: 14px; padding: 10px; display: none; align-items: stretch; flex-direction: column; background: var(--purple-950); border: 1px solid rgba(255,255,255,.2); border-radius: 10px; box-shadow: var(--shadow); }
  .main-nav.open { display: flex; }
  .main-nav a, .nav-signout { width: 100%; justify-content: flex-start; }
  .page-shell { width: min(100% - 26px, 700px); padding: 30px 0 48px; }
  .page-heading, .admin-heading { align-items: stretch; flex-direction: column; gap: 20px; }
  .heading-actions, .admin-heading > .button { width: 100%; }
  .heading-actions .button, .admin-heading > .button { flex: 1; }
  .dashboard-grid, .stats-grid { grid-template-columns: 1fr; }
  .contact-strip { align-items: stretch; flex-direction: column; }
  .panel-heading, .list-item { padding-left: 18px; padding-right: 18px; }
  .list-item { align-items: flex-start; }
  .item-action { align-self: center; }
  .admin-panels .static-row { flex-wrap: wrap; }
  .admin-panels .static-row .item-copy { flex-basis: calc(100% - 62px); }
  .admin-panels .static-row .small-link:first-of-type { margin-left: 60px; }
  .table-panel { padding: 0; background: transparent; border: 0; box-shadow: none; }
  .message-bubble { width: 94%; }
  .responsive-table { overflow: visible; }
  table, tbody, tr, td { display: block; }
  thead { display: none; }
  tbody { display: grid; gap: 14px; }
  tr { padding: 18px; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 20px rgba(39,16,56,.06); }
  td { padding: 5px 0; border: 0; }
  .table-actions-cell { min-width: 0; padding-top: 13px; }
  .table-actions { padding-top: 13px; justify-content: flex-start; border-top: 1px solid var(--line); gap: 8px 16px; }
  .table-actions a, .table-actions button { padding: 8px 0; }
}

@media (max-width: 450px) {
  .list-item { gap: 11px; }
  .file-icon { width: 42px; height: 42px; }
  .item-action { font-size: .82rem; }
  .form-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
