:root {
  color-scheme: light;
  --ink: #122f2d;
  --ink-2: #1c4440;
  --paper: #f7f6f1;
  --white: #fff;
  --line: #d8ddd8;
  --muted: #62706c;
  --coral: #ee6c55;
  --green: #2c9166;
  --danger: #b44040;
  --shadow: 0 22px 70px rgba(18, 47, 45, .12);
  --radius: 18px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); }
body { margin: 0; min-width: 320px; background: var(--paper); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
[hidden] { display: none !important; }

.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 80% 10%, #d8ebe1, transparent 36%), var(--paper); }
.auth-card { width: min(100%, 470px); padding: clamp(28px, 5vw, 50px); border: 1px solid var(--line); border-radius: 26px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.admin-brand { display: flex; align-items: center; gap: 12px; }
.admin-brand strong, .admin-brand small { display: block; }
.admin-brand small { margin-top: 2px; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 50%; background: var(--ink); color: white; font-size: 20px; }
.auth-card .admin-brand { margin-bottom: 48px; }
.eyebrow { margin: 0 0 10px; color: var(--coral); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
.auth-card h1 { margin-bottom: 10px; font-size: clamp(34px, 8vw, 54px); font-weight: 500; letter-spacing: -.05em; }
.auth-card > div > p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
form label, .field { display: grid; gap: 8px; color: var(--ink); font-size: 12px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 12px; outline: none; background: white; color: var(--ink); font-size: 15px; font-weight: 450; letter-spacing: 0; text-transform: none; transition: border-color .18s, box-shadow .18s; }
input, select { height: 48px; padding: 0 14px; }
textarea { min-height: 108px; resize: vertical; padding: 14px; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(18,47,45,.09); }
label small { color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; }
.auth-card form { display: grid; gap: 18px; margin-top: 28px; }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px; border: 1px solid transparent; border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 800; letter-spacing: .08em; text-decoration: none; text-transform: uppercase; transition: transform .18s, background .18s, color .18s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button.primary { background: var(--ink); color: white; }
.button.secondary { border-color: var(--line); background: white; color: var(--ink); }
.button.light { background: white; color: var(--ink); }
.button.outline-light { border-color: rgba(255,255,255,.35); color: white; }
.text-button { padding: 0; border: 0; background: none; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.icon-button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: white; cursor: pointer; }
.message { min-height: 24px; margin: 0 0 12px; color: var(--green); font-size: 13px; }
.message.error { color: var(--danger); }

.admin-app { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 26px 18px; border-right: 1px solid rgba(255,255,255,.1); background: var(--ink); color: white; }
.sidebar .admin-brand { padding: 0 10px 32px; }
.sidebar .brand-mark { background: white; color: var(--ink); }
.sidebar .admin-brand small { color: rgba(255,255,255,.58); }
.sidebar nav { display: grid; gap: 5px; }
.nav-item { display: grid; grid-template-columns: 28px 1fr; align-items: center; min-height: 48px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; color: rgba(255,255,255,.68); cursor: pointer; text-align: left; }
.nav-item span { font-size: 10px; opacity: .65; }
.nav-item:hover, .nav-item.is-active { background: rgba(255,255,255,.1); color: white; }
.sidebar-footer { display: grid; gap: 8px; margin-top: auto; padding: 18px 10px 0; border-top: 1px solid rgba(255,255,255,.12); font-size: 12px; }
.sidebar-footer span { overflow: hidden; color: rgba(255,255,255,.68); text-overflow: ellipsis; }
.sidebar-footer .text-button { width: max-content; color: white; }
.mobile-header { display: none; }

.workspace { min-width: 0; padding: 26px clamp(22px, 4vw, 60px) 60px; }
.workspace-header { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.workspace-header h1 { margin: 0; font-size: clamp(28px, 3vw, 42px); font-weight: 520; letter-spacing: -.04em; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.save-state { margin-right: 8px; color: var(--muted); font-size: 12px; }
.save-state.is-dirty { color: var(--coral); }
.view { display: none; }
.view.is-active { display: block; }

.hero-panel { min-height: 300px; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 32px; padding: clamp(28px, 5vw, 60px); border-radius: 24px; background: linear-gradient(135deg, rgba(18,47,45,.96), rgba(28,68,64,.9)), url('/preview/assets/hero-slider/clinic-sign.webp') center/cover; color: white; box-shadow: var(--shadow); }
.hero-panel h2 { max-width: 680px; margin-bottom: 18px; font-size: clamp(36px, 5vw, 68px); font-weight: 450; letter-spacing: -.055em; line-height: .98; }
.hero-panel p:not(.eyebrow) { max-width: 580px; margin: 0; color: rgba(255,255,255,.72); line-height: 1.6; }
.hero-panel-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 16px; }
.summary-grid article { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.summary-grid span { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.summary-grid strong { display: block; margin: 20px 0 8px; font-size: 32px; font-weight: 550; }
.summary-grid p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.workflow { margin-top: 16px; padding: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.workflow h2 { font-weight: 520; }
.workflow ol { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin: 28px 0 0; padding: 0; list-style: none; counter-reset: workflow; }
.workflow li { display: grid; gap: 7px; counter-increment: workflow; }
.workflow li::before { content: "0" counter(workflow); color: var(--coral); font-size: 11px; font-weight: 800; }
.workflow li span { color: var(--muted); font-size: 13px; line-height: 1.45; }

.toolbar-card { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 16px; padding: 24px 26px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.toolbar-card h2 { margin-bottom: 6px; font-size: 24px; font-weight: 550; }
.toolbar-card p { margin: 0; color: var(--muted); font-size: 14px; }
.tabs, .device-switch { display: inline-flex; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); }
.tabs button, .device-switch button { min-width: 48px; height: 34px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; cursor: pointer; font-size: 12px; font-weight: 750; }
.tabs button.is-active, .device-switch button.is-active { background: var(--ink); color: white; }
.editor-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; }
.subnav { height: max-content; display: grid; gap: 4px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.subnav button { min-height: 42px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; text-align: left; }
.subnav button:hover, .subnav button.is-active { background: #edf2ee; }
.form-card { display: grid; gap: 20px; padding: clamp(22px, 4vw, 36px); border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.form-card h3 { margin: 0 0 2px; font-size: 22px; }
.field-hint { margin: -4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.media-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.media-preview { aspect-ratio: 16/10; background: #e8ece8; }
.media-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.media-card-body { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 16px; }
.media-card-body > div { min-width: 0; }
.media-card h3 { margin: 0 0 4px; font-size: 15px; }
.media-card p { margin: 0; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.file-button { position: relative; overflow: hidden; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.compact-label { min-width: 220px; display: grid; gap: 6px; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.gallery-editor { display: grid; gap: 16px; }
.gallery-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.gallery-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.gallery-item { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: white; }
.gallery-item img { width: 100%; aspect-ratio: 1; display: block; object-fit: cover; background: #e8ece8; }
.gallery-item-controls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; padding: 8px; }
.gallery-item-controls button { min-height: 34px; border: 1px solid var(--line); border-radius: 8px; background: white; cursor: pointer; }
.gallery-item-controls button:last-child { color: var(--danger); }
.gallery-caption { padding: 0 8px 8px; }
.gallery-caption input { height: 38px; font-size: 12px; }

.settings-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-form h3, .settings-form .full { grid-column: 1 / -1; }
.schedule-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.schedule-row { display: grid; grid-template-columns: 1fr 96px 96px; align-items: center; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.schedule-row label { display: block; font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.schedule-row input { height: 40px; padding: 0 8px; }

.history-list { display: grid; gap: 10px; }
.history-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px; padding: 20px 24px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.history-item strong, .history-item span { display: block; }
.history-item span { margin-top: 5px; color: var(--muted); font-size: 12px; }
.empty-state { padding: 50px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); text-align: center; }

.preview-shell { min-height: 720px; display: flex; justify-content: center; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #dfe5e1; }
.preview-shell iframe { width: 100%; height: 78vh; min-height: 680px; border: 0; background: white; transition: width .25s; }
.preview-shell.is-mobile iframe { width: 390px; }
.confirm-dialog { width: min(92vw, 480px); padding: 0; border: 0; border-radius: 22px; box-shadow: var(--shadow); }
.confirm-dialog::backdrop { background: rgba(10,28,27,.62); backdrop-filter: blur(4px); }
.confirm-dialog form { padding: 34px; }
.confirm-dialog h2 { font-size: 28px; }
.confirm-dialog p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.confirm-dialog form > div { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; }

@media (max-width: 1100px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .save-state { display: none; }
}

@media (max-width: 760px) {
  .admin-app { display: block; }
  .sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; width: min(84vw, 300px); transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-header { position: sticky; z-index: 10; top: 0; display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--line); background: rgba(247,246,241,.94); backdrop-filter: blur(12px); }
  .mobile-header .brand-mark { width: 34px; height: 34px; }
  .workspace { padding: 20px 16px 50px; }
  .workspace-header { display: block; }
  .header-actions { position: sticky; z-index: 8; bottom: 10px; display: grid; grid-template-columns: 1fr 1fr; margin-top: 18px; padding: 8px; border: 1px solid var(--line); border-radius: 999px; background: rgba(247,246,241,.96); box-shadow: 0 12px 35px rgba(18,47,45,.13); }
  .hero-panel { grid-template-columns: 1fr; }
  .summary-grid, .workflow ol, .settings-form, .schedule-grid { grid-template-columns: 1fr; }
  .editor-layout { grid-template-columns: 1fr; }
  .subnav { display: flex; overflow-x: auto; }
  .subnav button { flex: 0 0 auto; }
  .toolbar-card { align-items: stretch; flex-direction: column; }
  .tabs { align-self: flex-start; }
  .media-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-form h3, .settings-form .full { grid-column: auto; }
  .schedule-grid { grid-column: auto; }
  .schedule-row { grid-template-columns: 1fr 90px 90px; }
  .preview-view .toolbar-card { gap: 16px; }
  .device-switch { align-self: flex-start; }
}

@media (max-width: 430px) {
  .summary-grid { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .gallery-item-controls button { min-width: 0; }
  .schedule-row { grid-template-columns: 1fr 82px 82px; padding: 10px 8px; }
}
