:root {
    --ink: #0b1324;
    --ink-soft: #33405a;
    --muted: #69758b;
    --navy: #28384d;
    --navy-deep: #172437;
    --blue: #2457d6;
    --blue-strong: #183ea3;
    --blue-soft: #eaf0ff;
    --mint: #4ed7bd;
    --jade: #087a67;
    --amber: #d08a13;
    --red: #cf3c4f;
    --action-navigation: #405168;
    --action-navigation-soft: #f7f9fb;
    --action-navigation-strong: #27384d;
    --action-function: #405168;
    --action-function-soft: #f7f9fb;
    --action-function-strong: #27384d;
    --action-layer: #405168;
    --action-layer-soft: #f7f9fb;
    --action-layer-strong: #27384d;
    --action-save: #405168;
    --action-save-soft: #f7f9fb;
    --action-save-strong: #27384d;
    --action-batch: #405168;
    --action-batch-soft: #f7f9fb;
    --action-batch-strong: #27384d;
    --action-delete: #b92f45;
    --action-delete-soft: #fff1f3;
    --action-delete-strong: #9f2438;
    --paper: #f7f6f3;
    --paper-warm: #f6f4ee;
    --surface: #ffffff;
    --surface-alt: #f8fafb;
    --line: #dce2e9;
    --line-strong: #c7d0dc;
    --shadow-sm: 0 2px 7px rgba(15, 34, 68, 0.05);
    --shadow-md: 0 12px 28px rgba(15, 34, 68, 0.10);
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 22px;
    --sidebar-width: 252px;
    --header-height: 68px;
    --content-gutter: 16px;
    --header-gutter: 20px;
    --sidebar-gutter: 14px;
    --font: Pretendard, "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}

* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #9aa9bd transparent;
}

*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #9aa9bd; background-clip: padding-box; border: 2px solid transparent; border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background-color: #71839a; }

html { min-width: 320px; color-scheme: light; scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--paper);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.55;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--blue) 62%, white);
    outline-offset: 2px;
}

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 8px;
    left: 8px;
    padding: 10px 16px;
    color: #fff;
    background: var(--navy-deep);
    border-radius: 8px;
    transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.survey-flow { margin-bottom: 18px; overflow-x: auto; color: var(--muted); }
