:root {
  color-scheme: light;
  --ink: #182735;
  --muted: #5c6d7b;
  --accent: #a6442b;
  --border: #dce4e9;
  --rail: #142936;
  --canvas: #f3f6f7;
  font-family: 'Instrument Sans', 'Hiragino Sans', 'Yu Gothic UI', Meiryo, sans-serif;
  font-synthesis: none;
  line-height: 1.5;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden], .icon-library { display: none !important; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid #b05137; outline-offset: 3px; }
button:disabled { cursor: default; opacity: .35; }
p, h1, h2 { margin: 0; }
svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 5; padding: 9px 12px; background: white; }
.skip-link:focus { top: 8px; }
.rail { width: 228px; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; background: var(--rail); color: #d5e0e7; z-index: 2; }
.brand { display: flex; align-items: center; gap: 10px; padding: 25px 16px 24px; color: #fff; }
.brand strong { display: block; font-size: .97rem; font-weight: 750; letter-spacing: -.015em; }
.brand small { display: block; font-size: .65rem; margin-top: 3px; color: #acbfca; }
.brand-icon { width: 35px; height: 35px; display: grid; place-items: center; flex: none; border-radius: 10px; color: #142936; background: #e5ebe4; }
.brand-icon svg { width: 24px; height: 24px; }
.rail-nav { padding: 16px 12px; }
.clinic-picker { display: grid; gap: 7px; margin: 0 12px; padding: 13px 10px; border-block: 1px solid #344954; }
.clinic-picker label { color: #cbdbe3; font-size: .72rem; font-weight: 750; }
.clinic-picker select { width: 100%; min-width: 0; border: 1px solid #607784; border-radius: 7px; padding: 8px 7px; color: #fff; background: #293f4c; font: inherit; font-size: .8rem; }
.clinic-picker button { display: inline-flex; gap: 4px; align-items: center; justify-self: start; padding: 4px 0; border: 0; color: #d4e7ef; background: none; font-size: .79rem; }
.clinic-picker button:hover { text-decoration: underline; }
.clinic-picker button svg { width: 15px; height: 15px; }
.rail-nav p { color: #a8bac5; padding: 0 10px 10px; font-size: .7rem; font-weight: 700; letter-spacing: .06em; }
.rail-nav button, .rail-footer a { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; color: inherit; background: transparent; padding: 11px 10px; text-align: left; border-radius: 8px; font-size: .86rem; white-space: nowrap; }
.rail-nav button { margin-bottom: 5px; }
.rail-nav button[aria-current] { background: #2a424d; color: #fff; font-weight: 750; box-shadow: inset 3px 0 #e39780; }
.rail-nav button:hover, .rail-footer a:hover { background: #263e4a; }
.rail-nav button svg { color: #bed2da; }
.nav-count { margin-left: auto; min-width: 21px; padding: 1px 4px; text-align: center; background: #293e4a; border-radius: 5px; font-size: .71rem; color: #c6d6df; }
.rail-footer { margin: auto 12px 16px; padding-top: 10px; border-top: 1px solid #344954; }
.rail-footer a { text-decoration: none; color: #bed2da; font-size: .77rem; }
.rail-footer a svg { width: 17px; height: 17px; }
.workspace { margin-left: 228px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 68px; padding: 0 30px; border-bottom: 1px solid var(--border); background: #fff; }
.toolbar-path { font-size: .79rem; color: var(--muted); }
.toolbar-path span { padding: 0 .45rem; color: #84919b; }
.toolbar-path strong { color: var(--ink); }
.toolbar-actions, .save-state, .export { display: flex; align-items: center; gap: 8px; }
.toolbar-actions { gap: 18px; }
.save-state { color: #516961; font-size: .74rem; white-space: nowrap; }
.save-state svg { width: 16px; height: 16px; border-radius: 50%; background: #e7f1e9; color: #365f49; padding: 2px; }
.save-state[data-error] { color: #983f2e; }
.save-state[data-error] svg { display: none; }
.export { border: 1px solid transparent; border-radius: 7px; background: var(--accent); color: #fff; padding: 9px 13px; font-size: .81rem; font-weight: 750; white-space: nowrap; }
.export:hover { background: #8f3722; }
.export.secondary { color: #354c58; background: #fff; border-color: #ccd8dd; }
.export.secondary:hover { background: #f3f6f7; }
.export svg { width: 17px; height: 17px; }
.main { padding: 30px; margin-inline: auto; max-width: 1660px; }
.main-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.main-header h1 { font-size: clamp(1.45rem, 2.35vw, 2.06rem); font-weight: 800; letter-spacing: .015em; line-height: 1.35; }
.main-header p { margin-top: 7px; color: var(--muted); font-size: .85rem; }
.mode-badge, .live { display: inline-flex; align-items: center; gap: 6px; border-radius: 50px; font-size: .68rem; font-weight: 750; white-space: nowrap; }
.mode-badge { padding: 5px 9px; background: #faece6; color: #8e3e2b; }
.mode-badge > span:first-child, .live span { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.mode-badge[data-real] { background: #e4ecef; color: #2f4e5c; }
.panes { display: grid; grid-template-columns: minmax(310px, .83fr) minmax(0, 1.35fr); gap: 20px; align-items: start; }
.card { border: 1px solid var(--border); border-radius: 13px; background: #fff; box-shadow: 0 2px 5px #112b3a08; min-width: 0; }
.card-header { min-height: 69px; display: flex; align-items: center; gap: 12px; padding: 16px 19px; border-bottom: 1px solid #e6ebee; }
.card-header h2 { font-size: 1rem; font-weight: 800; letter-spacing: .02em; }
.card-header p { color: var(--muted); font-size: .75rem; margin-top: 3px; }
.section-icon { display: grid; place-items: center; width: 37px; height: 37px; background: #f8ede8; color: var(--accent); border-radius: 8px; flex: none; }
#editor-form { display: grid; gap: 18px; padding: 19px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-size: .8rem; font-weight: 750; }
.req { margin-left: 7px; color: #963e28; font-size: .64rem; font-weight: 650; }
.field :is(input, textarea) { width: 100%; min-width: 0; background: #fff; border: 1px solid #cfdbe1; border-radius: 7px; color: var(--ink); padding: 9px 10px; font-size: .82rem; line-height: 1.6; }
.field :is(input, textarea):hover { border-color: #a9bbc6; }
.field :is(input, textarea)[aria-invalid='true'] { border-color: #a6442b; box-shadow: 0 0 0 1px #a6442b; }
.field textarea { resize: vertical; min-height: 73px; }
.field :is(input, textarea)::placeholder { color: #6b7883; }
.field small { color: var(--muted); font-size: .71rem; line-height: 1.55; }
.field .field-error { color: #963e28; }
.tip { display: flex; align-items: flex-start; gap: 9px; padding: 12px; color: #38515e; background: #f0f5f6; border-radius: 8px; font-size: .74rem; line-height: 1.7; }
.tip svg { width: 17px; height: 17px; margin-top: 1px; }
.row { min-width: 0; display: grid; gap: 11px; margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: #f9fbfc; }
.row legend { padding: 0 5px; margin-left: 1px; color: #3e5260; font-weight: 750; font-size: .75rem; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.row-actions button { display: grid; place-items: center; width: 29px; height: 28px; padding: 2px; color: #405766; background: #fff; border: 1px solid var(--border); border-radius: 5px; }
.row-actions button:not(:disabled):hover { background: #edf2f4; }
.row-actions button[data-action='remove'] { color: var(--accent); }
.row-actions svg { width: 15px; height: 15px; }
.add { display: flex; justify-content: center; align-items: center; gap: 7px; width: 100%; border: 1px dashed #c99384; border-radius: 7px; padding: 9px; color: var(--accent); background: #fffaf7; font-size: .82rem; font-weight: 750; }
.add:hover { background: #faeee8; }
.field-group { display: grid; gap: 13px; min-width: 0; margin: 0; border: 0; padding: 0; }
.field-group legend { padding: 0; margin-bottom: 10px; font-size: .83rem; font-weight: 750; }
.field-group + .field-group { border-top: 1px solid var(--border); padding-top: 11px; }
.checkbox { display: flex; align-items: flex-start; gap: 8px; font-weight: 700; font-size: .81rem; }
.checkbox input { margin-top: .23em; accent-color: var(--accent); }
.notice { padding: 10px 14px; margin-bottom: 15px; background: #e8f1eb; border: 1px solid #cddfd3; color: #234d37; border-radius: 8px; font-size: .82rem; }
.notice[data-error] { background: #faeee9; border-color: #efd1c8; color: #8a3421; }
.notice button { margin-left: 10px; padding: 2px 6px; border: 1px solid currentColor; color: inherit; background: transparent; border-radius: 4px; }
.tag-panel { padding: 16px 19px; margin-bottom: 18px; }
.tag-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 5px 12px; }
.tag-heading h2 { font-size: 1rem; }
#delivery-state { font-size: .78rem; color: var(--muted); overflow-wrap: anywhere; }
.tag-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tag-actions input { flex: 1 1 260px; min-width: 0; padding: 8px; border: 1px solid var(--border); border-radius: 7px; font: inherit; font-size: .8rem; }
.schema-preview { overflow: auto; max-height: 65vh; margin: 12px; padding: 14px; border-radius: 8px; background: #eef3f5; color: #263c49; font: .76rem/1.6 'IBM Plex Mono', Consolas, monospace; }
.account-screen { min-height: 100vh; display: grid; align-items: center; justify-items: center; padding: 16px; }
.account-card { width: min(100%, 420px); padding: 26px; }
.account-card h1 { font-size: 1.45rem; margin: 6px 0; }
.account-brand { color: var(--accent); font-weight: 750; }
.account-copy { color: var(--muted); font-size: .82rem; margin: 6px 0; }
.account-card form, .invite-result { display: grid; gap: 12px; margin-block: 14px; }
.account-card button { justify-self: start; }
.rail-footer button { border: 0; background: transparent; color: #bed2da; font: inherit; font-size: .77rem; padding: 8px 10px; }
.rail-footer button:hover { color: white; text-decoration: underline; }
.empty-state { max-width: 580px; padding: 36px; display: grid; justify-items: start; gap: 14px; }
.empty-state h1 { font-size: clamp(1.35rem, 2.4vw, 2rem); }
.empty-state p { color: var(--muted); font-size: .9rem; }
dialog { width: min(calc(100% - 32px), 420px); border: 1px solid var(--border); border-radius: 13px; padding: 22px; color: var(--ink); box-shadow: 0 15px 45px #112b3a38; }
dialog::backdrop { background: #10263380; }
dialog form { display: grid; gap: 15px; }
dialog h2 { font-size: 1.1rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
#clinic-dialog-error { color: #963e28; font-size: .8rem; }
.preview { position: sticky; top: 16px; }
.preview-heading { justify-content: space-between; }
.preview-heading > div:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 9px; }
.live { padding: 3px 7px; color: #31644b; background: #e7f2e9; }
.view-switch { display: flex; gap: 2px; border: 1px solid #dce4e8; background: #f5f7f8; padding: 2px; border-radius: 7px; }
.view-switch button { display: grid; place-items: center; width: 32px; height: 27px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--muted); }
.view-switch button[aria-pressed='true'] { color: var(--ink); background: white; border-color: #dce4e8; }
.view-switch svg { width: 16px; height: 16px; }
.preview-shell { margin: 13px; background: #eaf0f1; border: 1px solid #dce4e8; border-radius: 8px; overflow: hidden; }
.browser-bar { display: flex; gap: 9px; align-items: center; padding: 8px 10px; background: #f1f4f5; border-bottom: 1px solid #dce4e8; }
.browser-dots { display: flex; gap: 4px; padding-inline: 1px 4px; }
.browser-dots i { width: 6px; height: 6px; border-radius: 50%; background: #bfcbd0; }
.address { display: flex; align-items: center; gap: 5px; overflow: hidden; min-width: 0; padding: 4px 8px; background: #fff; border-radius: 4px; flex: 1; font-size: .66rem; color: #596b77; }
.address svg { width: 12px; height: 12px; }
.address span { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; }
.device { width: 100%; margin-inline: auto; background: #fffdfa; }
.device[data-mobile] { max-width: 390px; box-shadow: 0 0 0 1px #d4dee2; }
iframe { display: block; width: 100%; height: clamp(490px, 66vh, 860px); border: 0; }
@media (max-width: 1220px) {
  .rail { width: 195px; }
  .workspace { margin-left: 195px; }
  .main { padding: 23px; }
  .toolbar { padding-inline: 23px; }
  .brand { padding-inline: 12px; }
  .brand strong { font-size: .85rem; }
}
@media (max-width: 970px) {
  .rail { position: static; width: auto; }
  .workspace { margin-left: 0; }
  .brand { padding: 12px 16px 8px; }
  .clinic-picker { grid-template-columns: auto minmax(0, 380px) auto; align-items: center; justify-content: start; gap: 9px; }
  .rail-nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 12px 9px; }
  .rail-nav p { display: none; }
  .rail-footer { display: flex; flex-wrap: wrap; padding-top: 0; margin: 0 12px 7px; }
  .rail-footer a { width: auto; }
  .rail-nav button { width: auto; margin: 0; padding: 7px 9px; font-size: .74rem; gap: 5px; }
  .rail-nav button svg { width: 15px; height: 15px; }
  .toolbar { min-height: 54px; }
}
@media (max-width: 690px) {
  .panes { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .preview { position: static; }
  .toolbar { padding: 8px 13px; justify-content: flex-end; }
  .toolbar-path { display: none; }
  .toolbar-actions { gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
  .main { padding: 16px 12px 26px; }
  .main-header { margin-bottom: 16px; align-items: flex-start; }
  .main-header p { font-size: .76rem; }
  .preview-shell { margin: 8px; }
  iframe { height: min(72vh, 660px); }
}
