/* === CSS Variables === */
:root {
    --color-bg: #f0f0f0;
    --color-surface: #ffffff;
    --color-border: #ddd;
    --color-text: #333;
    --color-text-secondary: #777;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-secondary: #6b7280;
    --color-modified: #f59e0b;
    --color-selected: #2563eb;
    --color-frame-bg: rgba(59, 130, 246, 0.06);
    --color-frame-border: rgba(59, 130, 246, 0.3);
    --color-frame-hover: rgba(59, 130, 246, 0.12);
    --toolbar-height: 56px;
    --panel-width: 380px;
    --font-family: "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Meiryo", sans-serif;
}

/* === Reset === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    color: var(--color-text);
    background: var(--color-bg);
    height: 100vh;
    overflow: hidden;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Toolbar === */
#toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--toolbar-height);
    padding: 0 16px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    gap: 12px;
    flex-shrink: 0;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.toolbar-left h1 {
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
}

#file-info {
    font-size: 12px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
}

/* Desktop: hamburger hidden, collapsible shown inline */
.toolbar-menu-toggle {
    display: none;
}

.toolbar-collapsible {
    display: contents;
}

#change-count {
    font-size: 12px;
    color: var(--color-modified);
    font-weight: 600;
    white-space: nowrap;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    font-size: 13px;
    font-family: var(--font-family);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

.btn-primary:disabled {
    background: #93b4f5;
    border-color: #93b4f5;
    cursor: default;
}

.btn-secondary {
    color: var(--color-secondary);
}

.btn-back {
    padding: 6px 10px;
    font-size: 16px;
    text-decoration: none;
    color: var(--color-text);
}

.toolbar-user {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-left: 4px;
}

.btn-large {
    padding: 12px 28px;
    font-size: 15px;
}

/* === Workspace === */
#workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* === Canvas Area === */
#canvas-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(45deg, #e8e8e8 25%, transparent 25%),
        linear-gradient(-45deg, #e8e8e8 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e8e8e8 75%),
        linear-gradient(-45deg, transparent 75%, #e8e8e8 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    touch-action: none;
}

#canvas-area.panning {
    cursor: grab;
}

#canvas-area.panning:active {
    cursor: grabbing;
}

#empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 20px;
    color: var(--color-text-secondary);
    font-size: 15px;
}

#artboard-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#artboard {
    position: relative;
    background: var(--color-surface);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

#artboard .background-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
    opacity: 0.85;
}

/* === Text Frames on Canvas === */
.text-frame {
    position: absolute;
    border: 1px dashed var(--color-frame-border);
    background: var(--color-frame-bg);
    cursor: pointer;
    overflow: hidden;
    transition: background 0.12s, border-color 0.12s;
    line-height: 1.3;
}

.text-frame:hover {
    background: var(--color-frame-hover);
    border-color: var(--color-selected);
}

.text-frame.selected {
    border: 2px solid var(--color-selected);
    background: rgba(37, 99, 235, 0.08);
    z-index: 10;
}

.text-frame.modified {
    border-left: 3px solid var(--color-modified);
}

.text-frame.selected.modified {
    border: 2px solid var(--color-selected);
    border-left: 3px solid var(--color-modified);
}

.text-frame .frame-id {
    position: absolute;
    top: -1px;
    left: -1px;
    font-size: 9px;
    background: rgba(37, 99, 235, 0.85);
    color: white;
    padding: 1px 4px;
    border-radius: 0 0 4px 0;
    line-height: 1.2;
    z-index: 1;
    pointer-events: none;
}

.text-frame .frame-text {
    display: block;
    white-space: pre-wrap;
    word-break: break-all;
    pointer-events: none;
}

/* === Artboard Tabs === */
.artboard-tabs {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 2px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
    user-select: none;
}

.artboard-tab {
    padding: 5px 14px;
    font-size: 12px;
    font-family: var(--font-family);
    font-weight: 500;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s;
}

.artboard-tab:hover {
    background: #f0f0f0;
    color: var(--color-text);
}

.artboard-tab.active {
    background: var(--color-primary);
    color: white;
}

/* === Zoom Controls === */
.zoom-controls {
    position: absolute;
    bottom: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 4px 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
    user-select: none;
}

.zoom-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
    color: var(--color-text);
    transition: background 0.12s;
}

.zoom-btn:hover {
    background: #f0f0f0;
}

.zoom-btn.zoom-fit {
    font-size: 18px;
    margin-left: 4px;
    border-left: 1px solid var(--color-border);
    padding-left: 8px;
    border-radius: 0;
}

