:root {
  --ink: #252332;
  --muted: #777488;
  --line: #e8e6ef;
  --paper: #ffffff;
  --canvas: #f7f7fb;
  --purple: #6c5ce7;
  --purple-dark: #5747d8;
  --purple-soft: #eeebff;
  --green: #2f9e74;
  --red: #aa4d4d;
}

* { box-sizing: border-box; }
html { background: var(--canvas); scroll-behavior: smooth; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, textarea, input { font: inherit; }
button, a { color: inherit; }
svg { display: block; flex: 0 0 auto; }
[hidden] { display: none !important; }

.app-shell, .admin-page { min-height: 100dvh; display: flex; flex-direction: column; background: var(--canvas); }
.topbar { height: 66px; padding: 0 28px; display: grid; grid-template-columns: minmax(210px, 1fr) auto minmax(210px, 1fr); align-items: center; gap: 20px; background: rgba(255,255,255,.95); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; backdrop-filter: blur(16px); }
.public-topbar { grid-template-columns: 1fr auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 780; font-size: 19px; letter-spacing: -.45px; width: fit-content; }
.brand > span:last-child > span { color: var(--purple); }
.brand-logo { width: 39px; height: 39px; display: block; border-radius: 10px; object-fit: cover; box-shadow: 0 7px 18px rgba(68,177,210,.22); }
.brand-mark { width: 35px; height: 35px; border-radius: 10px; display: inline-grid; place-items: center; color: white; background: linear-gradient(145deg, #8173f3, #5d4bd6); box-shadow: 0 7px 18px rgba(108,92,231,.23); transform: rotate(-2deg); flex: 0 0 auto; }
.admin-page-title { display: flex; justify-content: center; color: #6f6b7d; font-size: 13px; font-weight: 680; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-button { min-height: 37px; border: 1px solid #d8d4e6; background: white; border-radius: 9px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-size: 13px; font-weight: 700; text-decoration: none; transition: .18s ease; }
.admin-button:hover { color: var(--purple); border-color: #aaa0e4; }
.header-tools { justify-self: end; display: flex; align-items: center; gap: 8px; }
.slide-navigator, .presentation-history { position: relative; }
.slide-navigator-trigger, .history-trigger { min-height: 39px; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid #d8d4e6; border-radius: 10px; background: white; color: #4b4757; cursor: pointer; font-size: 12px; font-weight: 760; transition: .18s ease; }
.slide-navigator-trigger:hover, .slide-navigator-trigger[aria-expanded="true"], .history-trigger:hover, .history-trigger[aria-expanded="true"] { color: var(--purple); border-color: #aaa0e4; background: #faf9ff; }
.slide-navigator-trigger .chevron { transition: transform .18s ease; }
.slide-navigator-trigger .chevron.open { transform: rotate(180deg); }
.slide-navigator-menu { position: absolute; top: calc(100% + 10px); right: 0; width: min(310px, calc(100vw - 28px)); overflow: hidden; border: 1px solid #dedbe8; border-radius: 14px; background: white; box-shadow: 0 20px 55px rgba(28,23,49,.2); z-index: 60; }
.presentation-history-menu { position: absolute; top: calc(100% + 10px); right: 0; width: min(360px, calc(100vw - 28px)); overflow: hidden; border: 1px solid #dedbe8; border-radius: 14px; background: white; box-shadow: 0 20px 55px rgba(28,23,49,.2); z-index: 60; }
.slide-navigator-heading { min-height: 48px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.slide-navigator-heading strong { font-size: 12px; }
.slide-navigator-heading span { color: var(--muted); font-size: 9px; }
.slide-navigator-list { max-height: min(440px, calc(100dvh - 145px)); padding: 8px; display: flex; flex-direction: column; gap: 5px; overflow-y: auto; }
.slide-navigator-list button { width: 100%; min-height: 58px; padding: 7px; display: grid; grid-template-columns: 78px minmax(0, 1fr); align-items: center; gap: 11px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; text-align: left; font-size: 11px; font-weight: 750; }
.slide-navigator-list button:hover, .slide-navigator-list button:focus-visible { color: var(--purple); background: var(--purple-soft); outline: none; }
.slide-navigator-list img { display: block; width: 78px; aspect-ratio: 16 / 9; object-fit: contain; border: 1px solid #e0ddea; border-radius: 4px; background: #f4f2f7; }
.presentation-history-list { max-height: min(440px, calc(100dvh - 145px)); padding: 8px; display: flex; flex-direction: column; gap: 5px; overflow-y: auto; }
.presentation-history-list > button, .presentation-history-list > a { width: 100%; min-height: 59px; padding: 9px 10px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; text-align: left; text-decoration: none; }
.presentation-history-list > button:hover, .presentation-history-list > button:focus-visible, .presentation-history-list > button.active,
.presentation-history-list > a:hover, .presentation-history-list > a:focus-visible, .presentation-history-list > a.active { background: var(--purple-soft); outline: none; }
.presentation-history-list > button > span, .presentation-history-list > a > span { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.presentation-history-list strong { overflow: hidden; color: #403c4a; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.presentation-history-list small { color: var(--muted); font-size: 9px; }
.presentation-history-list em { flex: 0 0 auto; color: #8b849b; font-size: 9px; font-style: normal; }
.presentation-history-list p { margin: 0; padding: 24px 15px; color: var(--muted); text-align: center; font-size: 10px; }

.file-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; color: #6556d9; background: var(--purple-soft); flex: 0 0 auto; }

.feed-workspace { flex: 1; width: 100%; padding: 34px 20px 58px; }
.slide-feed { width: min(920px, 100%); margin: 0 auto; display: flex; flex-direction: column; gap: 34px; }
.feed-card { scroll-margin-top: 84px; overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 16px 42px rgba(39,34,65,.08); }
.feed-card-header { min-height: 56px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.feed-card-header h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 21px; font-weight: 600; letter-spacing: -.3px; }
.feed-card-header span { color: var(--muted); background: #f7f6fa; border: 1px solid #ebe8f0; border-radius: 999px; padding: 5px 9px; font-size: 10px; font-weight: 750; }
.feed-slide { display: grid; place-items: center; padding: 24px; background: #ecebf1; }
.feed-slide img { display: block; width: 100%; height: auto; object-fit: contain; background: white; box-shadow: 0 12px 30px rgba(27,23,46,.15); }
.feed-note { padding: 20px; }
.feed-note label { display: block; margin-bottom: 9px; color: #5b5668; font-size: 11px; font-weight: 800; }
.feed-note textarea { width: 100%; min-height: 150px; padding: 15px; resize: vertical; border: 1px solid #e3e0eb; border-radius: 11px; background: #fcfbfd; color: #383541; font-size: 14px; line-height: 1.7; outline: none; transition: border-color .18s, box-shadow .18s, background .18s; }
.feed-note textarea:focus { border-color: #a99fea; box-shadow: 0 0 0 3px rgba(108,92,231,.09); background: white; }
.feed-note textarea::placeholder { color: #aaa6b2; }
.feed-note-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 2px 0; color: #9a96a3; font-size: 10px; }
.feed-note-footer span:last-child { display: inline-flex; align-items: center; gap: 5px; }
.eyebrow { display: block; text-transform: uppercase; letter-spacing: 1.25px; color: #9692a3; font-size: 9px; line-height: 1.4; font-weight: 800; margin-bottom: 5px; }

.none-state { flex: 1; min-height: calc(100dvh - 108px); padding: 48px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: radial-gradient(circle at 50% 44%, rgba(108,92,231,.09), transparent 33%); }
.none-icon { width: 68px; height: 68px; display: grid; place-items: center; margin-bottom: 24px; border-radius: 19px; color: var(--purple); background: white; border: 1px solid #e3dff4; box-shadow: 0 16px 36px rgba(77,65,135,.12); }
.none-state h1 { margin: 4px 0 10px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(38px, 5vw, 58px); font-weight: 500; letter-spacing: -2px; }
.none-state p { max-width: 520px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }

.app-footer { min-height: 42px; background: white; border-top: 1px solid var(--line); padding: 0 28px; display: flex; align-items: center; justify-content: space-between; color: #a09ba8; font-size: 9px; letter-spacing: .15px; }
.footer-status { display: inline-flex; align-items: center; gap: 6px; }
.footer-status i { width: 6px; height: 6px; border-radius: 50%; background: #43b88c; box-shadow: 0 0 0 3px #e5f6ef; }

.admin-content { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 60px; }
.back-link { width: fit-content; display: inline-flex; align-items: center; gap: 6px; color: #716b80; text-decoration: none; font-size: 11px; font-weight: 700; margin-bottom: 20px; }
.back-link:hover { color: var(--purple); }
.admin-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 27px; }
.admin-intro h1 { margin: 0 0 8px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(37px, 5vw, 51px); line-height: 1; letter-spacing: -1.7px; font-weight: 500; }
.admin-intro p { max-width: 610px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.admin-lock-note { flex: 0 0 auto; color: #6e61ba; background: #f1eeff; border: 1px solid #e3ddff; border-radius: 999px; padding: 8px 12px; font-size: 10px; font-weight: 740; }
.admin-grid { display: grid; grid-template-columns: 1.04fr .96fr; gap: 18px; align-items: stretch; }
.admin-card, .published-card { background: white; border: 1px solid var(--line); border-radius: 15px; padding: 22px; box-shadow: 0 9px 28px rgba(35,30,60,.05); }
.admin-card { min-height: 474px; }
.login-card { max-width: 460px; margin: 48px auto 0; min-height: auto; }
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-form label { color: #5b5668; font-size: 11px; font-weight: 800; }
.login-form input { min-height: 43px; padding: 0 12px; border: 1px solid #e3e0eb; border-radius: 9px; background: #fcfbfd; }
.login-form input:focus { outline: none; border-color: #a99fea; box-shadow: 0 0 0 3px rgba(108,92,231,.09); background: white; }
.card-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 19px; }
.card-heading h2 { margin: 0 0 4px; font-family: Georgia, "Times New Roman", serif; font-size: 21px; font-weight: 600; letter-spacing: -.3px; }
.card-heading p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.step-number, .published-icon { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; color: var(--purple); background: var(--purple-soft); font-size: 12px; font-weight: 850; }
.upload-zone { min-height: 360px; border: 1.5px dashed #cfc9e4; background: #faf9fd; border-radius: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 27px; transition: .18s; }
.upload-zone.dragging { border-color: var(--purple); background: #f3f0ff; box-shadow: inset 0 0 0 3px rgba(108,92,231,.08); }
.upload-zone.busy { border-style: solid; }
.upload-zone input { display: none; }
.upload-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; color: var(--purple); background: var(--purple-soft); margin-bottom: 14px; }
.upload-zone h3 { margin: 0 0 6px; font-size: 16px; }
.upload-zone p { margin: 0 0 18px; color: var(--muted); font-size: 12px; line-height: 1.6; max-width: 350px; overflow-wrap: anywhere; }
.upload-zone small { color: #aaa6b3; font-size: 9px; margin-top: 12px; }
.primary-button, .publish-button { border: 0; background: var(--purple); color: white; min-height: 43px; padding: 0 18px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 740; cursor: pointer; box-shadow: 0 10px 23px rgba(108,92,231,.22); transition: .18s ease; }
.primary-button:hover, .publish-button:hover { background: var(--purple-dark); transform: translateY(-1px); }
.primary-button:disabled, .publish-button:disabled { opacity: .65; cursor: wait; transform: none; }
.conversion-progress { width: min(350px, 100%); display: flex; flex-direction: column; gap: 9px; margin-bottom: 8px; }
.conversion-progress > div { height: 7px; overflow: hidden; border-radius: 999px; background: #e5e1f0; }
.conversion-progress > div span { display: block; height: 100%; min-width: 3%; width: 8%; border-radius: inherit; background: linear-gradient(90deg, #7767e7, #9c8ff0); transition: width .2s ease; }
.conversion-progress strong { color: #6f6882; font-size: 10px; }
.error-message, .success-message { display: flex; gap: 8px; align-items: flex-start; padding: 10px 11px; border-radius: 9px; margin-top: 12px; font-size: 11px; line-height: 1.5; }
.error-message { color: var(--red); background: #fff2f2; border: 1px solid #f3d6d6; }
.success-message { color: #267b5b; background: #ecf8f3; border: 1px solid #d4eee3; }
.error-message svg, .success-message svg { flex: 0 0 auto; margin-top: 1px; }
.publish-placeholder { min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 35px; text-align: center; border: 1px solid #eeecf2; border-radius: 13px; color: #afaaba; background: #fbfafc; }
.publish-placeholder strong { margin: 13px 0 6px; color: #716d7b; font-size: 13px; }
.publish-placeholder span { max-width: 300px; font-size: 10px; line-height: 1.55; }
.draft-ready { min-height: 360px; display: flex; flex-direction: column; }
.draft-summary { display: flex; align-items: center; gap: 11px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; }
.draft-summary > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.draft-summary strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draft-summary span:not(.file-icon) { color: var(--muted); font-size: 9px; }
.image-strip { min-height: 155px; margin: 14px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; position: relative; }
.image-strip img { width: 100%; aspect-ratio: 16 / 9; object-fit: contain; border: 1px solid #dfdce8; border-radius: 6px; background: #f3f1f6; }
.image-strip > span { position: absolute; right: 8px; bottom: 8px; padding: 4px 7px; border-radius: 999px; color: white; background: rgba(37,35,50,.78); font-size: 9px; font-weight: 800; }
.publish-button { width: 100%; margin-top: auto; }
.published-card { margin-top: 18px; }
.published-card .card-heading { margin-bottom: 14px; }
.published-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 16px; border: 1px solid #e5e2ec; border-radius: 11px; background: #fbfafc; }
.published-row > div:first-child { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.published-row strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.published-row span { color: var(--muted); font-size: 10px; }
.published-actions { flex: 0 0 auto; display: flex; gap: 7px; }
.published-actions a, .published-actions button { min-height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 11px; border: 1px solid #dcd8e7; border-radius: 8px; background: white; text-decoration: none; cursor: pointer; font-size: 10px; font-weight: 750; }
.published-actions a:hover { color: var(--purple); border-color: #aaa0e4; }
.published-actions button { color: var(--red); }
.none-published { padding: 18px; border: 1px dashed #d8d4df; border-radius: 10px; color: #9994a3; background: #fbfafc; text-align: center; font-size: 11px; }
.muted-status { display: inline-flex; align-items: center; gap: 7px; color: #938f9c; font-size: 11px; }

.app-loading { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 13px; color: #787385; font-size: 12px; }
.spin { animation: spin .9s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: rotate(-2deg) scale(1.06); } }

@media (max-width: 1050px) {
  .topbar { grid-template-columns: 1fr auto; }
  .public-topbar { grid-template-columns: 1fr auto; }
  .admin-topbar .admin-page-title { display: none; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-card { min-height: auto; }
}

@media (max-width: 780px) {
  .topbar { height: 60px; padding: 0 15px; }
  .slide-navigator-trigger, .history-trigger { min-height: 37px; }
  .slide-navigator-menu, .presentation-history-menu { top: calc(100% + 8px); }
  .admin-button { font-size: 0; width: 38px; padding: 0; }
  .admin-button svg { width: 17px; height: 17px; }
  .feed-workspace { padding: 20px 12px 38px; }
  .slide-feed { gap: 22px; }
  .feed-card { border-radius: 13px; }
  .feed-slide { padding: 12px; }
  .feed-note { padding: 16px; }
  .app-footer { padding: 0 15px; }
  .app-footer > span:last-child:not(.footer-status) { display: none; }
  .admin-content { width: min(100% - 26px, 1180px); padding-top: 20px; }
  .admin-intro { align-items: flex-start; flex-direction: column; }
  .admin-lock-note { align-self: flex-start; }
  .admin-card, .published-card { padding: 17px; }
  .published-row { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 470px) {
  .brand { font-size: 17px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-logo { width: 34px; height: 34px; border-radius: 9px; }
  .header-tools { gap: 6px; }
  .slide-navigator-trigger, .history-trigger { width: 38px; padding: 0; justify-content: center; }
  .slide-navigator-trigger span, .slide-navigator-trigger .chevron { display: none; }
  .history-trigger span { display: none; }
  .feed-card-header { min-height: 50px; padding: 0 15px; }
  .feed-note-footer { align-items: flex-start; flex-direction: column; }
  .admin-intro h1 { font-size: 39px; }
  .upload-zone { min-height: 330px; padding: 20px 14px; }
  .primary-button { width: 100%; }
  .published-actions { width: 100%; }
  .published-actions a, .published-actions button { flex: 1; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