.survey-flow ol { display: grid; grid-template-columns: repeat(4, minmax(190px, 1fr)); min-width: 820px; margin: 0; padding: 0; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 14px; list-style: none; box-shadow: var(--shadow-sm); }
.survey-flow li { position: relative; min-width: 0; border-right: 1px solid var(--line); }
.survey-flow li:last-child { border-right: 0; }
.survey-flow li > .survey-flow-step, .survey-flow li > a, .survey-flow li > button { display: grid; gap: 1px; width: 100%; min-height: 68px; padding: 11px 18px; text-align: left; background: transparent; border: 0; }
.survey-flow li > a, .survey-flow li > button { cursor: pointer; }
.survey-flow li > a:hover, .survey-flow li > button:hover { color: var(--blue); background: var(--blue-soft); }
.survey-flow li > button:disabled { color: var(--muted); cursor: not-allowed; opacity: .58; }
.survey-flow li > button:disabled:hover { background: transparent; }
.survey-flow .survey-flow-step > span, .survey-flow li > a > span, .survey-flow li > button > span { color: #8794a8; font-size: 8px; font-weight: 900; letter-spacing: .1em; }
.survey-flow strong { color: var(--ink); font-size: 13px; }
.survey-flow small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.survey-flow .is-complete { background: #f8fbff; }
.survey-flow .is-complete::after { position: absolute; top: 9px; right: 11px; color: var(--jade); content: "✓"; font-weight: 900; }
.survey-flow .is-current { background: linear-gradient(110deg, var(--blue-soft), #fff); box-shadow: inset 0 3px 0 var(--blue); }
.survey-flow .is-current .survey-flow-step > span:first-child { color: var(--blue); }
.survey-flow-builder { margin: 0; padding: 12px 18px; background: #edf1f6; }
.survey-flow-builder ol { max-width: 940px; margin: 0 auto; }

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template: var(--header-height) 1fr / var(--sidebar-width) minmax(0, 1fr);
}

.app-header {
    position: sticky;
    z-index: 60;
    top: 0;
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 38px 190px minmax(0, 1fr) auto;
    align-items: center;
    height: var(--header-height);
    padding: 0 var(--header-gutter);
    color: var(--ink);
    background: rgba(241, 246, 248, .98);
    border-bottom: 1px solid #d3dce3;
    box-shadow: 0 2px 12px rgba(15, 34, 68, .04);
    backdrop-filter: blur(12px);
}

.brand { width: 186px; display: flex; align-items: center; }
.brand img { width: 184px; height: auto; filter: brightness(0) saturate(100%) opacity(.82); }

.header-context { display: flex; gap: 16px; align-items: center; min-width: 0; padding-left: 12px; }
.workspace-chip {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    min-height: 44px;
    padding: 5px 11px 5px 6px;
    color: var(--ink);
    background: #f7f8fa;
    border: 1px solid var(--line);
    border-radius: 11px;
    cursor: pointer;
    text-decoration: none;
}
.workspace-chip:hover { background: #f0f3f6; }
.workspace-chip:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 60%, white); outline-offset: 2px; }
.workspace-chip > span:nth-child(2) { display: grid; text-align: left; }
.workspace-chip small { color: var(--muted); font-size: 10px; line-height: 1.1; }
.workspace-chip strong { max-width: 210px; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.workspace-mark {
    display: grid;
    place-items: center;
    width: 31px;
    height: 31px;
    color: #245f55;
    background: #dff3ef;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 900;
}
.header-page-context { display: grid; min-width: 0; padding-left: 16px; border-left: 1px solid var(--line); }
.header-page-context a { width: fit-content; color: var(--muted); text-decoration: none; }
.header-page-context a:hover { color: var(--ink); text-decoration: underline; }
.header-page-context a:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.header-page-context span { display: block; overflow: hidden; font-size: 9px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.header-page-context h1 { max-width: min(32vw, 430px); margin: 0; overflow: hidden; color: var(--ink); font-size: 14px; line-height: 1.3; letter-spacing: -.025em; text-overflow: ellipsis; white-space: nowrap; }

.header-actions { position: relative; display: flex; gap: 9px; align-items: center; }
.header-page-actions { display: flex; gap: 9px; align-items: center; margin-right: 3px; }
.header-page-actions .save-state { color: var(--muted); white-space: nowrap; }
.header-page-actions .button { min-height: 36px; box-shadow: none; }
.header-session { display: inline-flex; flex: 0 0 auto; gap: 6px; align-items: center; min-height: 34px; padding: 4px 5px 4px 9px; color: #45566b; background: rgba(255,255,255,.68); border: 1px solid #cbd6df; border-radius: 9px; white-space: nowrap; }
.header-session-label { color: #667487; font-size: 9px; font-weight: 750; }
.header-session-time { min-width: 58px; color: #256353; font-family: Consolas, "SFMono-Regular", monospace; font-size: 11px; text-align: center; }
.header-session button { min-height: 26px; padding: 3px 7px; color: #334d70; background: #fff; border: 1px solid #bdc9d6; border-radius: 6px; cursor: pointer; font-size: 9px; font-weight: 800; }
.header-session button:hover { color: #183e8f; background: #edf3ff; border-color: #9fb1ce; }
.header-session button:disabled { cursor: wait; opacity: .6; }
.header-session.is-warning { color: #7a4d00; background: #fff8e7; border-color: #e6c66f; }
.header-session.is-warning .header-session-time { color: #a75b00; }
.header-session.is-critical { color: #8e2432; background: #fff0f2; border-color: #e4a5ae; }
.header-session.is-critical .header-session-time { color: #b3263c; }
.header-page-refresh {
    display: inline-flex;
    gap: 7px;
    align-items: center;
    min-height: 44px;
    padding: 7px 10px;
    color: #53627a;
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}
.header-page-refresh > span:first-child { display: grid; place-items: center; width: 24px; height: 24px; font-size: 22px; line-height: 1; }
.header-page-refresh-label { font-size: 11px; font-weight: 750; }
.header-page-refresh:hover { color: var(--ink); background: #f1f3f6; }
.header-page-refresh:disabled { cursor: wait; opacity: .65; }
.header-page-refresh.is-refreshing > span:first-child { animation: page-refresh-spin .7s linear infinite; }
@keyframes page-refresh-spin { to { transform: rotate(360deg); } }
.header-help {
    display: inline-flex;
    gap: 7px;
    align-items: center;
    min-height: 44px;
    padding: 9px 12px;
    color: #53627a;
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
}
.header-help > span:first-child { display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid #aeb9c7; border-radius: 50%; font-size: 11px; font-weight: 900; }
.header-help:hover { background: #f1f3f6; }
.user-button {
    display: flex;
    gap: 9px;
    align-items: center;
    min-width: 130px;
    padding: 6px 8px;
    color: var(--ink);
    background: transparent;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
}
.user-button:hover { background: #f1f3f6; }
.user-avatar {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    color: var(--navy-deep);
    background: #eef1f4;
    border-radius: 50%;
    font-weight: 800;
}
.user-copy { display: grid; flex: 1; text-align: left; }
.user-copy strong { font-size: 12px; }
.user-copy small { color: var(--muted); font-size: 10px; }
.user-menu {
    position: absolute;
    z-index: 70;
    top: calc(100% + 10px);
    right: 0;
    min-width: 180px;
    padding: 7px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}
.user-menu button { width: 100%; padding: 9px 11px; text-align: left; background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.user-menu button:hover { background: var(--blue-soft); color: var(--blue-strong); }
.user-menu-security { margin: 0 0 5px; padding: 9px 11px; color: #7a4c00; background: #fff8e8; border-radius: 8px; font-size: 9px; line-height: 1.45; }

.icon-button.mobile-menu-button { display: inline-grid; color: #405168; }
.icon-button {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    color: currentColor;
    background: transparent;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 22px;
}
.icon-button:hover { background: rgba(128, 145, 170, 0.12); }

.app-sidebar {
    position: fixed;
    z-index: 50;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    padding: 18px var(--sidebar-gutter);
    overflow-y: auto;
    color: var(--ink-soft);
    background: #eaf0f4;
    border-right: 1px solid #d2dce4;
    scrollbar-color: #aeb9c7 transparent;
    transition: transform .2s ease, visibility .2s ease;
}
.app-sidebar::-webkit-scrollbar-thumb { background-color: #aeb9c7; }
.app-sidebar::-webkit-scrollbar-thumb:hover { background-color: #8795a8; }
.app-navigation { flex: 1; }
.nav-group { margin-bottom: 10px; }
.nav-group-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 10px;
    color: #6d788a;
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .025em;
    text-transform: uppercase;
}
.nav-group-label > span { display: flex; gap: 9px; align-items: center; }
.nav-group-label i { font-style: normal; transition: transform .18s ease; }
.nav-group.is-collapsed .nav-group-label i { transform: rotate(-90deg); }
.nav-group.is-collapsed .nav-group-items { display: none; }
.nav-group-items { display: grid; gap: 3px; }
.nav-group-items a {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 39px;
    padding: 8px 11px 8px 37px;
    color: #445269;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 650;
}
.nav-group-items a::before {
    position: absolute;
    left: 18px;
    width: 5px;
    height: 5px;
    background: #a7b1bf;
    border-radius: 50%;
    content: "";
}
.nav-group-items a:hover { color: var(--ink); background: rgba(255,255,255,.58); }
.nav-group-items a.is-active { color: #173f8f; background: #d8e4f2; }
.nav-group-items a.is-active::before { width: 4px; height: 16px; left: 14px; background: #6d8fcf; border-radius: 5px; }
.sidebar-upgrade {
    margin: 14px 2px 10px;
    padding: 12px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 11px;
}
.sidebar-upgrade strong { display: block; margin: 0 0 9px; font-size: 12px; }
.sidebar-auth-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sidebar-auth-actions .button { min-height: 36px; padding: 7px 9px; font-size: 11px; }
.sidebar-copyright { margin: 6px 8px; color: #8a95a5; font-size: 10px; }
.sidebar-scrim { display: none; }

@media (min-width: 72.01rem) {
    body.sidebar-collapsed .app-shell { grid-template-columns: 0 minmax(0, 1fr); }
    body.sidebar-collapsed .app-sidebar { visibility: hidden; transform: translateX(-105%); }
}

.app-main { grid-column: 2; min-width: 0; }
.save-state { display: inline-flex; gap: 7px; align-items: center; color: var(--muted); font-size: 11px; }
.save-state i { width: 7px; height: 7px; background: var(--mint); border-radius: 50%; box-shadow: 0 0 0 3px rgba(78,215,189,.18); }
.page-host { width: 100%; max-width: none; min-height: calc(100vh - var(--header-height)); margin: 0; padding: var(--content-gutter); outline: none; }
.route-view { width: 100%; min-width: 0; }
.mobile-bottom-nav { display: none; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 9px 16px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 750;
    line-height: 1.2;
    transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.button:hover { border-color: #9babc0; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.button-primary { color: #fff; background: var(--blue); border-color: var(--blue); }
.button-primary:hover { background: var(--blue-strong); border-color: var(--blue-strong); }
.button-secondary { color: var(--blue-strong); background: var(--blue-soft); border-color: #c8d6ff; }
.button-success { color: #fff; background: var(--jade); border-color: var(--jade); }
.button-danger { color: var(--red); background: #fff5f6; border-color: #f1c3c9; }
.button-dark { color: #fff; background: var(--navy); border-color: var(--navy); }
.button-light { color: var(--navy-deep); background: #fff; border-color: #fff; }
.button-ghost { background: transparent; border-color: transparent; }
.button-small { min-height: 36px; padding: 7px 12px; font-size: 12px; border-radius: 9px; }
.button-block { width: 100%; }
.button-icon { width: 40px; padding: 0; }

/*
 * Content action language
 * navigation = another page/workspace, function = current screen only,
 * layer = dialog/editor, save = persistent write, batch = queued/stateful work,
 * delete = destructive removal. App menus and navigation bars keep their own UI.
 */
.button.button-navigation,
.button.button-function,
.button.button-layer,
.button.button-save,
.button.button-batch,
.button.button-delete {
    --action-color: var(--action-function);
    --action-soft: var(--action-function-soft);
    --action-strong: var(--action-function-strong);
    color: var(--action-color);
    background: var(--action-soft);
    border-color: color-mix(in srgb, var(--action-color) 36%, white);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--action-color) 5%, transparent);
}
.button.button-navigation { --action-color: var(--action-navigation); --action-soft: var(--action-navigation-soft); --action-strong: var(--action-navigation-strong); }
.button.button-layer { --action-color: var(--action-layer); --action-soft: var(--action-layer-soft); --action-strong: var(--action-layer-strong); }
.button.button-save { --action-color: var(--action-save); --action-soft: var(--action-save-soft); --action-strong: var(--action-save-strong); }
.button.button-batch { --action-color: var(--action-batch); --action-soft: var(--action-batch-soft); --action-strong: var(--action-batch-strong); }
.button.button-delete { --action-color: var(--action-delete); --action-soft: var(--action-delete-soft); --action-strong: var(--action-delete-strong); }
.button.button-navigation:hover,
.button.button-function:hover,
.button.button-layer:hover,
.button.button-save:hover,
.button.button-batch:hover,
.button.button-delete:hover {
    color: var(--action-strong);
    background: color-mix(in srgb, var(--action-soft) 72%, white);
    border-color: color-mix(in srgb, var(--action-color) 62%, white);
    box-shadow: 0 4px 11px color-mix(in srgb, var(--action-color) 13%, transparent);
}
.button.button-important {
    min-height: 42px;
    color: #fff;
    background: var(--action-strong, var(--blue-strong));
    border-color: var(--action-strong, var(--blue-strong));
    box-shadow: 0 7px 16px color-mix(in srgb, var(--action-strong, var(--blue-strong)) 23%, transparent);
    font-weight: 850;
}
.button.button-important:hover {
    color: #fff;
    background: color-mix(in srgb, var(--action-strong, var(--blue-strong)) 88%, black);
    border-color: color-mix(in srgb, var(--action-strong, var(--blue-strong)) 88%, black);
    box-shadow: 0 9px 20px color-mix(in srgb, var(--action-strong, var(--blue-strong)) 29%, transparent);
}
.button:is(.button-navigation, .button-function, .button-layer, .button-save, .button-batch, .button-delete):not(.button-icon)::before {
    display: inline-block;
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    color: currentColor;
    content: "";
}
.button.button-navigation:not(.button-icon)::before {
    width: 8px;
    height: 8px;
    margin-right: 2px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(45deg);
}
.button.button-navigation-back:not(.button-icon)::before { transform: rotate(-135deg); }
.button.button-function:not(.button-icon)::before {
    border: 2px solid currentColor;
    border-radius: 50%;
    box-shadow: inset 0 0 0 3px var(--action-soft);
}
.button.button-layer:not(.button-icon)::before {
    width: 10px;
    height: 9px;
    border: 1.5px solid currentColor;
    border-radius: 2px;
    box-shadow: 3px -3px 0 -1px var(--action-soft), 3px -3px 0 0 currentColor;
}
.button.button-save:not(.button-icon)::before {
    width: 9px;
    height: 6px;
    margin: -2px 1px 2px 0;
    border-bottom: 2px solid currentColor;
    border-left: 2px solid currentColor;
    transform: rotate(-45deg);
}
.button.button-batch:not(.button-icon)::before {
    background:
        linear-gradient(currentColor 0 0) 0 0 / 5px 5px no-repeat,
        linear-gradient(currentColor 0 0) 100% 0 / 5px 5px no-repeat,
        linear-gradient(currentColor 0 0) 0 100% / 5px 5px no-repeat,
        linear-gradient(currentColor 0 0) 100% 100% / 5px 5px no-repeat;
    border-radius: 2px;
}
.button.button-delete:not(.button-icon)::before {
    width: 9px;
    height: 10px;
    border: 1.5px solid currentColor;
    border-top-width: 2px;
    border-radius: 1px 1px 3px 3px;
    box-shadow: 0 -3px 0 -1px var(--action-soft), 0 -4px 0 -1px currentColor;
}
.button.button-important::before { box-shadow: none; }
.button.button-important.button-function::before { box-shadow: inset 0 0 0 3px var(--action-strong); }
.button.button-important.button-layer::before { box-shadow: 3px -3px 0 -1px var(--action-strong), 3px -3px 0 0 currentColor; }
.button.button-important.button-delete::before { box-shadow: 0 -3px 0 -1px var(--action-strong), 0 -4px 0 -1px currentColor; }
.button.button-important:disabled::before { opacity: .8; }
.button.button-cue-hidden::before { display: none !important; }
.icon-button.icon-button-delete {
    color: var(--action-delete);
    background: var(--action-delete-soft);
    border: 1px solid color-mix(in srgb, var(--action-delete) 34%, white);
}
.icon-button.icon-button-delete:hover {
    color: var(--action-delete-strong);
    background: #fff;
    border-color: color-mix(in srgb, var(--action-delete) 62%, white);
}
.icon-button.icon-button-layer {
    color: var(--action-layer);
    background: var(--action-layer-soft);
    border: 1px solid color-mix(in srgb, var(--action-layer) 28%, white);
}
.icon-button.icon-button-layer:hover {
    color: var(--action-layer-strong);
    background: #fff;
    border-color: color-mix(in srgb, var(--action-layer) 54%, white);
}
.workspace-list-button {
    flex: 0 0 auto;
    min-height: 40px;
    color: #264463;
    background: #fff;
    border-color: #b9c7da;
    box-shadow: 0 1px 2px rgba(18, 43, 77, .04);
    white-space: nowrap;
}
.workspace-list-button:hover { color: var(--blue-strong); border-color: #8fa9d4; background: #f8fbff; }
.workspace-list-button-icon { display: inline-grid; place-items: center; width: 18px; height: 18px; font-size: 17px; font-weight: 850; line-height: 1; }

.eyebrow { color: var(--blue); font-size: 10px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.section-kicker { color: var(--blue); font-weight: 800; }
.muted { color: var(--muted); }
.text-success { color: var(--jade); }
.text-danger { color: var(--red); }
.text-right { text-align: right; }

.page-section { margin-bottom: 24px; }
.section-heading {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 14px;
}
.section-heading h2 { margin: 2px 0 0; font-size: clamp(17px, 2vw, 21px); letter-spacing: -.035em; }
.section-heading p { max-width: 620px; margin: 4px 0 0; color: var(--muted); }
.section-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.card-header h2, .card-header h3 { margin: 0; font-size: 16px; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; background: var(--surface-alt); border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.metric-card { position: relative; min-height: 126px; padding: 20px; overflow: hidden; }
.metric-card::after { position: absolute; right: -18px; bottom: -32px; width: 90px; height: 90px; background: var(--blue-soft); border-radius: 50%; content: ""; }
.metric-label { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-value { display: flex; align-items: baseline; gap: 5px; margin-top: 14px; font-size: 30px; font-weight: 850; letter-spacing: -.05em; }
.metric-value small { color: var(--muted); font-size: 12px; font-weight: 600; }
.metric-trend { margin-top: 5px; color: var(--jade); font-size: 11px; font-weight: 700; }

.status-badge, .tag {
    display: inline-flex;
    gap: 5px;
    align-items: center;
    width: max-content;
    padding: 4px 8px;
    color: #42506a;
    background: #eef1f5;
    border: 1px solid #e0e5ec;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}
.status-badge::before { width: 6px; height: 6px; background: #78869c; border-radius: 50%; content: ""; }
.status-draft { color: #6b54a8; background: #f4f0ff; border-color: #dfd3fc; }
.status-draft::before { background: #825ec9; }
.status-published, .status-active { color: #08705f; background: #eafaf5; border-color: #bceadc; }
.status-published::before, .status-active::before { background: #16a385; }
.status-confirmed { color: #2457b8; background: #eef4ff; border-color: #cbdafa; }
.status-confirmed::before { background: #2c63d6; }
.status-closed { color: #526074; background: #edf0f4; }
.status-paused { color: #9a650b; background: #fff7e7; border-color: #f2d99f; }
.status-paused::before { background: #d79624; }
.tag { color: var(--blue-strong); background: var(--blue-soft); border-color: #d1dcff; }
.tag::before { display: none; }

.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
}
.toolbar-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-field { position: relative; min-width: min(290px, 100%); }
.search-field::before { position: absolute; top: 50%; left: 12px; color: var(--muted); content: "⌕"; transform: translateY(-53%); font-size: 18px; }
.search-field input { width: 100%; padding-left: 36px; }

label { color: #33405a; font-size: 12px; font-weight: 750; }
input, select, textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    outline: none;
}
textarea { min-height: 92px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #97a8bf; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36,87,214,.12); }
input::placeholder, textarea::placeholder { color: #98a4b5; }
.form-grid { display: grid; gap: 14px; }
.form-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-field { display: grid; gap: 6px; }
.field-help { color: var(--muted); font-size: 10px; font-weight: 500; }
.check-label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; font-weight: 600; }
.check-label input { flex: 0 0 auto; width: 17px; min-height: 17px; margin: 1px 0 0; accent-color: var(--blue); }
.segmented-control { display: inline-flex; padding: 3px; background: #edf1f6; border: 1px solid var(--line); border-radius: 10px; }
.segmented-control button { min-height: 32px; padding: 6px 11px; color: var(--muted); background: transparent; border: 0; border-radius: 7px; cursor: pointer; font-size: 11px; font-weight: 750; }
.segmented-control button[aria-selected="true"], .segmented-control button.is-active { color: var(--blue-strong); background: #fff; box-shadow: 0 1px 4px rgba(10,30,60,.1); }

.data-table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.data-table th { padding: 11px 13px; color: #5f6c81; background: #f5f7fa; border-bottom: 1px solid var(--line); text-align: left; font-size: 10px; letter-spacing: .02em; }
.data-table td { padding: 13px; border-bottom: 1px solid #e7ebf1; vertical-align: middle; }
.data-table tbody tr:hover { background: #fbfcff; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.table-title { display: grid; gap: 2px; min-width: 220px; }
.table-title strong { font-size: 13px; }
.table-title small { color: var(--muted); }

.empty-state {
    display: grid;
    place-items: center;
    min-height: 330px;
    padding: 50px 20px;
    text-align: center;
    background: #fff;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
}
.empty-state h2 { margin: 12px 0 4px; font-size: 18px; }
.empty-state p { max-width: 500px; margin: 0 0 18px; color: var(--muted); }
.empty-icon { display: grid; place-items: center; width: 54px; height: 54px; color: var(--blue); background: var(--blue-soft); border-radius: 16px; font-size: 24px; font-weight: 850; }
.error-state .empty-icon { color: var(--red); background: #fff0f2; }
.page-loading { display: grid; place-items: center; min-height: 55vh; align-content: center; }
.page-loading strong { margin-top: 14px; }
.page-loading p { margin: 3px 0; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid #dbe3ef; border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { position: relative; overflow: hidden; color: transparent !important; background: #e9edf3 !important; border-color: transparent !important; border-radius: 6px; }
.skeleton::after { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.65), transparent); content: ""; transform: translateX(-100%); animation: shimmer 1.25s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

html.app-modal-open, html.app-modal-open body,
html.app-message-open, html.app-message-open body { overflow: hidden; overscroll-behavior: none; }
.auth-dialog, .modal {
    width: min(480px, calc(100vw - 28px));
    max-height: calc(100vh - 30px);
    padding: 24px;
    color: var(--ink);
    background: #fff;
    border: 0;
    border: 1px solid var(--line);
    border-radius: 17px;
    box-shadow: 0 24px 70px rgba(2, 15, 37, .24);
    overflow: auto;
    overscroll-behavior: contain;
}
.modal { padding-top: 58px; transform: translate(var(--modal-drag-x, 0), var(--modal-drag-y, 0)); }
.auth-dialog::backdrop, .modal::backdrop { background: rgba(23, 36, 55, .48); backdrop-filter: blur(3px); }
.dialog-close-row { position: absolute; z-index: 2; top: 10px; right: 10px; margin: 0; }
.modal-drag-bar { position: absolute; z-index: 1; top: 0; right: 0; left: 0; display: flex; align-items: center; min-height: 44px; padding: 0 56px 0 18px; color: #53627a; background: linear-gradient(180deg, #f8faff, #eef3f9); border-bottom: 1px solid #dce4ef; border-radius: 22px 22px 0 0; cursor: grab; touch-action: none; }
.modal-drag-bar span { overflow: hidden; font-size: 10px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.modal.is-dragging, .modal.is-dragging .modal-drag-bar { cursor: grabbing; user-select: none; }
.auth-brand-mark { display: none; }
.auth-dialog h2, .modal h2 { margin: 3px 0 5px; font-size: 22px; letter-spacing: -.035em; }
.auth-dialog [data-auth-title] { min-height: 0; }
.auth-intro { margin: 0 36px 16px 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.auth-mode-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin-bottom: 16px; padding: 3px; background: #f0f2f5; border-radius: 10px; }
.auth-mode-tabs button { padding: 9px 5px; color: var(--muted); background: transparent; border: 0; border-radius: 8px; cursor: pointer; font-size: 11px; font-weight: 800; }
.auth-mode-tabs button[aria-selected="true"] { color: var(--blue-strong); background: #fff; box-shadow: var(--shadow-sm); }
.auth-panel { display: grid; align-content: start; gap: 11px; max-height: min(520px, 58vh); padding-right: 3px; overflow-y: auto; scrollbar-gutter: stable; }
.auth-panel label { display: grid; gap: 5px; }
.auth-panel .check-label { display: flex; min-height: 44px; }
.signup-admin-disclosure { color: #53627a; border: 1px solid var(--line); border-radius: 9px; }
.signup-admin-disclosure summary { min-height: 40px; padding: 10px 12px; cursor: pointer; font-size: 11px; font-weight: 800; }
.signup-admin-disclosure[open] summary { border-bottom: 1px solid var(--line); }
.signup-account-role { display: grid; gap: 8px; margin: 0; padding: 10px; background: #f7f9fc; border: 0; }
.signup-account-role legend { padding: 0 5px; color: var(--muted); font-size: 9px; font-weight: 850; }
.signup-admin-option { padding: 8px 9px; background: #fff; border: 1px solid var(--line); border-radius: 9px; }
.signup-admin-option span { display: grid; gap: 2px; }
.signup-admin-option small { color: var(--muted); font-size: 9px; font-weight: 500; }
.signup-admin-key[hidden] { display: none; }
.signup-admin-key { padding-top: 3px; }
.signup-agreement { display: grid; gap: 8px; }
.signup-agreement > header { display: flex; gap: 12px; align-items: end; justify-content: space-between; }
.signup-agreement h3 { margin: 2px 0 0; font-size: 14px; }
.signup-agreement > header > small { color: var(--muted); font-size: 8px; white-space: nowrap; }
.signup-terms-disclosure, .auth-policy-details { color: #53627a; background: #f8f9fb; border: 1px solid var(--line); border-radius: 9px; }
.signup-terms-disclosure summary, .auth-policy-details summary { min-height: 40px; padding: 10px 12px; cursor: pointer; font-size: 11px; font-weight: 800; }
.signup-terms-disclosure[open] summary, .auth-policy-details[open] summary { border-bottom: 1px solid var(--line); }
.signup-terms-document { display: grid; gap: 18px; max-height: 220px; padding: 13px; overflow-y: auto; overscroll-behavior: contain; color: #3d4d66; background: #fff; scrollbar-gutter: stable; }
.signup-terms-document section { display: grid; gap: 6px; }
.signup-terms-document h4 { margin: 0 0 3px; color: var(--ink); font-size: 12px; }
.signup-terms-document h5 { margin: 5px 0 0; color: var(--ink); font-size: 10px; }
.signup-terms-document p { margin: 0; font-size: 9px; line-height: 1.65; }
.signup-terms-document dl { display: grid; gap: 7px; margin: 0; }
.signup-terms-document dl > div { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 8px; }
.signup-terms-document dt { color: var(--ink); font-size: 9px; font-weight: 850; }
.signup-terms-document dd { margin: 0; font-size: 9px; line-height: 1.55; }
.signup-consents { display: grid; gap: 5px; padding: 10px 11px; background: #f4f7fc; border: 1px solid var(--line); border-radius: 9px; }
.signup-consents .check-label { align-items: center; margin: 0; }
.signup-consents small { color: var(--blue-strong); }
.guest-account-request { display: grid; gap: 9px; }
.guest-account-card { display: grid; gap: 7px; min-width: 0; padding: 14px; background: #f7f9fc; border: 1px solid #d7dee8; border-radius: 11px; }
.guest-account-card.is-disabled { color: #707c8e; background: #f1f3f6; border-color: var(--line); }
.guest-account-heading { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.guest-account-heading strong { font-size: 15px; }
.guest-account-heading span { padding: 3px 7px; color: var(--blue-strong); background: #fff; border: 1px solid #c9d6f1; border-radius: 999px; font-size: 8px; font-weight: 850; white-space: nowrap; }
.guest-account-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.auth-policy-details ul { display: grid; gap: 5px; margin: 0; padding: 10px 14px 12px 29px; font-size: 10px; line-height: 1.45; }
.guest-account-reason { color: var(--blue-strong); font-size: 9px; font-weight: 750; }
.guest-account-card.is-disabled .guest-account-reason { color: var(--red); }
.guest-capability-status { min-height: 18px; margin: 0; color: var(--muted); font-size: 9px; }
.guest-credential-result { display: grid; gap: 12px; text-align: center; }
.guest-credential-result[hidden] { display: none; }
.guest-credential-success { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto; color: #08705f; background: #eafaf5; border: 1px solid #bceadc; border-radius: 50%; font-size: 22px; font-weight: 900; }
.guest-credential-result h3 { margin: 0; font-size: 18px; }
.guest-credential-result > p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.guest-credential-list { display: grid; gap: 7px; margin: 0; text-align: left; }
.guest-credential-list > div { display: grid; gap: 4px; padding: 10px 12px; background: var(--surface-alt); border: 1px solid var(--line); border-radius: 10px; }
.guest-credential-list dt { color: var(--muted); font-size: 8px; font-weight: 800; }
.guest-credential-list dd { display: flex; gap: 8px; align-items: center; justify-content: space-between; min-width: 0; margin: 0; }
.guest-credential-list code { overflow-wrap: anywhere; color: var(--ink); font-family: Consolas, monospace; font-size: 12px; font-weight: 800; }
.guest-credential-actions { display: grid; grid-template-columns: 1fr; gap: 7px; }
.auth-panel > small { color: var(--muted); text-align: center; }
.shared-device-notice { display: grid; gap: 3px; padding: 9px 11px; color: #5d6879; background: #f7f8fa; border: 1px solid var(--line); border-radius: 9px; font-size: 10px; line-height: 1.45; }
.shared-device-notice strong { font-size: 11px; }
.form-message { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: center; min-height: 42px; margin: 0 0 13px; padding: 9px 11px; color: #176457; background: #edf8f5; border: 1px solid #b9ddd5; border-radius: 9px; font-size: 11px; font-weight: 700; line-height: 1.45; }
.form-message::before { display: grid; place-items: center; width: 22px; height: 22px; color: #fff; background: #238373; border-radius: 50%; content: "i"; font-size: 10px; font-weight: 900; }
.form-message[hidden] { display: none; }
.form-message.is-error { color: #862436; background: #fff1f3; border-color: #e7aeb7; }
.form-message.is-error::before { background: #b42b43; content: "!"; }
.form-message:focus-visible { outline: 3px solid rgba(180,43,67,.18); outline-offset: 2px; }
.modal-wide { width: min(960px, calc(100vw - 28px)); }
.modal-template-library { height: min(560px, calc(100vh - 30px)); overflow: hidden; }
.modal-template-library { height: min(560px, calc(100dvh - 30px)); max-height: calc(100dvh - 30px); }
.modal-template-library [data-modal-body] { height: 100%; min-height: 0; }
.modal-template-library .page-loading { min-height: 100%; }
.modal-preview-simulator { width: calc(100vw - 28px); max-width: none; height: calc(100vh - 28px); overflow: hidden; }
.modal-preview-simulator [data-modal-body] { height: 100%; min-height: 0; }
.modal-code-editor { width: calc(100vw - 28px); max-width: 1440px; height: calc(100vh - 28px); overflow: hidden; }
.modal-code-editor [data-modal-body] { height: 100%; min-height: 0; }
.source-editor-shell { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 14px; height: 100%; min-height: 0; }
.source-editor-heading { display: flex; gap: 20px; align-items: start; justify-content: space-between; }
.source-editor-heading h2 { margin-bottom: 4px; }
.source-editor-heading p { max-width: 850px; margin: 0; color: var(--muted); font-size: 12px; }
.source-editor-security { flex: 0 0 auto; padding: 7px 10px; color: #08705f; background: #eafaf5; border: 1px solid #bceadc; border-radius: 999px; font-size: 10px; font-weight: 850; }
.source-editor-options { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .35fr); gap: 12px; }
.source-editor-options:has(> :only-child) { grid-template-columns: 1fr; }
.source-editor-options .setting-row, .source-editor-options .form-field { min-height: 58px; margin: 0; padding: 10px 12px; background: var(--surface-alt); border: 1px solid var(--line); border-radius: 11px; }
.source-editor-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); gap: 14px; min-height: 0; }
.source-editor-workbench, .source-editor-preview { min-width: 0; min-height: 0; overflow: hidden; background: #fff; border: 1px solid #ccd7e5; border-radius: 14px; }
.source-editor-workbench { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.source-editor-tabs { display: flex; gap: 4px; padding: 7px 8px 0; background: #f3f6fa; border-bottom: 1px solid #dbe3ee; }
.source-editor-tabs button { min-height: 38px; padding: 8px 18px; color: #52627a; background: transparent; border: 0; border-radius: 8px 8px 0 0; font-size: 12px; font-weight: 850; cursor: pointer; }
.source-editor-tabs button[aria-selected="true"] { color: var(--blue-strong); background: #fff; box-shadow: 0 -1px 0 #dbe3ee, 1px 0 0 #dbe3ee, -1px 0 0 #dbe3ee; }
.source-editor-panel { min-height: 0; }
.source-editor-panel[hidden] { display: none; }
.source-editor-host { width: 100%; height: 100%; min-height: 280px; }
.source-editor-workbench > footer { display: flex; gap: 10px; align-items: center; justify-content: space-between; min-height: 34px; padding: 5px 10px; color: var(--muted); background: #f7f9fc; border-top: 1px solid #dbe3ee; font-size: 10px; }
.source-editor-workbench [data-code-status] { color: #08705f; font-weight: 800; text-align: right; }
.source-editor-workbench [data-code-status].is-error { color: var(--red); }
.source-editor-preview { display: grid; grid-template-rows: auto minmax(0, 1fr); background: #edf2f8; }
.source-editor-preview header { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 11px 13px; background: #f8faff; border-bottom: 1px solid #dbe3ee; }
.source-editor-preview header small { color: var(--muted); font-size: 9px; }
.source-editor-preview iframe { width: 100%; height: 100%; min-height: 280px; background: #fff; border: 0; }
.source-editor-actions { display: flex; gap: 8px; justify-content: flex-end; }
.message-dialog {
    width: min(500px, calc(100vw - 28px));
    padding: 0;
    color: var(--ink);
    background: #fff;
    border: 1px solid #d9e1ec;
    border-radius: 18px;
    box-shadow: 0 28px 90px rgba(2, 15, 37, .34);
    overflow: hidden;
    transform: translate(var(--message-drag-x, 0), var(--message-drag-y, 0));
}
.message-dialog::backdrop { background: rgba(5, 17, 38, .62); backdrop-filter: blur(3px); }
.message-dialog-header { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; min-height: 54px; padding: 8px 10px 8px 16px; color: #20344f; background: #eef4fd; border-bottom: 1px solid #dbe5f2; cursor: grab; touch-action: none; }
.message-dialog-header > strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.message-dialog-header form { margin: 0; }
.message-dialog-tone-icon { display: grid; place-items: center; width: 28px; height: 28px; color: #fff; background: var(--blue); border-radius: 50%; font-size: 13px; font-weight: 900; }
.message-dialog.is-warning .message-dialog-header { color: #5f4200; background: #fff7e5; border-color: #eed9a5; }
.message-dialog.is-warning .message-dialog-tone-icon { background: #b47700; }
.message-dialog.is-error .message-dialog-header { color: #762333; background: #fff1f3; border-color: #f1c9d0; }
.message-dialog.is-error .message-dialog-tone-icon { background: var(--red); }
.message-dialog.is-dragging, .message-dialog.is-dragging .message-dialog-header { cursor: grabbing; user-select: none; }
.message-copy-button { display: inline-flex; gap: 5px; align-items: center; min-height: 36px; padding: 5px 9px; color: #41536e; background: rgba(255,255,255,.72); border: 1px solid rgba(112,132,161,.32); border-radius: 8px; cursor: pointer; font-size: 10px; font-weight: 800; }
.message-copy-button:hover { color: var(--blue-strong); background: #fff; }
.message-dialog-body { min-height: 106px; padding: 24px 24px 18px; }
.message-dialog-body p { margin: 0; color: #34445c; font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; white-space: pre-line; }
.message-dialog-actions { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px 18px; border-top: 1px solid #edf0f5; }
.message-dialog-actions .button { min-width: 82px; }
.help-steps { display: grid; gap: 10px; padding: 0; list-style: none; counter-reset: guide; }
.help-steps li { display: grid; grid-template-columns: 34px 1fr; padding: 12px; background: var(--surface-alt); border: 1px solid var(--line); border-radius: 11px; counter-increment: guide; }
.help-steps li::before { grid-row: 1 / 3; display: grid; place-items: center; width: 25px; height: 25px; color: #fff; background: var(--blue); border-radius: 8px; content: counter(guide); font-size: 10px; font-weight: 800; }
.help-steps span { color: var(--muted); font-size: 11px; }
.help-summary { margin: 0 0 18px; color: var(--muted); white-space: pre-line; }
.help-loading { min-height: 220px; }
.help-tip { display: grid; gap: 3px; margin-top: 14px; padding: 13px 14px; color: #384862; background: var(--blue-soft); border-left: 4px solid var(--blue); border-radius: 9px; }
.help-tip strong { color: var(--blue-strong); font-size: 10px; }
.help-tip span { font-size: 11px; }

.toast-region { position: fixed; z-index: 200; top: calc(var(--header-height) + 12px); right: 22px; bottom: auto; display: grid; gap: 8px; width: min(390px, calc(100vw - 32px)); pointer-events: none; }
.toast { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-left: 4px solid var(--navy); border-radius: 10px; box-shadow: 0 10px 28px rgba(15,34,68,.14); opacity: 0; pointer-events: auto; transform: translateY(-10px); transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast-success { border-left-color: var(--jade); }
.toast-error { border-left-color: var(--red); }
.toast-warning { border-left-color: var(--amber); }
.toast-icon { display: grid; place-items: center; width: 26px; height: 26px; color: var(--navy); background: #f1f4f7; border-radius: 50%; }
.toast-success .toast-icon { color: var(--jade); background: #edf8f5; }
.toast-error .toast-icon { color: var(--red); background: #fff1f3; }
.toast-warning .toast-icon { color: #8a5b00; background: #fff7e8; }
.toast-copy { display: grid; gap: 2px; min-width: 0; }
.toast-copy strong { font-size: 10px; }
.toast-copy span { font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.toast-actions { display: flex; gap: 2px; }
.toast-action { display: grid; place-items: center; width: 34px; min-height: 34px; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 7px; cursor: pointer; }
.toast-action:hover, .toast-action:focus-visible { color: var(--ink); background: #f1f4f7; }

.svg-icon { flex: 0 0 auto; }

@media (max-width: 72rem) {
    :root { --sidebar-width: 264px; }
    .app-shell { display: block; }
    .app-header { grid-template-columns: auto 160px minmax(0, 1fr) auto; padding: 0 14px; }
    .icon-button.mobile-menu-button { display: inline-grid; color: var(--ink); margin-right: 8px; }
    .brand { width: 160px; }
    .brand img { width: 158px; }
    .header-context { display: flex; padding-left: 10px; }
    .workspace-chip { display: none; }
    .header-page-context { padding-left: 0; border-left: 0; }
    .header-page-actions .save-state { display: none; }
    .header-session-label { display: none; }
    .app-sidebar { top: 0; z-index: 100; width: min(312px, 88vw); padding-top: 24px; transform: translateX(-105%); transition: transform .22s ease; box-shadow: var(--shadow-md); }
    .app-sidebar.is-open { transform: translateX(0); }
    .sidebar-scrim { position: fixed; z-index: 90; inset: 0; display: block; width: 100%; background: rgba(3,13,30,.58); border: 0; }
    .has-sidebar-open { overflow: hidden; }
    .app-main { min-width: 0; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 50rem) {
    :root { --header-height: 60px; }
    body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
    .app-header { grid-template-columns: 40px minmax(92px, 104px) minmax(0, 1fr) auto; height: var(--header-height); padding-inline: 8px; }
    .icon-button.mobile-menu-button { margin-right: 0; }
    .brand { width: 104px; }
    .brand img { width: 102px; }
    .header-context { padding-left: 0; }
    .header-actions { gap: 4px; }
    .header-page-actions { gap: 4px; margin-right: 0; }
    .header-page-context { display: none; }
    .header-help-label, .header-page-refresh-label, .user-copy, .user-button > span:last-child { display: none; }
    .header-help { display: none; }
    .header-session { gap: 3px; min-height: 38px; padding: 3px; }
    .header-session-time { min-width: 50px; font-size: 10px; }
    .header-session button { min-height: 30px; padding-inline: 5px; }
    .header-help, .header-page-refresh { width: 38px; justify-content: center; padding: 5px; }
    .user-button { min-width: auto; padding: 4px; }
    .header-page-actions .button { width: 38px; padding: 0; font-size: 0; }
    .header-page-actions .button span { font-size: 20px; }
    .page-host { min-height: calc(100vh - var(--header-height)); padding: 16px; }
    .survey-flow { overflow-x: visible; }
    .survey-flow ol { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; }
    .survey-flow li { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
    .survey-flow li:nth-child(even) { border-right: 0; }
    .survey-flow li:nth-last-child(-n + 2) { border-bottom: 0; }
    .survey-flow li > .survey-flow-step, .survey-flow li > a, .survey-flow li > button { min-height: 72px; padding: 11px 14px; }
    .mobile-bottom-nav {
        position: fixed;
        z-index: 80;
        right: 0;
        bottom: 0;
        left: 0;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        padding: 6px 7px calc(6px + env(safe-area-inset-bottom));
        background: rgba(255,255,255,.97);
        border-top: 1px solid var(--line);
        box-shadow: 0 -8px 24px rgba(15,34,68,.08);
        backdrop-filter: blur(12px);
    }
    .mobile-bottom-nav a { display: grid; place-items: center; gap: 2px; min-height: 48px; color: #718097; border-radius: 9px; font-size: 9px; font-weight: 750; }
    .mobile-bottom-nav a.is-active { color: var(--blue); background: var(--blue-soft); }
    .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
    .metric-card { min-height: 111px; padding: 15px; }
    .metric-value { font-size: 25px; }
    .section-heading { align-items: flex-start; flex-direction: column; gap: 10px; }
    .section-actions { width: 100%; }
    .toolbar { align-items: stretch; flex-direction: column; }
    .toolbar-group { width: 100%; }
    .search-field { flex: 1; min-width: 100%; }
    .form-grid-two, .form-grid-three { grid-template-columns: 1fr; }
    .card-header, .card-body { padding: 16px; }
    .auth-dialog, .modal { padding: 25px 19px 20px; border-radius: 18px; }
    .modal { padding-top: 52px; }
    .modal-template-library { width: calc(100vw - 12px); height: calc(100vh - 12px); height: calc(100dvh - 12px); max-height: calc(100dvh - 12px); padding-right: 14px; padding-bottom: 14px; padding-left: 14px; }
    .modal-code-editor { width: calc(100vw - 12px); height: calc(100vh - 12px); }
    .source-editor-heading { display: block; }
    .source-editor-security { display: inline-flex; margin-top: 8px; }
    .source-editor-options, .source-editor-layout { grid-template-columns: 1fr; }
    .source-editor-layout { overflow: auto; }
    .source-editor-workbench, .source-editor-preview { min-height: 390px; }
    .modal-drag-bar { min-height: 40px; border-radius: 18px 18px 0 0; }
    .message-dialog { border-radius: 15px; }
    .message-dialog-header { grid-template-columns: auto minmax(0, 1fr) auto auto; padding-left: 12px; }
    .message-copy-button { width: 38px; padding: 5px; justify-content: center; }
    .message-copy-button > span:last-child { display: none; }
    .message-dialog-body { min-height: 92px; padding: 20px 18px 14px; }
    .message-dialog-actions { padding: 12px 14px 15px; }
    .message-dialog-actions .button { flex: 1; }
    .auth-panel { max-height: 52vh; }
    .guest-account-card { padding: 14px; }
    .guest-credential-actions { grid-template-columns: 1fr; }
    .toast-region { top: calc(var(--header-height) + 10px); right: 16px; bottom: auto; }
    .button, input, select, textarea { min-height: 44px; }
    .segmented-control button { min-height: 40px; }
}

@media (max-width: 23rem) {
    :root { --content-gutter: 12px; }
    .app-header { padding: 0 9px; }
    .header-page-actions { display: none; }
    .brand { width: 94px; }
    .brand img { width: 92px; }
    .header-help { display: none; }
    .metric-grid { grid-template-columns: 1fr; }
    .page-host { padding: var(--content-gutter); }
}

@media (hover: none) {
    .button:hover { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
    .header-page-refresh.is-refreshing > span:first-child { animation: none; }
}

/* Shared publication links: independent of delivery recipients and channels. */
.publication-links{min-width:0}
.publication-links h2{margin:0 0 8px}
.publication-links>[data-publication-title]{overflow-wrap:anywhere;font-weight:700}
.publication-links>[data-publication-status]{display:block;margin:12px 0;color:#345574;font-size:14px}
.publication-link-list{display:grid;gap:14px}
.publication-link-card{min-width:0;padding:18px;border:1px solid #c7d5e8;border-radius:12px;background:#f9fbff}
.publication-link-card header{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin-bottom:12px}
.publication-link-card h3{margin:0;font-size:17px;overflow-wrap:anywhere}
.publication-default{padding:3px 8px;color:#155f48;background:#e5f6ef;border-radius:20px;font-size:12px;font-weight:700}
.publication-link-card input{width:100%;min-width:0;min-height:46px;font-size:14px}
.publication-link-actions,.publication-common-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}
.publication-links .button{min-height:44px}
.publication-guidance{font-size:14px;line-height:1.7;color:#44566d}
.publication-regenerate{display:flex;align-items:center;flex-wrap:wrap;gap:16px;padding:18px;margin-top:20px;border:1px solid #e2c7a5;border-radius:12px;background:#fffaf3}
.publication-regenerate>div{flex:1;min-width:180px}
.publication-regenerate p{font-size:14px;line-height:1.7;margin:8px 0 0}
.publication-done{display:flex;justify-content:flex-end;margin-top:18px}
@media(max-width:480px){.publication-link-card{padding:13px}.publication-link-actions>*{flex:1}.publication-regenerate>div{min-width:0;flex-basis:100%}.publication-regenerate>.button{width:100%}}