.zoom-label {
    font-size: 11px;
    color: var(--color-text-secondary);
    min-width: 36px;
    text-align: center;
}

/* === Panel Tabs === */
.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.panel-tab {
    flex: 1;
    padding: 10px 0;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-family);
    color: var(--color-text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.panel-tab:hover {
    color: var(--color-text);
}

.panel-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

/* === Editor Panel === */
#editor-panel {
    width: var(--panel-width);
    border-left: 1px solid var(--color-border);
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

/* Desktop: hide sheet handle */
.sheet-handle {
    display: none;
}

#frame-list-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-bottom: 1px solid var(--color-border);
}

#frame-list-section h2,
#frame-detail-section h2 {
    font-size: 13px;
    font-weight: 600;
    padding: 10px 14px 6px;
    color: var(--color-text-secondary);
}

/* === Filter Buttons === */
#frame-filter {
    display: flex;
    gap: 4px;
    padding: 0 14px 8px;
}

.filter-btn {
    font-size: 11px;
    padding: 3px 10px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-family: var(--font-family);
    transition: background 0.12s;
}

.filter-btn:hover {
    background: #f0f0f0;
}

.filter-btn.active {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* === Frame List === */
#frame-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
}

#frame-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
    line-height: 1.5;
    transition: background 0.1s;
}

#frame-list li:hover {
    background: #f7f7f7;
}

#frame-list li.selected {
    background: #eff6ff;
}

#frame-list li .list-id {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-secondary);
    background: #f0f0f0;
    padding: 1px 6px;
    border-radius: 3px;
    margin-top: 1px;
}

#frame-list li .list-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

#frame-list li .list-modified {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-modified);
    margin-top: 4px;
}

/* === Frame Detail === */
#frame-detail-section {
    flex-shrink: 0;
    max-height: 50%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#frame-detail-placeholder {
    padding: 24px 14px;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 13px;
}

#frame-detail {
    padding: 0 14px 14px;
    overflow-y: auto;
    flex: 1;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 10px;
}

.meta-tag {
    font-size: 10px;
    padding: 2px 8px;
    background: #f0f0f0;
    border-radius: 3px;
    color: var(--color-text-secondary);
}

#frame-detail label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin: 8px 0 4px;
}

#frame-detail textarea {
    width: 100%;
    min-height: 60px;
    padding: 8px;
    font-size: 13px;
    font-family: var(--font-family);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    resize: vertical;
    line-height: 1.5;
}

#frame-detail textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

#frame-detail textarea[readonly] {
    background: #f9f9f9;
    color: var(--color-text-secondary);
}

.detail-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.detail-actions .btn {
    flex: 1;
    justify-content: center;
}

/* === Version Panel === */
.version-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.version-panel-header {
    padding: 10px 14px;
    flex-shrink: 0;
}

.version-panel-header .btn {
    width: 100%;
    justify-content: center;
}

.version-loading,
.version-empty {
    padding: 24px 14px;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.version-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
}

.version-item {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
}

.version-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.version-number {
    font-weight: 600;
    color: var(--color-primary);
    font-size: 11px;
}

.version-date {
    color: var(--color-text-secondary);
    font-size: 10px;
}

.version-item-body {
    margin-bottom: 6px;
}

.version-label {
    font-size: 12px;
    color: var(--color-text-secondary);
    cursor: default;
}

.version-label-input {
    width: 100%;
    padding: 3px 6px;
    font-size: 12px;
    font-family: var(--font-family);
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    outline: none;
}

.version-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.version-creator {
    color: var(--color-text-secondary);
    font-size: 10px;
}

.btn-small {
    padding: 3px 10px;
    font-size: 11px;
}

/* === Utility Classes === */
.text-secondary {
    color: var(--color-text-secondary);
    font-size: 12px;
}

.alert {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 16px;
}

.alert-error {
    background: #fef2f2;
    color: #dc2626;
}

/* === Login Page === */
.page-login body,
body.page-login {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: auto;
}

.page-login #app {
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.auth-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.login-card {
    background: var(--color-surface);
    border-radius: 12px;
    padding: 40px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.login-card h1 {
    font-size: 20px;
    margin-bottom: 4px;
}

.login-card .subtitle {
    color: var(--color-text-secondary);
    font-size: 13px;
    margin-bottom: 24px;
}

.login-card label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.login-card input[type="email"],
.login-card input[type="password"],
.login-card input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
    font-family: var(--font-family);
}

