:root {
  color: #211d1b;
  background: #f4f0ea;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --ink: #211d1b;
  --muted: #746b65;
  --paper: #fffdf9;
  --line: #ded6ce;
  --accent: #9b3f46;
  --accent-dark: #702c32;
  --ready: #77695f;
  --claimed: #9a650e;
  --published: #24714e;
  --blocked: #9b3f46;
  --shadow: 0 14px 40px rgba(53, 42, 36, .08);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; background: linear-gradient(180deg, #f8f4ee 0, #f4f0ea 380px); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--accent-dark); }

.appbar {
  position: sticky; top: 0; z-index: 20; min-height: 68px; padding: 10px clamp(16px, 4vw, 56px);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: rgba(255, 253, 249, .94); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: white; background: var(--accent); font: 700 14px/1 Georgia, serif; letter-spacing: .08em; }
.brand strong, .brand small { display: block; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.appbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.current-user { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
.language-switch { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.language-switch button { border: 0; border-radius: 8px; padding: 7px 9px; color: var(--muted); background: transparent; cursor: pointer; }
.language-switch button.active { color: white; background: var(--ink); }

.page { width: min(1280px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 72px; }
.loading, .empty { padding: 48px 20px; color: var(--muted); text-align: center; }
.login-shell { min-height: calc(100vh - 170px); display: grid; place-items: center; }
.login-card { width: min(430px, 100%); padding: clamp(24px, 5vw, 42px); background: var(--paper); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.login-card h1 { margin: 0 0 8px; font: 600 clamp(28px, 7vw, 42px)/1.1 Georgia, serif; }
.login-card > p { margin: 0 0 28px; color: var(--muted); }
.field { display: grid; gap: 7px; margin: 0 0 16px; }
.field span { color: var(--muted); font-size: 13px; font-weight: 650; }
.field input, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 13px; color: var(--ink); background: white; outline: none; }
.field textarea { min-height: 82px; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(155, 63, 70, .12); }
.form-error, .notice { margin: 10px 0; padding: 11px 13px; border-radius: 10px; color: #792f35; background: #f9e8e9; font-size: 13px; }

.button { border: 1px solid transparent; border-radius: 11px; min-height: 40px; padding: 9px 14px; color: white; background: var(--accent); font-weight: 700; cursor: pointer; text-decoration: none; text-align: center; }
.button:hover { background: var(--accent-dark); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button-secondary { color: var(--ink); border-color: var(--line); background: white; }
.button-secondary:hover, .button-quiet:hover { background: #eee7df; }
.button-quiet { color: var(--muted); border-color: transparent; background: transparent; }
.button-copy { min-height: 34px; padding: 6px 10px; color: var(--accent-dark); border-color: #dfbfc2; background: #fff; font-size: 12px; }
.button-copy:hover { background: #f8e9ea; }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.button-block { width: 100%; }

.workspace-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.workspace-head h1 { margin: 0; font: 600 clamp(28px, 5vw, 46px)/1.08 Georgia, serif; }
.workspace-head p { margin: 7px 0 0; color: var(--muted); }
.tabs, .filters { display: flex; flex-wrap: wrap; gap: 8px; }
.tab, .filter { border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; color: var(--muted); background: var(--paper); cursor: pointer; }
.tab.active, .filter.active { color: white; border-color: var(--ink); background: var(--ink); }
.filters { margin: 18px 0; }
.summary-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 22px; }
.status-chip { display: inline-flex; gap: 6px; align-items: center; border-radius: 999px; padding: 6px 10px; color: white; font-size: 12px; font-weight: 750; }
.status-ready { background: var(--ready); }.status-claimed { background: var(--claimed); }.status-published { background: var(--published); }.status-blocked { background: var(--blocked); }

.account-card, .pack-card, .owner-panel, .staff-card, .event-card { background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.account-card { margin: 0 0 24px; border-radius: 22px; overflow: hidden; }
.account-profile { display: grid; grid-template-columns: 76px 1fr; gap: 18px; padding: 20px; border-bottom: 1px solid var(--line); }
.avatar { width: 76px; height: 76px; border-radius: 19px; object-fit: cover; background: #eee7df; }
.account-profile h2 { margin: 0; font: 600 25px/1.2 Georgia, serif; }
.account-profile p { margin: 5px 0; color: var(--muted); }
.account-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.handle-note { margin-top: 10px !important; padding: 8px 10px; border-left: 3px solid #cda66f; background: #fbf2e4; font-size: 12px; }
.packs { display: grid; gap: 18px; padding: 18px; }
.pack-card { border-radius: 18px; box-shadow: none; overflow: hidden; }
.pack-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.pack-head h3 { margin: 0; }
.pack-head small { color: var(--muted); }
.pack-body { padding: 18px; }
.published-pack-summary { align-items: flex-start; }
.published-pack-identity { min-width: 0; }
.published-pack-title { margin: 6px 0; overflow-wrap: anywhere; }
.published-pack-summary-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.published-pack-summary .published-link { margin-top: 0; }
.slides { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.slide { margin: 0; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: white; }
.slide img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: #eee; }
.slide figcaption { display: grid; gap: 7px; padding: 9px; color: var(--muted); font-size: 12px; }
.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.copy-block { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.copy-block h4 { margin: 0; padding: 10px 12px; background: #f4efe8; }
.language-pair { display: grid; grid-template-columns: 1fr 1fr; }
.language-copy { min-width: 0; padding: 12px; }
.language-copy + .language-copy { border-left: 1px solid var(--line); }
.language-tag { color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; }
.language-copy p { white-space: pre-wrap; overflow-wrap: anywhere; }
.pack-section { margin-top: 18px; }
.pack-section h4 { margin: 0 0 9px; }
.reply { margin: 8px 0; padding: 11px; border-radius: 12px; background: #f6f1eb; }
.reply p { white-space: pre-wrap; }
.action-panel { margin-top: 20px; padding: 16px; border-radius: 14px; background: #eee8e0; }
.action-grid { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(200px, 1fr); gap: 14px; }
.published-link { display: inline-flex; margin-top: 10px; font-weight: 700; }

.owner-layout { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 2fr); gap: 18px; }
.owner-panel { padding: 20px; border-radius: 18px; }
.owner-panel h2, .owner-panel h3 { margin-top: 0; }
.staff-list, .event-list { display: grid; gap: 12px; }
.staff-card, .event-card { padding: 16px; border-radius: 14px; box-shadow: none; }
.staff-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.staff-card h3 { margin: 0; }
.assignment-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 7px; margin: 14px 0; }
.assignment-grid label { display: flex; gap: 7px; align-items: center; padding: 8px; border-radius: 9px; background: #f6f1eb; font-size: 13px; }
.event-card { font-size: 13px; }
.event-card p { margin: 4px 0; overflow-wrap: anywhere; }
.credential-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(31, 25, 23, .62); }
.credential-card { width: min(480px, 100%); padding: 24px; border-radius: 20px; background: var(--paper); box-shadow: 0 24px 80px rgba(0, 0, 0, .3); }
.credential-card h2 { margin-top: 0; }
.credential-code { display: block; margin: 14px 0; padding: 15px; border: 1px dashed var(--accent); border-radius: 12px; overflow-wrap: anywhere; background: #fff7f5; font: 700 17px/1.4 ui-monospace, SFMono-Regular, monospace; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 70; max-width: min(360px, calc(100% - 36px)); padding: 12px 15px; border-radius: 12px; color: white; background: var(--ink); box-shadow: var(--shadow); }

@media (max-width: 800px) {
  .content-grid, .owner-layout, .action-grid { grid-template-columns: 1fr; }
  .workspace-head { align-items: stretch; flex-direction: column; }
}
@media (max-width: 520px) {
  .appbar { position: static; align-items: flex-start; padding: 10px 12px; }
  .brand small, .current-user { display: none; }
  .appbar-actions { flex-wrap: wrap; }
  .page { width: min(100% - 20px, 1280px); padding-top: 20px; }
  .account-profile { grid-template-columns: 58px 1fr; gap: 12px; padding: 14px; }
  .avatar { width: 58px; height: 58px; border-radius: 15px; }
  .packs, .pack-body { padding: 12px; }
  .slides { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .language-pair { grid-template-columns: 1fr; }
  .language-copy + .language-copy { border-left: 0; border-top: 1px solid var(--line); }
  .button-row .button { flex: 1 1 140px; }
  .published-pack-summary { align-items: stretch; flex-direction: column; }
  .published-pack-summary-actions { justify-content: flex-start; }
}
/* Account preparation and execution use the existing bilingual workspace system. */
.setup-card { padding: 24px; }
.setup-card .account-profile { padding: 0 0 24px; }
.registration-form { margin: 24px 0; padding: 20px; border: 1px solid #dce3ee; border-radius: 14px; background: #f8fafc; }
.registration-form select { width: 100%; padding: 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: white; color: #18233b; font: inherit; }
.progress-card { margin-top: 16px; overflow-wrap: anywhere; }
.progress-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid #e5e9ef; }
.tabs { flex-wrap: wrap; }

.workflow-panel { padding: 16px; border: 1px solid #d9cec4; border-radius: 16px; background: #faf7f2; }
.workflow-heading, .reminder-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.workflow-heading h4, .workflow-recommendation-section h4, .workflow-selection-section h4, .reminder-head h2 { margin: 0; }
.workflow-time-pair, .progress-workflow { display: block; margin-top: 7px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.analytics-view { display: grid; gap: 16px; }
.analytics-toolbar, .analytics-account-head, .analytics-post-card header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.analytics-toolbar { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.analytics-toolbar p { margin: 0; max-width: 76ch; color: var(--muted); line-height: 1.6; }
.analytics-overview, .analytics-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.analytics-metric { min-width: 0; padding: 12px; border-radius: 12px; background: #f4f6f8; }
.analytics-metric span, .analytics-time { display: block; color: var(--muted); font-size: 12px; }
.analytics-metric strong { display: block; margin-top: 5px; overflow-wrap: anywhere; font-size: 18px; }
.analytics-metric small { display: block; margin-top: 5px; color: var(--muted); line-height: 1.45; }
.analytics-account-card, .analytics-post-card, .analytics-retry { padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.analytics-account-body { display: grid; gap: 12px; margin-top: 14px; }
.analytics-account-body[hidden] { display: none !important; }
.analytics-profile, .analytics-post-card { display: grid; gap: 10px; }
.analytics-notice { padding: 11px 13px; border-radius: 10px; background: #fff7df; color: #614b12; }
.analytics-notice.stale { border-left: 3px solid #c28a12; }
.analytics-post-card .analytics-metric-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }

@media (max-width: 760px) {
  .analytics-toolbar, .analytics-account-head, .analytics-post-card header { align-items: flex-start; flex-direction: column; }
  .analytics-overview, .analytics-metric-grid, .analytics-post-card .analytics-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 420px) {
  .analytics-overview, .analytics-metric-grid, .analytics-post-card .analytics-metric-grid { grid-template-columns: 1fr; }
}
.workflow-status { display: inline-flex; border-radius: 999px; padding: 5px 9px; color: #493f39; background: #e9e2da; font-size: 12px; font-weight: 750; white-space: nowrap; }
.workflow-upcoming { border-color: #d7a94f !important; background: #fff4d7 !important; }
.workflow-due { border-color: #cb8136 !important; background: #ffead4 !important; }
.workflow-overdue { border-color: #bf5962 !important; background: #fbe1e3 !important; }
.workflow-blocked { border-color: #aa6870 !important; background: #f6e8e9 !important; }
.workflow-completed { border-color: #62a383 !important; background: #e0f2e9 !important; }
.workflow-owner-form { margin: 14px 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.workflow-owner-form summary { color: var(--accent-dark); font-weight: 750; cursor: pointer; }
.workflow-owner-form[open] summary { margin-bottom: 14px; }
.workflow-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.music-option-editor { margin: 14px 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.music-option-editor legend { padding: 0 6px; font-weight: 750; }
.workflow-save-row { margin-top: 14px; }
.workflow-recommendation-section, .workflow-selection-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.music-recommendations { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 10px; }
.music-option-card { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.music-option-card h5 { margin: 8px 0; overflow-wrap: anywhere; font-size: 15px; }
.music-rank { color: var(--accent-dark); font-size: 12px; font-weight: 800; }
.music-bilingual { margin-top: 10px; color: var(--muted); font-size: 12px; }
.music-bilingual p { white-space: pre-wrap; overflow-wrap: anywhere; }
.saved-music { margin: 10px 0; padding: 12px; border-radius: 10px; background: #f0ebe4; overflow-wrap: anywhere; }
.workflow-music-form { margin-top: 12px; }
.workflow-confirmation { display: flex; align-items: flex-start; gap: 9px; margin: 12px 0; padding: 11px; border-radius: 10px; background: #fff4df; font-size: 13px; }
.workflow-confirmation input { margin-top: 2px; }
.workflow-empty { color: var(--muted); font-size: 13px; }
.reminder-strip { margin-bottom: 20px; padding: 18px; border: 1px solid #d8c9bc; border-radius: 18px; background: #fffaf3; box-shadow: var(--shadow); }
.reminder-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.reminder-list { display: grid; gap: 8px; margin: 14px 0; }
.reminder-row { display: grid; grid-template-columns: minmax(160px, 1.2fr) minmax(240px, 2fr) minmax(150px, 1fr) auto; gap: 10px; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: white; font-size: 12px; }
.reminder-row .button { min-height: 34px; padding: 6px 10px; font-size: 12px; }

@media (max-width: 800px) {
  .workflow-grid, .reminder-row { grid-template-columns: 1fr; }
  .workflow-heading, .reminder-head { align-items: stretch; flex-direction: column; }
}
