:where(a, button, input, textarea, select, summary):focus-visible {
    outline: 3px solid #3182f638;
    outline-offset: 2px;
}

@media (pointer: coarse) {
    button, .primary, .secondary, .text-action, .text-danger, summary { min-height: 44px; }
    input[type="checkbox"], input[type="radio"] { min-width: 20px; min-height: 20px; }
    .drawer-head button, .product-workspace-head button, [data-image-modal-close], [data-phrase-modal-close] {
        display: inline-grid;
        place-items: center;
        min-width: 44px;
        min-height: 44px;
    }
}

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

.mobile-menu-toggle, .mobile-menu-close, .mobile-menu-backdrop { display: none; }
.mobile-menu-user { display: none; }

@media (min-width: 801px) and (max-width: 1200px) {
    .app-shell { grid-template-columns: 190px minmax(0, 1fr); }
    .sidebar { padding: 22px 14px; }
    .sidebar nav a, .sidebar nav span { padding: 11px 10px; }
    .main { max-width: none; padding: 28px 24px; }
    .topbar { margin-bottom: 22px; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-three-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-calendar-workbench { grid-template-columns: 240px minmax(0, 1fr); }
    .dashboard-mini-calendar { padding: 14px; }
    .dashboard-phrase-table-wrap, .table-wrap { overflow-x: auto; }
    .dashboard-phrase-table { min-width: 760px; }
    .schedule-workbench { grid-template-columns: 240px minmax(0, 1fr); }
    .week-agenda { grid-template-columns: repeat(7, minmax(100px, 1fr)); }
    .workspace-grid { grid-template-columns: 1fr; }
    .drawer.bottom-sheet { width: min(860px, calc(100% - 40px)); }
    .dashboard-image-dialog, .phrase-grid-dialog { width: min(900px, calc(100% - 32px)); }
    .phrase-simple-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 801px) and (max-width: 1100px) {
    body.workspace-drawer-open .main,
    body.product-workspace-open .main,
    body.dashboard-default-panel-open.workspace-drawer-open .main { width: 100% !important; }
    .workspace-drawer, .product-workspace-panel {
        width: min(540px, 100vw);
        z-index: 55;
        box-shadow: -16px 0 45px #10182824;
    }
    .dashboard-default-panel { display: none; }
    .editor-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
    html, body { max-width: 100%; overflow-x: hidden; }
    body { font-size: 14px; }
    .main > .alert.is-dismissing {
        opacity: 0;
        transform: translateY(-6px);
        transition: opacity .2s ease, transform .2s ease;
    }
    .sidebar-collapse-toggle { display: none; }
    body.sidebar-collapsed .sidebar .brand { display: grid; }
    body.sidebar-collapsed .sidebar .menu-label { display: inline; }
    body.sidebar-collapsed .sidebar nav { margin-top: 24px; }
    body.sidebar-collapsed .sidebar nav a { justify-content: flex-start; padding: 12px 14px; }
    body.sidebar-collapsed .sidebar form .link-button { justify-content: flex-start; padding: 10px 14px; }
    .comment-editor-sheet[open] > .mobile-create-sheet-head,
    .comment-editor-sheet[open] > form {
        width: 100% !important;
        max-width: none !important;
    }
    body.sheet-open, body.workspace-drawer-open, body.product-workspace-open, body.mobile-menu-open, body.mobile-create-open,
    body.image-modal-open, body.phrase-modal-open, body.schedule-detail-open { overflow: hidden; }
    .app-shell { display: block; min-height: 100dvh; }
    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        left: auto;
        z-index: 110;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: min(320px, 88vw);
        height: 100dvh;
        padding: calc(20px + env(safe-area-inset-top)) 18px calc(18px + env(safe-area-inset-bottom));
        border-right: 0;
        border-left: 1px solid var(--line);
        background: #fff;
        box-shadow: -18px 0 50px #10182830;
        transform: translateX(105%);
        transition: transform .22s ease;
    }
    body.mobile-menu-open .sidebar { transform: translateX(0); }
    .sidebar-brand-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex: 0 0 auto;
    }
    .sidebar .brand { width: 42px; height: 42px; border-radius: 12px; font-size: 15px; }
    .mobile-menu-user {
        display: flex;
        align-items: center;
        min-height: 46px;
        margin: 16px 0 0;
        padding: 0 14px;
        border: 1px solid var(--line);
        border-radius: 14px;
        background: #f8fafc;
        color: var(--text);
        font-size: 15px;
        font-weight: 900;
    }
    .mobile-menu-user strong {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .sidebar nav {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto;
        gap: 4px;
        min-width: 0;
        min-height: 0;
        margin: 24px 0 12px;
        overflow-y: auto;
    }
    .sidebar nav a {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 46px;
        padding: 12px 14px;
        border-radius: 11px;
        white-space: nowrap;
        font-size: 14px;
    }
    .sidebar nav span,
    .sidebar nav a span,
    .sidebar nav .menu-label,
    .sidebar nav .menu-icon,
    .sidebar .sidebar-bottom .menu-label,
    .sidebar .sidebar-bottom .menu-icon {
        display: inline-flex !important;
        align-items: center;
        opacity: 1 !important;
        visibility: visible !important;
    }
    .sidebar-bottom {
        display: grid;
        flex: 0 0 auto;
        gap: 8px;
        padding-top: 10px;
        border-top: 1px solid var(--line);
    }
    .sidebar-bottom-link,
    .sidebar-bottom .link-button {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        min-height: 44px;
        padding: 10px 14px;
        border-radius: 10px;
        background: #f2f4f6;
        color: var(--muted);
        font-size: 13px;
    }
    .sidebar form { width: 100%; margin: auto 0 0; }
    .sidebar .sidebar-bottom form {
        width: 100%;
        margin: 0;
    }
    .sidebar .link-button { width: 100%; min-height: 44px; border-radius: 10px; background: #f2f4f6; font-size: 13px; }
    .mobile-menu-close {
        position: absolute;
        top: calc(16px + env(safe-area-inset-top));
        right: 14px;
        display: inline-grid;
        place-items: center;
        width: 44px;
        height: 44px;
        border: 0;
        background: transparent;
        color: var(--text);
        cursor: pointer;
        font-size: 30px;
    }
    .mobile-menu-toggle {
        display: inline-grid;
        place-content: center;
        gap: 4px;
        width: 42px;
        min-width: 42px;
        height: 42px;
        min-height: 42px;
        padding: 0;
        border: 1px solid var(--line);
        border-radius: 50%;
        background: #fff;
        cursor: pointer;
    }
    .mobile-menu-toggle span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--text); }
    .mobile-menu-backdrop {
        position: fixed;
        inset: 0;
        z-index: 105;
        width: 100%;
        height: 100%;
        border: 0;
        background: #10182870;
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }
    body.mobile-menu-open .mobile-menu-backdrop { display: block; opacity: 1; pointer-events: auto; }
    .main { width: 100% !important; max-width: none; padding: 18px 14px calc(34px + env(safe-area-inset-bottom)); }
    .topbar { margin-bottom: 18px; }
    .topbar h1 { font-size: 21px; }
    .user-chip { display: none; }
    .mobile-todo-button {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        width: auto;
        min-width: 0;
        height: 28px;
        min-height: 28px;
        padding: 3px 5px 3px 9px;
        border: 1px solid #dbe8ff;
        border-radius: 999px;
        background: #edf4ff;
        color: #1b64da;
        cursor: pointer;
        font-size: 11px;
        font-weight: 700;
    }
    .mobile-todo-label { line-height: 1; letter-spacing: -.1px; }
    .mobile-todo-count {
        display: inline-grid;
        place-items: center;
        min-width: 18px;
        height: 18px;
        padding: 0 4px;
        border-radius: 999px;
        background: var(--blue);
        color: #fff;
        font-size: 10px;
        font-weight: 800;
        line-height: 1;
    }
    .mobile-action-label { display: inline; }
    .desktop-action-label { display: none; }
    .panel { padding: 16px; border-radius: 14px; }
    .panel-head { align-items: flex-start; }
    .panel-head h2 { font-size: 18px; }

    body.workspace-drawer-open .main,
    body.product-workspace-open .main,
    body.dashboard-default-panel-open.workspace-drawer-open .main { width: 100% !important; }
    .drawer:not(.bottom-sheet) {
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        height: 100dvh;
        padding: 18px 16px calc(24px + env(safe-area-inset-bottom));
        z-index: 55;
        box-shadow: none;
        overscroll-behavior: contain;
    }
    .workspace-drawer .drawer-head {
        position: sticky;
        top: -18px;
        z-index: 8;
        margin: -8px -4px 14px;
        padding: 10px 4px 12px;
        border-bottom: 1px solid var(--line);
        background: #fff;
    }
    .product-workspace-panel {
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        height: 100dvh;
        padding: 0 14px calc(24px + env(safe-area-inset-bottom));
        z-index: 55;
        border-left: 0;
        box-shadow: none;
        overscroll-behavior: contain;
    }
    .product-workspace-head { margin: 0 -14px 14px; padding: 14px; }
    .product-workspace-head h2 { font-size: 20px; }
    .workspace-drawer > .editor-tabs,
    .product-workspace-content > .editor-tabs {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 58;
        top: auto !important;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 3px;
        width: 100%;
        margin: 0;
        padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
        overflow: visible;
        border-top: 1px solid var(--line);
        border-radius: 15px 15px 0 0;
        background: #fffffff5;
        box-shadow: 0 -8px 24px #1018281f;
        backdrop-filter: blur(12px);
    }
    .workspace-drawer > .editor-tabs button,
    .product-workspace-content > .editor-tabs button {
        min-width: 0;
        min-height: 50px;
        padding: 6px 2px;
        line-height: 1.25;
        word-break: keep-all;
        font-size: 10.5px;
    }
    .workspace-drawer > .editor-tabs button.active,
    .product-workspace-content > .editor-tabs button.active {
        background: #edf4ff;
        color: var(--blue);
        box-shadow: none;
    }
    .workspace-drawer > .editor-tabs b,
    .product-workspace-content > .editor-tabs b {
        min-width: 16px;
        height: 16px;
        margin-left: 2px;
        font-size: 9px;
    }
    .workspace-drawer,
    .product-workspace-panel {
        padding-bottom: calc(82px + env(safe-area-inset-bottom));
    }
    [data-editor-panel$="-basic"] > form { padding-bottom: 70px; }
    [data-editor-panel$="-basic"] .inline-save-bar {
        position: fixed;
        right: 0;
        bottom: calc(64px + env(safe-area-inset-bottom));
        left: 0;
        z-index: 57;
        min-height: 58px;
        margin: 0;
        padding: 8px 12px;
        border-top: 1px solid var(--line);
        background: #fffffff5;
        box-shadow: 0 -5px 18px #10182814;
        backdrop-filter: blur(12px);
    }
    [data-editor-panel$="-basic"] .inline-save-bar .primary { flex: 1; }
    [data-editor-panel$="-basic"] .inline-save-bar [data-save-status]:empty { display: none; }
    [data-editor-panel$="-phrases"],
    [data-editor-panel$="-comments"],
    [data-editor-panel$="-schedules"],
    [data-editor-panel$="-posts"] { padding-bottom: 66px; }
    .mobile-floating-create-box:not([open]) {
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
    }
    .mobile-floating-create-box > summary {
        position: fixed;
        right: 14px;
        bottom: calc(72px + env(safe-area-inset-bottom));
        z-index: 57;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: auto;
        min-height: 44px;
        padding: 10px 15px;
        border: 0;
        border-radius: 999px;
        background: var(--blue);
        color: #fff;
        box-shadow: 0 8px 22px #3182f64a;
        font-size: 13px;
        font-weight: 800;
    }
    .mobile-floating-create-box[open] {
        position: fixed;
        inset: 0;
        z-index: 75;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        margin: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: #10182880;
    }
    .mobile-floating-create-box[open] > summary { display: none; }
    .mobile-floating-create-box[open] > .mobile-create-sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 15px 16px 12px;
        border-radius: 20px 20px 0 0;
        background: #fff;
    }
    .mobile-create-sheet-head strong { font-size: 18px; }
    .mobile-create-sheet-head button {
        display: grid;
        place-items: center;
        width: 38px;
        height: 38px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: #f2f4f6;
        color: var(--text);
        font-size: 24px;
    }
    .mobile-floating-create-box[open] > form {
        width: 100%;
        max-height: min(72dvh, 680px);
        margin: 0;
        padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
        overflow-y: auto;
        border-radius: 0;
        background: #fff;
        overscroll-behavior: contain;
    }
    .desktop-post-create, .desktop-post-manage { display: none; }
    .mobile-post-create-button {
        position: fixed;
        right: 14px;
        bottom: calc(72px + env(safe-area-inset-bottom));
        z-index: 57;
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        padding: 10px 15px;
        border: 0;
        border-radius: 999px;
        background: var(--blue);
        color: #fff;
        box-shadow: 0 8px 22px #3182f64a;
        font-size: 13px;
        font-weight: 800;
    }
    .mobile-post-edit-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 36px;
        padding: 7px 10px;
        border: 0;
        border-radius: 9px;
        background: #edf4ff;
        color: #1b64da;
        font-size: 12px;
        font-weight: 700;
    }
    [data-editor-panel$="-schedules"] .schedule-tab-add-button {
        position: fixed;
        right: 14px;
        bottom: calc(72px + env(safe-area-inset-bottom));
        z-index: 57;
        display: inline-flex;
        align-items: center;
        width: auto;
        min-height: 44px;
        padding: 10px 15px;
        border: 0;
        border-radius: 999px;
        background: var(--blue);
        color: #fff;
        box-shadow: 0 8px 22px #3182f64a;
        font-size: 13px;
        font-weight: 800;
    }
    body.bottom-sheet-open [data-editor-panel$="-schedules"] .schedule-tab-add-button {
        visibility: hidden;
        pointer-events: none;
    }
    .mobile-post-sheet {
        position: fixed;
        inset: 0;
        z-index: 75;
        align-items: flex-end;
        background: #10182880;
    }
    .mobile-post-sheet.open { display: flex; }
    .mobile-post-sheet-panel {
        width: 100%;
        max-height: 88dvh;
        overflow-y: auto;
        border-radius: 20px 20px 0 0;
        background: #fff;
        overscroll-behavior: contain;
    }
    .mobile-post-sheet-panel > header {
        position: sticky;
        top: 0;
        z-index: 2;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 16px;
        border-bottom: 1px solid var(--line);
        background: #fff;
    }
    .mobile-post-sheet-panel > header strong { font-size: 18px; }
    .mobile-post-sheet-panel > header button { width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: #f2f4f6; font-size: 24px; }
    .mobile-post-sheet-panel form { grid-template-columns: 1fr; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); }
    .mobile-post-sheet-panel form > * { grid-column: 1; }
    .mobile-post-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 7px !important; }
    .mobile-post-metrics[hidden] { display: none !important; }
    .mobile-post-metrics label { min-width: 0; font-size: 11px; }
    .mobile-post-metrics input { padding-right: 7px; padding-left: 7px; }
    body.mobile-post-sheet-open { overflow: hidden; }
    body.mobile-post-sheet-open .mobile-post-create-button { visibility: hidden; pointer-events: none; }
    body.bottom-sheet-open .mobile-floating-create-box > summary,
    body.image-modal-open .mobile-floating-create-box > summary,
    body.phrase-modal-open .mobile-floating-create-box > summary {
        visibility: hidden;
        pointer-events: none;
    }
    body.bottom-sheet-open [data-editor-panel$="-basic"] .inline-save-bar,
    body.image-modal-open [data-editor-panel$="-basic"] .inline-save-bar,
    body.phrase-modal-open [data-editor-panel$="-basic"] .inline-save-bar {
        visibility: hidden;
        pointer-events: none;
    }
    .editor-phrase-head { align-items: flex-start; gap: 10px; }
    .editor-phrase-head > button { flex: 0 0 auto; }
    .dashboard-editor-product { align-items: flex-start; }
    .editor-record-card { grid-template-columns: 1fr auto; }
    .editor-record-card time { grid-column: 1 / -1; }

    .drawer.bottom-sheet {
        left: 0 !important;
        right: 0 !important;
        bottom: 0;
        z-index: 120;
        width: 100% !important;
        max-width: none;
        max-height: 94dvh !important;
        padding: 20px 14px calc(16px + env(safe-area-inset-bottom)) !important;
        border-radius: 20px 20px 0 0;
        transform: translateY(105%);
        overscroll-behavior: contain;
    }
    body.bottom-sheet-open .drawer-backdrop.open { z-index: 119; }
    .drawer.bottom-sheet.open { transform: none; }
    .bottom-sheet .drawer-head {
        position: sticky;
        top: -20px;
        z-index: 10;
        margin: -10px -2px 12px;
        padding: 12px 2px 10px;
        border-bottom: 1px solid #eef1f4;
        background: #fff;
    }
    .bottom-sheet .drawer-head h2 { font-size: 20px; }
    .bottom-sheet form,
    .bottom-sheet .schedule-edit-grid,
    .bottom-sheet .form-row,
    .bottom-sheet .metric-inputs { display: grid !important; grid-template-columns: 1fr !important; gap: 0; }
    .bottom-sheet form > *,
    .bottom-sheet .schedule-edit-grid > *,
    .bottom-sheet .schedule-edit-wide,
    .bottom-sheet [data-comment-delay-wrap] { grid-column: 1 !important; }
    .bottom-sheet label, .bottom-sheet .schedule-select-field { margin-bottom: 12px; }
    .bottom-sheet input, .bottom-sheet select, .bottom-sheet textarea { min-height: 44px; padding: 10px 12px; }
    .bottom-sheet .check-row { display: flex !important; min-height: 44px; }
    .bottom-sheet .check-row input { min-height: 0; }
    .schedule-mode-options { gap: 7px; }
    .schedule-phrase-fieldset > legend, .desktop-comment-select { display: none; }
    .schedule-relation-select-row {
        display: flex;
        align-items: stretch;
        gap: 8px;
    }
    .schedule-relation-select-row .mobile-relation-select-button {
        flex: 1 1 auto;
    }
    .schedule-relation-add-button {
        min-height: 48px;
        margin-bottom: 10px;
    }
    .bottom-sheet [data-mobile-relation-picker].is-open > .schedule-relation-select-row { display: none; }
    .mobile-relation-select-button {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        width: 100%;
        min-height: 48px;
        margin-bottom: 10px;
        padding: 9px 11px;
        border: 1px solid #dfe5ee;
        border-radius: 10px;
        background: #fff;
        color: #344054;
        text-align: left;
    }
    .mobile-relation-select-button > span { font-size: 12px; font-weight: 700; white-space: nowrap; }
    .mobile-relation-select-button > em {
        display: -webkit-box;
        min-width: 0;
        overflow: hidden;
        color: var(--blue);
        text-align: right;
        text-overflow: ellipsis;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        font-size: 11px;
        font-style: normal;
        line-height: 1.3;
    }
    .mobile-relation-select-button[aria-expanded="true"] { border-color: #9fc5ff; background: #f5f9ff; }
    .mobile-selection-header {
        position: sticky;
        top: 0;
        z-index: 3;
        display: none;
        align-items: center;
        justify-content: space-between;
        min-height: 58px;
        padding: 10px 14px;
        border-bottom: 1px solid var(--line);
        background: #fff;
    }
    .mobile-selection-header strong { font-size: 18px; }
    .mobile-selection-header button {
        min-height: 36px;
        padding: 7px 12px;
        border: 0;
        border-radius: 9px;
        background: #edf4ff;
        color: #1b64da;
        font-size: 12px;
        font-weight: 700;
    }
    .mobile-selection-header.is-image-selection button {
        position: fixed;
        right: 14px;
        bottom: calc(12px + env(safe-area-inset-bottom));
        left: 14px;
        z-index: 124;
        width: auto;
        min-height: 50px;
        padding: 12px 16px;
        border-radius: 12px;
        background: var(--blue);
        color: #fff;
        box-shadow: 0 8px 24px #1018282b;
        font-size: 14px;
    }
    .bottom-sheet .schedule-image-picker:not([hidden]),
    .bottom-sheet .comment-image-fieldset:not([hidden]),
    .bottom-sheet [data-mobile-relation-picker="phrase"].is-open,
    .bottom-sheet [data-mobile-relation-picker="comment"].is-open {
        position: fixed;
        inset: 0;
        z-index: 122;
        display: block !important;
        width: 100%;
        height: 100dvh;
        max-height: none;
        margin: 0;
        padding: 0 14px calc(18px + env(safe-area-inset-bottom));
        overflow-y: auto;
        border: 0;
        border-radius: 0;
        background: #fff;
        overscroll-behavior: contain;
    }
    .bottom-sheet .schedule-image-picker:not([hidden]) > .mobile-selection-header,
    .bottom-sheet .comment-image-fieldset:not([hidden]) > .mobile-selection-header,
    .bottom-sheet [data-mobile-relation-picker].is-open > .mobile-selection-header {
        display: flex;
        margin: 0 -14px 12px;
    }
    .mobile-selection-actions { display: inline-flex; align-items: center; gap: 8px; }
    .mobile-selection-add { min-height: 34px; padding: 7px 10px; border: 0; border-radius: 9px; background: #edf4ff; color: #2563eb; font-size: 12px; font-weight: 800; cursor: pointer; }
    .bottom-sheet [data-mobile-relation-picker].is-open { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
    .bottom-sheet .schedule-image-picker:not([hidden]),
    .bottom-sheet .comment-image-fieldset:not([hidden]) { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }
    .bottom-sheet .schedule-image-picker .upload-drop-zone { display: none; }
    .schedule-mobile-upload-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 40px;
        padding: 8px 12px;
        border: 0;
        border-radius: 9px;
        background: #edf4ff;
        color: #1b64da;
        font-size: 12px;
        font-weight: 700;
    }
    .comment-image-toggle:not([hidden]) {
        display: flex;
        align-items: center;
        gap: 7px;
        width: 100%;
        min-height: 48px;
        margin: 0 0 12px;
        padding: 9px 11px;
        border: 1px solid #dfe5ee;
        border-radius: 10px;
        background: #fff;
        color: #475467;
        text-align: left;
    }
    .comment-image-toggle span { margin-left: auto; color: var(--blue); font-size: 11px; }
    .comment-image-fieldset:not([hidden]) > legend { display: none; }
    .comment-image-fieldset:not([hidden]) .comment-image-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        max-height: none;
        overflow: visible;
    }
    .schedule-selected-image-summary:not([hidden]) {
        display: flex;
        gap: 7px;
        margin: -4px 0 12px;
        padding: 8px;
        overflow-x: auto;
        border: 1px solid #e5eaf1;
        border-radius: 10px;
        background: #f7f9fc;
        scrollbar-width: none;
    }
    .schedule-selected-image-summary::-webkit-scrollbar { display: none; }
    .schedule-selected-image-summary img {
        flex: 0 0 54px;
        width: 54px;
        height: 54px;
        border-radius: 8px;
        object-fit: cover;
    }
    .bottom-sheet [data-mobile-relation-picker].is-open > .mobile-relation-select-button { display: none; }
    [data-mobile-relation-picker="phrase"] .schedule-phrase-grid { display: none !important; }
    [data-mobile-relation-picker="phrase"].is-open .schedule-phrase-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        max-height: none;
        margin-bottom: 12px;
        padding: 6px;
        border-radius: 11px;
        background: #f4f6f8;
    }
    .mobile-comment-choice-list {
        display: grid;
        gap: 6px;
        max-height: none;
        margin: -2px 0 12px;
        padding: 6px;
        overflow-y: auto;
        border-radius: 11px;
        background: #f4f6f8;
    }
    .mobile-comment-choice-list[hidden] { display: none !important; }
    .mobile-comment-choice-list label {
        position: relative;
        display: grid;
        grid-template-columns: 22px minmax(0, 1fr);
        align-items: start;
        gap: 8px;
        width: 100%;
        min-height: 44px;
        margin: 0;
        padding: 9px 10px;
        border: 1px solid #dfe5ee;
        border-radius: 9px;
        background: #fff;
        color: #475467;
        cursor: pointer;
        word-break: break-word;
        font-size: 11px;
        line-height: 1.4;
    }
    .mobile-comment-choice-list label[hidden] { display: none; }
    .mobile-comment-choice-list label:has(input:checked),
    .mobile-comment-choice-list label.is-selected { border-color: var(--blue); background: #edf4ff; color: #1b64da; }
    .mobile-comment-choice-list input[type="radio"] {
        width: 19px;
        min-width: 19px;
        height: 19px;
        min-height: 19px;
        margin: 0;
        accent-color: var(--blue);
    }
    .mobile-comment-choice-list span { min-width: 0; white-space: normal; }
    .mobile-relation-confirm {
        position: fixed;
        right: 14px;
        bottom: calc(12px + env(safe-area-inset-bottom));
        left: 14px;
        z-index: 124;
        display: none;
        align-items: center;
        justify-content: center;
        width: auto;
        min-height: 50px;
        padding: 12px 16px;
        border: 0;
        border-radius: 12px;
        background: var(--blue);
        color: #fff;
        box-shadow: 0 8px 24px #1018282b;
        font-size: 14px;
        font-weight: 800;
    }
    .bottom-sheet [data-mobile-relation-picker].is-open > .mobile-relation-confirm { display: inline-flex; }
    .schedule-existing-images, .comment-image-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .schedule-edit-form > .primary { bottom: calc(-16px - env(safe-area-inset-bottom)); }
    .input-type-tabs { grid-template-columns: repeat(2, 1fr); }

    .dashboard-image-modal, .phrase-grid-modal, .schedule-detail-modal { padding: 8px; }
    .dashboard-image-dialog, .phrase-grid-dialog, .schedule-detail-dialog {
        width: 100%;
        max-height: calc(100dvh - 16px);
        padding: 15px;
        border-radius: 16px;
    }
    .dashboard-image-dialog > header,
    .phrase-grid-dialog > header,
    .schedule-detail-dialog > header { position: sticky; top: -15px; z-index: 4; padding: 12px 0; background: #fff; }
    .dashboard-image-dialog .upload-form .drop-zone { display: none; }
    .dashboard-image-dialog .upload-form { margin-top: 8px; }
    .image-list-toolbar { align-items: center; margin-top: 12px; }
    .image-list-toolbar .image-sort-status { min-width: 0; font-size: 11px; }
    .image-grid-selector { display: flex; }
    .dashboard-modal-image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-modal-image-grid[data-grid-columns="1"] { grid-template-columns: minmax(0, 1fr); }
    .dashboard-modal-image-grid[data-grid-columns="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-modal-image-grid[data-grid-columns="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-modal-image-grid[data-grid-columns="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .dashboard-modal-image-grid[data-grid-columns="3"] .image-actions,
    .dashboard-modal-image-grid[data-grid-columns="4"] .image-actions { flex-wrap: wrap; padding: 4px; }
    .dashboard-modal-image-grid[data-grid-columns="3"] .image-actions a,
    .dashboard-modal-image-grid[data-grid-columns="3"] .image-actions button,
    .dashboard-modal-image-grid[data-grid-columns="4"] .image-actions a,
    .dashboard-modal-image-grid[data-grid-columns="4"] .image-actions button { padding: 4px; font-size: 9px; }
    .phrase-simple-grid { grid-template-columns: 1fr; }
    .schedule-detail-row { grid-template-columns: 48px minmax(0, 1fr) auto; padding: 11px; }

    .table-wrap, .dashboard-phrase-table-wrap { margin-right: -16px; overflow-x: auto; }
    table { min-width: 680px; }
    .product-card-grid { grid-template-columns: 1fr; gap: 10px; }
    .product-card { grid-template-columns: 50px minmax(0, 1fr); grid-template-areas: "thumb main" "stats stats" "status status"; padding: 12px; }
    .product-card-thumb { width: 50px; height: 50px; }
    .product-card-status { justify-self: start; }
    .product-card-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-phrase-manager .panel-head p { display: none; }
    .dashboard-phrase-table-wrap { margin-right: 0; overflow: visible; }
    .dashboard-phrase-table { min-width: 0; }
    .dashboard-phrase-table thead { display: none; }
    .dashboard-phrase-table tbody, .dashboard-phrase-table tr, .dashboard-phrase-table td { display: block; width: 100%; }
    .dashboard-phrase-table tr { border-top: 1px solid var(--line); }
    .dashboard-phrase-table tr:first-child { border-top: 0; }
    .dashboard-phrase-table td { display: none; padding: 0; border: 0; }
    .dashboard-phrase-table td:nth-child(3) { display: block; }
    .desktop-product-link { display: none; }
    .mobile-product-link {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        width: 100%;
        min-height: 56px;
        padding: 13px 4px;
        border: 0;
        background: transparent;
        color: var(--text);
        cursor: pointer;
        text-align: left;
    }
    .mobile-product-link strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
    .mobile-product-link span { flex: 0 0 auto; color: var(--blue); font-size: 12px; }
    .mobile-product-link.is-readonly span { color: var(--muted); }
    .schedule-toolbar { align-items: stretch; flex-direction: column; gap: 10px; }
    .schedule-toolbar-actions { align-items: stretch; flex-direction: column; }
    .schedule-view-toggle { justify-content: center; }
    .schedule-workbench { grid-template-columns: 1fr; }
    .mini-calendar { border-right: 0; border-bottom: 1px solid var(--line); }
    .dashboard-calendar-workbench { grid-template-columns: 1fr; }
    .dashboard-mini-calendar { touch-action: pan-y; user-select: none; }
    .dashboard-calendar-heading { justify-content: space-between; width: 100%; }
    .dashboard-calendar-heading button { width: 28px; height: 28px; }
    .dashboard-calendar-actions {
        display: flex;
        width: 100%;
        gap: 5px;
        flex-wrap: nowrap;
    }
    .dashboard-calendar-actions > button,
    .dashboard-calendar-actions > a {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        min-height: 36px;
        padding: 7px 5px;
        white-space: nowrap;
        font-size: 12px;
    }

    /* Mobile product editor alignment */
    .workspace-drawer,
    .product-workspace-panel { color: var(--text); }
    .workspace-drawer .drawer-head,
    .product-workspace-head {
        min-height: 58px;
        align-items: center;
        gap: 12px;
    }
    .workspace-drawer .drawer-head h2,
    .product-workspace-head h2 {
        overflow: hidden;
        margin: 0;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 18px;
        line-height: 1.3;
    }
    .workspace-drawer .drawer-head > div,
    .product-workspace-head > div { min-width: 0; }
    .workspace-drawer .drawer-head > button,
    .product-workspace-head > button {
        flex: 0 0 40px;
        width: 40px;
        min-width: 40px;
        height: 40px;
        min-height: 40px;
        padding: 0;
        border-radius: 50%;
        background: #f2f4f6;
        font-size: 25px;
        line-height: 1;
    }
    .workspace-drawer > .editor-tab-panel,
    .product-workspace-content > .editor-tab-panel { min-width: 0; }
    .workspace-drawer .editor-tab-panel label,
    .product-workspace-content .editor-tab-panel label {
        gap: 6px;
        margin-bottom: 14px;
        color: #344054;
        font-size: 12px;
        line-height: 1.35;
    }
    .workspace-drawer .editor-tab-panel input:not([type="checkbox"]):not([type="radio"]),
    .workspace-drawer .editor-tab-panel select,
    .workspace-drawer .editor-tab-panel textarea,
    .product-workspace-content .editor-tab-panel input:not([type="checkbox"]):not([type="radio"]),
    .product-workspace-content .editor-tab-panel select,
    .product-workspace-content .editor-tab-panel textarea {
        min-height: 44px;
        padding: 10px 12px;
        border-radius: 10px;
        font-size: 14px;
        line-height: 1.45;
    }
    .workspace-drawer .editor-tab-panel textarea,
    .product-workspace-content .editor-tab-panel textarea { min-height: 112px; }
    .dashboard-editor-product {
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 16px;
        padding: 12px;
        border: 1px solid var(--line);
        border-radius: 13px;
        background: #fafbfc;
    }
    .dashboard-editor-product .product-thumb.large {
        width: 58px;
        height: 58px;
        flex-basis: 58px;
        border-radius: 11px;
    }
    .dashboard-editor-product > button {
        min-height: 40px;
        padding: 9px 13px;
        font-size: 12px;
        font-weight: 700;
    }
    .product-memo-toggle {
        min-height: 36px;
        margin-bottom: 12px;
        padding: 7px 10px;
        font-size: 12px;
    }
    .product-create-extra-actions {
        gap: 7px;
        margin-bottom: 8px;
    }
    .product-create-extra-actions .product-memo-toggle {
        margin-bottom: 0;
    }
    .product-ai-phrase-button {
        min-height: 36px;
        flex: 1 1 130px;
        font-size: 12px;
    }
    .product-ai-phrase-status {
        margin-bottom: 7px;
        font-size: 12px;
    }
    .dashboard-group-fieldset {
        margin: 14px 0;
        padding: 11px;
        border-radius: 11px;
    }
    .dashboard-group-fieldset legend { font-size: 12px; }
    .dashboard-group-fieldset .check-label {
        align-items: center;
        min-height: 38px;
        margin: 0;
        font-size: 12px;
    }
    .editor-phrase-head {
        align-items: center;
        min-height: 40px;
        margin-bottom: 10px;
    }
    .editor-phrase-head strong { font-size: 16px; line-height: 1.35; }
    .editor-phrase-head > button {
        min-height: 36px;
        padding: 7px 10px;
        white-space: nowrap;
        font-size: 11px;
    }
    .editor-phrase-list { gap: 10px; }
    .editor-phrase-card {
        min-width: 0;
        padding: 12px;
        border-radius: 12px;
    }
    .editor-phrase-meta {
        align-items: center;
        gap: 6px;
        min-height: 28px;
        margin-bottom: 8px;
    }
    .editor-phrase-meta > span:first-child { min-width: 0; color: #8b95a1; font-size: 10px; }
    .editor-phrase-meta em { flex: 0 0 auto; font-size: 10px; }
    .editor-phrase-meta-actions { flex: 0 0 auto; gap: 5px; }
    .editor-phrase-meta-actions .edit-log-details summary { min-height: 30px; padding: 5px 8px; font-size: 10px; }
    .editor-phrase-meta-actions .edit-log-list,
    .editor-phrase-meta-actions .edit-log-empty { width: min(300px, calc(100vw - 32px)); }
    .phrase-choice-row { gap: 7px; margin: 7px 0 4px; padding-bottom: 0; }
    .phrase-choice-row label { min-height: 34px; padding: 6px 9px; font-size: 11px; }
    .phrase-save-actions,
    .comment-card-actions { justify-content: flex-end; gap: 6px; }
    .desktop-comment-edit-box { display: none; }
    .mobile-comment-edit-button { display: inline-flex; }
    .phrase-save-actions button,
    .comment-card-actions button {
        min-height: 36px;
        padding: 7px 10px;
        font-size: 11px;
    }
    .editor-record-list { gap: 8px; }
    .editor-record-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 8px;
        padding: 12px;
        overflow: hidden;
        border-radius: 11px;
    }
    .editor-record-card time {
        grid-column: 1 / -1;
        margin-bottom: -2px;
        font-size: 10px;
    }
    .editor-record-card > div { width: 100%; min-width: 0; max-width: 100%; }
    .editor-record-card .post-url {
        max-width: 100%;
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-all;
        font-size: 12px;
        line-height: 1.45;
    }
    .editor-record-card p { max-width: 100%; overflow-wrap: anywhere; word-break: keep-all; font-size: 11px; }
    .mobile-post-edit-button { min-width: 52px; }
    .workspace-drawer > .editor-tabs button,
    .product-workspace-content > .editor-tabs button {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        overflow: hidden;
        text-align: center;
    }
    .workspace-drawer > .editor-tabs b,
    .product-workspace-content > .editor-tabs b { margin-left: 0; }
    .dashboard-three-column { display: none; }
}

@media (max-width: 480px) {
    .main { padding-right: 10px; padding-left: 10px; }
    .panel { padding: 14px; }
    .topbar .user-chip { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .panel-head { flex-direction: column; }
    .panel-head > .primary, .panel-head > .secondary { width: 100%; }
    .dashboard-calendar-actions { display: flex; }
    .dashboard-calendar-actions .primary { grid-column: auto; }
    .dashboard-modal-image-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .schedule-existing-images, .comment-image-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .phrase-save-actions, .comment-card-actions { flex-wrap: wrap; }
    .phrase-save-actions button { flex: 0 1 auto; }
    .phrase-save-actions .primary { flex: 1 1 140px; }
    .toast-stack { top: 8px; right: 8px; width: calc(100% - 16px); }
}

@media (max-width: 800px) {
    body.mobile-menu-open .sidebar {
        display: grid !important;
        grid-template-rows: auto minmax(0, 1fr) auto !important;
        align-items: stretch !important;
        width: min(320px, 88vw) !important;
        height: 100dvh !important;
        transform: translateX(0) !important;
    }
    body.mobile-menu-open .sidebar nav {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        min-height: 0 !important;
        margin: 24px 0 12px !important;
        overflow-y: auto !important;
    }
    body.mobile-menu-open .sidebar nav a {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 10px !important;
        width: 100% !important;
        min-height: 46px !important;
        padding: 12px 14px !important;
    }
    body.mobile-menu-open .sidebar nav a span,
    body.mobile-menu-open .sidebar .menu-icon,
    body.mobile-menu-open .sidebar .menu-label {
        display: inline-flex !important;
        width: auto !important;
        height: auto !important;
        min-width: 0 !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    body.mobile-menu-open .sidebar-bottom {
        display: grid !important;
        width: 100% !important;
    }
    body.mobile-menu-open .sidebar .sidebar-bottom form {
        margin: 0 !important;
    }
}

@media (max-width: 800px) {
    body > details.comment-editor-sheet[open],
    body > details.phrase-editor-sheet[open] {
        width: 100vw !important;
        max-width: none !important;
        align-items: stretch !important;
    }
    body > details.comment-editor-sheet[open] > .mobile-create-sheet-head,
    body > details.comment-editor-sheet[open] > form,
    body > details.phrase-editor-sheet[open] > .mobile-create-sheet-head,
    body > details.phrase-editor-sheet[open] > form {
        width: 100% !important;
        min-width: 100% !important;
        max-width: none !important;
        box-sizing: border-box !important;
        flex: 0 0 auto;
    }
}