.login-card input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.login-card .btn-large {
    width: 100%;
    margin-top: 8px;
}

/* === Projects Page === */
.page-projects #app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.projects-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--toolbar-height);
    padding: 0 24px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.projects-header h1 {
    font-size: 16px;
    font-weight: 700;
}

.projects-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    font-size: 13px;
    color: var(--color-text-secondary);
}

.projects-main {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.projects-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.projects-toolbar h2 {
    font-size: 18px;
    font-weight: 600;
}

.projects-loading,
.projects-empty {
    text-align: center;
    padding: 60px 24px;
    color: var(--color-text-secondary);
    font-size: 14px;
}

.projects-empty p + p {
    margin-top: 8px;
}

/* === Project Grid === */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.project-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.project-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border-color: #bbb;
}

.project-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.project-card-name {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    word-break: break-word;
}

.project-card-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.project-card-settings,
.project-card-menu {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
    color: var(--color-text-secondary);
    transition: background 0.12s, color 0.12s;
}

.project-card-settings:hover {
    background: #f0f0f0;
    color: var(--color-text);
}

.project-card-menu:hover {
    background: #fee2e2;
    color: #dc2626;
}

.project-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
}

.project-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 24px;
}

.modal-card {
    background: var(--color-surface);
    border-radius: 12px;
    padding: 28px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.modal-card h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
}

.modal-card label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
    margin-top: 12px;
}

.modal-card label:first-of-type {
    margin-top: 0;
}

.modal-card input[type="text"],
.modal-card input[type="file"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 4px;
    font-family: var(--font-family);
}

.modal-card input[type="text"]:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.modal-card input[type="file"] {
    padding: 8px;
    font-size: 12px;
}

.modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    justify-content: flex-end;
}

.btn-danger {
    background: #dc2626;
    color: white;
    border-color: #dc2626;
}

.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

/* === Settings Modal === */
.settings-modal {
    max-width: 520px;
}

.share-url-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Members management */
.members-list {
    margin-bottom: 8px;
}
.member-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}
.member-name {
    font-weight: 600;
    min-width: 80px;
}
.member-email {
    flex: 1;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.member-role {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--color-bg);
    white-space: nowrap;
}
.member-add-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 8px;
}
.member-email-input {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 13px;
}
.member-role-select {
    padding: 6px 4px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 13px;
}

.share-url-input {
    flex: 1;
    padding: 8px 10px;
    font-size: 12px;
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: #f9f9f9;
    color: var(--color-text);
}

.notify-emails-input {
    width: 100%;
    padding: 8px 10px;
    font-size: 13px;
    font-family: var(--font-family);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    resize: vertical;
    line-height: 1.5;
}

.notify-emails-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* === Setup Page === */
.setup-content {
    max-width: 720px;
}

.setup-section {
    margin-bottom: 32px;
    padding: 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
}

.setup-section h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.setup-desc {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
    line-height: 1.6;
}

.setup-desc code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.setup-empty {
    padding: 16px;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.setup-empty a {
    color: var(--color-primary);
    text-decoration: none;
}

.setup-select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: var(--font-family);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
}

.setup-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.setup-config-preview {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
}

.setup-config-preview pre {
    font-size: 12px;
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    line-height: 1.5;
    margin: 0;
}

.setup-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.setup-actions a.btn {
    text-decoration: none;
}

.setup-message {
    margin-top: 8px;
    font-size: 12px;
    color: #16a34a;
}

.setup-note {
    margin-top: 12px;
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.setup-note code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
}

.setup-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setup-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.setup-step strong {
    display: block;
    font-size: 13px;
    margin-bottom: 2px;
}

.setup-step p {
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.setup-step code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

/* === Status Badge === */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 12px;
    white-space: nowrap;
    line-height: 1.5;
}

.status-gray {
    background: #f3f4f6;
    color: #6b7280;
}

.status-blue {
    background: #dbeafe;
    color: #2563eb;
}

.status-orange {
    background: #fff7ed;
    color: #ea580c;
}

.status-green {
    background: #dcfce7;
    color: #16a34a;
}

.status-purple {
    background: #f3e8ff;
    color: #9333ea;
}

/* === Toolbar Status === */
.toolbar-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-actions {
    display: flex;
    gap: 4px;
}

/* === Preview Mode === */
.btn-preview-active {
    background: #1e293b;
    color: white;
    border-color: #1e293b;
}

.btn-preview-active:hover {
    background: #334155;
    border-color: #334155;
}

#canvas-area.preview {
    background: #1a1a1a;
}

#canvas-area.preview #artboard {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

#canvas-area.preview .background-image.preview-bg {
    opacity: 1;
}

/* ============================================
   Responsive - Tablet (max-width: 1024px)
   ============================================ */
@media (max-width: 1024px) {
    :root {
        --panel-width: 300px;
    }

    .toolbar-left h1 {
        font-size: 14px;
    }

    #file-info {
        display: none;
    }

    .btn {
        padding: 5px 10px;
        font-size: 12px;
    }

    #frame-list li {
        padding: 6px 12px;
    }

    #frame-detail {
        padding: 0 12px 12px;
    }
}

/* ============================================
   Responsive - Mobile (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
    :root {
        --toolbar-height: 48px;
        --panel-width: 100%;
    }

    /* --- Toolbar mobile --- */
    #toolbar {
        padding: 0 10px;
        gap: 8px;
    }

    .toolbar-left h1 {
        font-size: 13px;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .toolbar-actions {
        gap: 4px;
    }

    .toolbar-actions .btn {
        padding: 5px 8px;
        font-size: 11px;
    }

    .toolbar-user {
        display: none;
    }

    #change-count {
        display: none;
    }

    .toolbar-status {
        gap: 4px;
    }

    .status-actions {
        display: none;
    }

    /* --- Hamburger menu toggle --- */
    .toolbar-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border: 1px solid var(--color-border);
        border-radius: 6px;
        background: var(--color-surface);
        cursor: pointer;
        font-size: 18px;
        color: var(--color-text);
        flex-shrink: 0;
    }

    .toolbar-menu-toggle:hover {
        background: #f5f5f5;
    }

    .toolbar-collapsible {
        display: none;
    }

    .toolbar-collapsible.open {
        display: flex;
        position: absolute;
        top: var(--toolbar-height);
        right: 0;
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-top: none;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
        border-radius: 0 0 8px 8px;
        padding: 8px;
        gap: 6px;
        flex-wrap: wrap;
        z-index: 200;
        max-width: 280px;
    }

    /* --- Workspace vertical stack --- */
    #workspace {
        flex-direction: column;
        position: relative;
    }

    /* --- Canvas takes full space --- */
    #canvas-area {
        flex: 1;
    }

    /* --- Editor panel as bottom sheet --- */
    #editor-panel {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 60vh;
        border-left: none;
        border-top: 1px solid var(--color-border);
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        z-index: 150;
        transform: translateY(calc(100% - 44px));
        transition: transform 0.3s ease;
    }

    #editor-panel.sheet-open {
        transform: translateY(0);
    }

    /* --- Bottom sheet drag handle --- */
    .sheet-handle {
        display: flex;
        justify-content: center;
        padding: 8px 0 4px;
        cursor: grab;
        flex-shrink: 0;
    }

    .sheet-handle::after {
        content: '';
        width: 40px;
        height: 4px;
        background: #ccc;
        border-radius: 2px;
    }

    .sheet-handle:active {
        cursor: grabbing;
    }

    .sheet-handle:active::after {
        background: #999;
    }

    /* --- Frame detail section full width --- */
    #frame-detail-section {
        max-height: none;
    }

    /* --- Artboard tabs horizontal scroll --- */
    .artboard-tabs {
        left: 10px;
        transform: none;
        max-width: calc(100% - 20px);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .artboard-tabs::-webkit-scrollbar {
        display: none;
    }

    /* --- Zoom controls smaller --- */
    .zoom-controls {
        bottom: 52px;
        right: 10px;
        padding: 3px 6px;
    }

    .zoom-btn {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }

    .zoom-label {
        font-size: 10px;
        min-width: 30px;
    }

    /* --- Projects page --- */
    .projects-header {
        padding: 0 12px;
    }

    .projects-main {
        padding: 16px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .project-card {
        padding: 16px;
    }

    /* --- Login page --- */
    .login-card {
        padding: 24px;
    }

    /* --- Modal --- */
    .modal-overlay {
        padding: 16px;
        align-items: flex-end;
    }

    .modal-card {
        border-radius: 12px 12px 0 0;
        padding: 20px;
        max-width: 100%;
    }
}

/* ============================================
   Responsive - Small Mobile (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
    .toolbar-left h1 {
        max-width: 80px;
    }

    .btn-back {
        padding: 4px 6px;
    }

    #editor-panel {
        max-height: 70vh;
    }

    .projects-main {
        padding: 12px;
    }
}
