/* assets/style.css — Nova-Pro center shell */
:root {
    --primary: #4338ca;
    --primary-bright: #6366f1;
    --primary-hover: #3730a3;
    --primary-soft: rgba(99, 102, 241, 0.12);
    --accent: #0d9488;
    --accent-soft: rgba(13, 148, 136, 0.12);
    --success: #059669;
    --success-hover: #047857;
    --danger: #dc2626;
    --danger-soft: #fef2f2;

    --text-main: #0f172a;
    --text-light: #64748b;
    --text-muted: #94a3b8;

    --bg-app: #eef2f6;
    --bg-surface: #ffffff;
    --bg-elevated: #f8fafc;

    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --secondary: #64748b;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 22px;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 12px 32px -8px rgba(67, 56, 202, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
    --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.85) inset, var(--shadow-md);

    --header-bg: rgba(252, 252, 255, 0.78);
    --header-edge: rgba(255, 255, 255, 0.65);
    --header-border: rgba(148, 163, 184, 0.35);
    --nav-chip-bg: rgba(241, 245, 249, 0.95);
    --nav-chip-hover: #e2e8f0;
    --focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.35);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- Global Reset & Typography --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "kern" 1, "liga" 1;
}

/* --- App shell --- */
body.app-shell {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-app);
    background-image:
        radial-gradient(ellipse 900px 420px at 80% -15%, rgba(99, 102, 241, 0.14), transparent 55%),
        radial-gradient(ellipse 700px 380px at 5% 25%, rgba(13, 148, 136, 0.09), transparent 50%),
        linear-gradient(180deg, #e8ecf4 0%, var(--bg-app) 38%, #e8edf3 100%);
}

/* Lock editor shell to viewport so .editor-layout / .editor-content can scroll internally */
body.app-shell--editor {
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
}

/* Mobile drawer backdrop */
.app-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s var(--ease-out);
}

body.app-nav-open .app-nav-backdrop {
    opacity: 1;
    pointer-events: auto;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 90;
    padding-top: env(safe-area-inset-top, 0px);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    background: rgba(255, 255, 255, 0.82);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 
        0 1px 0 rgba(255, 255, 255, 0.8) inset,
        0 4px 20px -10px rgba(15, 23, 42, 0.08);
}

.app-header__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 clamp(16px, 4vw, 28px);
}

.app-header__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 72px;
}

.app-header__tail {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s var(--ease-out);
}

.app-brand:hover {
    transform: scale(1.01);
}

.app-brand:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.app-brand__mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-bright) 0%, #312e81 100%);
    color: #fff;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.2) inset,
        0 4px 12px rgba(67, 56, 202, 0.3);
}

.app-brand__logo {
    display: block;
}

.app-brand__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1.1;
    min-width: 0;
}

.app-brand__name {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.04em;
    color: var(--text-main);
}

.app-brand__tagline {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.app-account {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-account--desktop {
    align-items: flex-end;
    text-align: right;
}

.app-account__email {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

.app-account__pills {
    display: flex;
    gap: 4px;
}

.app-pill {
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.app-pill--muted {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.app-pill--quota {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #d1fae5;
}

/* Burger (mobile) */
.app-nav__burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.app-nav__burger:hover {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.4);
}

.app-nav__burger:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.app-nav__burger-line {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 1px;
    background: var(--text-main);
    transition: transform 0.25s var(--ease-out), opacity 0.2s ease;
}

body.app-nav-open .app-nav__burger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

body.app-nav-open .app-nav__burger-line:nth-child(2) {
    opacity: 0;
}

body.app-nav-open .app-nav__burger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Primary nav rail (desktop) / drawer (mobile) */
.app-nav--panel {
    position: relative;
}

.app-nav__drawer-head {
    display: none;
}

.app-nav__link-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    height: 56px;
}

.app-nav__icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.app-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-light);
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    position: relative;
}

.app-nav__link:hover {
    color: var(--text-main);
    background: rgba(148, 163, 184, 0.08);
}

.app-nav__link:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.app-nav__link.is-active {
    color: var(--primary);
    background: var(--primary-soft);
    font-weight: 700;
}

.app-nav__link.is-active::after {
    content: "";
    position: absolute;
    bottom: -12px;
    left: 14px;
    right: 14px;
    height: 3px;
    background: var(--primary);
    border-radius: 3px 3px 0 0;
    box-shadow: 0 -2px 10px var(--primary-soft);
}

.app-nav__link:hover .app-nav__icon,
.app-nav__link.is-active .app-nav__icon {
    opacity: 1;
    transform: translateY(-1px);
}

.app-nav__link.is-active .app-nav__icon {
    color: var(--primary);
}

.app-nav__link--danger {
    color: var(--danger);
    margin-left: auto;
}

.app-nav__link--danger:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

@media (max-width: 768px) {
    .app-nav__burger {
        display: flex;
    }

    .app-account--desktop {
        display: none;
    }

    .app-nav__drawer-head {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 20px 20px 18px;
        margin: 0 -20px 4px;
        border-bottom: 1px solid var(--border);
        background: linear-gradient(180deg, rgba(99, 102, 241, 0.04), transparent);
    }

    .app-nav__drawer-label {
        margin: 0;
        font-size: 0.65rem;
        font-weight: 750;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--text-muted);
    }

    .app-nav__link-wrap {
        flex-direction: column;
        align-items: stretch;
        border-top: none;
        padding: 12px 20px 28px;
        gap: 6px;
        height: auto;
    }

    .app-nav--panel {
        position: fixed;
        top: max(64px, calc(56px + env(safe-area-inset-top, 0px)));
        bottom: 0;
        right: 0;
        left: auto;
        width: min(100%, 400px);
        max-width: 100vw;
        height: auto;
        margin: 0;
        padding: 0 0 max(20px, env(safe-area-inset-bottom, 0px));
        flex-direction: column;
        background: linear-gradient(165deg, #ffffff 0%, #f8fafc 55%);
        box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
        transform: translateX(105%);
        transition: transform 0.32s var(--ease-out);
        z-index: 85;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border-top-left-radius: var(--radius-xl);
    }

    body.app-nav-open .app-nav--panel {
        transform: translateX(0);
    }

    .app-nav__link {
        justify-content: flex-start;
        border-radius: 12px;
        padding: 14px 16px;
    }

    .app-nav__link.is-active::after {
        display: none;
    }

    .app-nav__link--danger {
        margin-left: 0;
        margin-top: 8px;
    }

    .app-header__inner {
        padding-bottom: 0;
    }

    .app-nav__link-wrap .app-nav__link span {
        white-space: normal;
    }

    .app-brand__name {
        font-size: 1.1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    body.app-nav-open .app-nav--panel {
        transition: none;
    }
}

/* --- Layout Containers --- */
.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: clamp(22px, 5vw, 40px) clamp(16px, 4vw, 28px) 56px;
    width: 100%;
}

.editor-layout {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* --- Typography --- */
h1,
h2,
h3 {
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

p {
    color: var(--text-light);
}

/* --- Components: Cards --- */
.card {
    background: linear-gradient(165deg, #ffffff 0%, #fafbfc 100%);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    padding: clamp(24px, 4vw, 36px);
    border: 1px solid rgba(148, 163, 184, 0.35);
    position: relative;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

/* --- Components: Buttons --- */
button {
    font-family: inherit;
}

.btn-primary,
.btn-success,
.btn-danger,
.btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-bright) 0%, var(--primary) 100%);
    color: white;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 4px 14px rgba(67, 56, 202, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #818cf8 0%, var(--primary-hover) 100%);
    transform: translateY(-1px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 6px 20px rgba(67, 56, 202, 0.4);
}

.btn-primary--lg {
    padding: 12px 24px;
    font-size: 1rem;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    transition: background 0.15s ease, border-color 0.15s ease;
    box-shadow: var(--shadow-sm);
}

.btn-ghost:hover {
    background: #f1f5f9;
    border-color: rgba(148, 163, 184, 0.55);
}

.editor-pricing-sticky {
    margin-top: 1.25rem;
}

.editor-pricing-sticky__inner {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
}

.editor-pricing-sticky__hint {
    margin: 0.65rem 0 0;
    font-size: 0.85rem;
    text-align: right;
    width: 100%;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, var(--success) 100%);
    color: white;
    width: 100%;
    margin-top: 1rem;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 4px 14px rgba(5, 150, 105, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #34d399 0%, var(--success-hover) 100%);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    background: #fee2e2;
    color: var(--danger);
}

.btn-sm:hover {
    background: var(--danger);
    color: white;
}

.preview-img {
    max-width: 100%;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

/* --- Modern Tables --- */
.table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin: 20px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.95rem;
}

th {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--text-light);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.07em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-main);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: #f8fafc;
}

/* --- Form Inputs --- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    transition: 0.2s;
    background: #fff;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary-bright);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

/* --- Editor Split Screen --- */
.editor-sidebar {
    width: 35%;
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    padding: 24px;
    overflow-y: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 1px solid rgba(148, 163, 184, 0.12);
}

.editor-sidebar h3 {
    color: #94a3b8;
    margin-bottom: 20px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 100%;
}

.editor-content {
    flex: 1;
    min-height: 0;
    padding: 40px;
    overflow-y: auto;
    background: var(--bg-app);
}

/* Keep PDF/finalize bar visible: sticky breaks with overflow:hidden ancestors; use fixed when pricing is open */
body.app-shell--editor.editor-pricing-open .editor-content {
    padding-bottom: max(120px, calc(96px + env(safe-area-inset-bottom, 0px)));
}

.app-shell--editor.editor-pricing-open .editor-pricing-sticky {
    position: fixed;
    right: 0;
    bottom: 0;
    z-index: 95;
    margin-top: 0;
    margin-left: 0;
    margin-right: 0;
    padding: 14px clamp(16px, 4vw, 28px) calc(14px + env(safe-area-inset-bottom, 0px));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 1px solid var(--border);
    border-bottom: none;
    box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.12);
    background: linear-gradient(180deg, rgba(248, 250, 252, 94%) 0%, #f1f5f9 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

@media (min-width: 901px) {
    .app-shell--editor.editor-pricing-open .editor-pricing-sticky {
        left: 35%;
    }
}

@media (max-width: 900px) {
    .app-shell--editor.editor-pricing-open .editor-pricing-sticky {
        left: 0;
    }
}

.sticky-image {
    position: sticky;
    top: 20px;
    width: 100%;
}

.sticky-image img {
    width: 100%;
    border-radius: var(--radius-md);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.5);
    border: 1px solid #334155;
}

/* --- Utility Classes --- */
.hidden {
    display: none !important;
}

.content-header {
    margin-bottom: 24px;
}

.hint {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 8px;
    text-align: center;
}

/* --- Custom Toast Notification --- */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1e293b;
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* --- Loader Animation --- */
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#loader {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.match-loader {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
}

.match-loader.hidden {
    display: none;
}

.match-loader__panel {
    background: var(--surface, #fff);
    border-radius: 12px;
    padding: 40px 48px;
    max-width: 420px;
    width: calc(100% - 32px);
    text-align: center;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
}

.match-loader__message {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text, #1e293b);
}

.match-loader__sub {
    margin: 0;
    font-size: 0.9rem;
}

.progress-bar {
    height: 12px;
    background: var(--border);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar--match {
    margin: 16px 0 12px;
}

.progress-fill {
    height: 100%;
    background: var(--primary-bright);
    width: 0%;
    transition: width 0.35s ease;
}

.pref-gap-alert {
    margin-bottom: 20px;
}

.pref-gap-alert p {
    margin: 0 0 10px;
}

.pref-gap-alert__list {
    margin: 0 0 10px 1.1rem;
    padding: 0;
    font-size: 0.92rem;
}

.pref-gap-alert__list li {
    margin-bottom: 4px;
}

.pref-gap-alert__more {
    margin: 0 0 8px;
    font-size: 0.88rem;
}

.pref-gap-alert__action {
    margin: 0;
    font-size: 0.92rem;
}

.pref-gap-alert__action a {
    font-weight: 650;
    color: inherit;
}

.editor-bootstrap-loader {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-light);
}

/* --- Page chrome & copy --- */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.breadcrumb a {
    color: var(--primary-hover);
    font-weight: 650;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.breadcrumb a:hover {
    border-bottom-color: rgba(99, 102, 241, 0.45);
}

.breadcrumb__sep {
    color: var(--text-light);
    user-select: none;
}

.breadcrumb__current {
    color: var(--text-light);
    font-weight: 500;
}

.muted {
    color: var(--text-light);
    font-size: 0.9rem;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 550;
    margin: 0 0 16px;
    border: 1px solid transparent;
    box-shadow: var(--shadow-sm);
}

.alert--success {
    background: linear-gradient(135deg, #ecfdf5, #f0fdfa);
    border-color: #6ee7b7;
    color: #047857;
}

.alert--error {
    background: linear-gradient(135deg, #fef2f2, #fff1f2);
    border-color: #fca5a5;
    color: #b91c1c;
}

.alert--warning {
    background: linear-gradient(135deg, #fffbeb, #fef9c3);
    border-color: #fcd34d;
    color: #92400e;
}

.settings-inv-muted {
    font-size: 0.88rem;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
}

.settings-inv-warn {
    margin: 6px 0 0;
    font-size: 0.82rem;
    color: #b45309;
}

.form-group {
    margin-bottom: 1.1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.card--lift {
    box-shadow: var(--shadow-lg);
}

.page-hero {
    margin-bottom: clamp(22px, 4vw, 34px);
    position: relative;
    padding: 16px 16px 16px 20px;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    border-left: 4px solid var(--primary-bright);
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.08) 0%, transparent 58%);
}

.page-kicker {
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--primary-hover);
    margin-bottom: 10px;
}

.page-title {
    font-size: clamp(1.55rem, 4.5vw, 2rem);
    font-weight: 750;
    letter-spacing: -0.038em;
    line-height: 1.18;
    color: var(--text-main);
    margin: 0 0 12px;
}

.page-desc {
    font-size: 1.02rem;
    color: var(--text-light);
    max-width: 58ch;
    margin: 0;
    line-height: 1.62;
}

.upload-card-head {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.upload-card-head h2 {
    font-size: 1.15rem;
    font-weight: 750;
    letter-spacing: -0.02em;
    margin: 0 0 6px;
}

.upload-card-head p {
    margin: 0;
    font-size: 0.9rem;
}

.upload-area {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-xl);
    padding: clamp(40px, 8vw, 64px) 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
    background: linear-gradient(165deg, #ffffff 0%, #f1f5f9 100%);
    position: relative;
    overflow: hidden;
}

.upload-area::after {
    content: "";
    position: absolute;
    inset: -40% -20%;
    background: radial-gradient(circle at 30% 20%, rgba(99, 102, 241, 0.09), transparent 55%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.upload-area:hover::after,
.upload-area:focus-within::after {
    opacity: 1;
}

.upload-area:hover,
.upload-area:focus-within {
    border-color: var(--primary-bright);
    background: linear-gradient(165deg, rgba(99, 102, 241, 0.07) 0%, rgba(13, 148, 136, 0.05) 100%);
    box-shadow: 0 0 0 4px var(--primary-soft);
    transform: scale(1.003);
}

.upload-placeholder .upload-illustration {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    color: var(--primary-bright);
    opacity: 0.95;
    filter: drop-shadow(0 6px 12px rgba(99, 102, 241, 0.25));
}

.upload-placeholder .icon {
    display: none;
}

.upload-hint {
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-light);
}

.flow-rail {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 20px;
    padding: 0;
}

.flow-rail__step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--border);
    font-size: 0.82rem;
    font-weight: 650;
    color: var(--text-light);
    box-shadow: var(--shadow-sm);
}

.flow-rail__step.is-current {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(13, 148, 136, 0.08));
    border-color: rgba(99, 102, 241, 0.35);
    color: var(--primary-hover);
}

.flow-rail__step.is-done {
    color: var(--accent);
    border-color: rgba(13, 148, 136, 0.35);
}

.flow-rail__num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 750;
    background: var(--nav-chip-bg);
    color: var(--text-main);
}

.flow-rail__step.is-current .flow-rail__num {
    background: var(--primary-bright);
    color: #fff;
}

.flow-rail__step.is-done .flow-rail__num {
    background: var(--accent);
    color: #fff;
}

.flow-rail__text {
    font-weight: 650;
}

.editor-flow-header {
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.editor-flow-header .page-kicker {
    margin-bottom: 8px;
}

.flow-rail--compact {
    margin-bottom: 0;
}

.flow-rail--compact .flow-rail__step {
    padding: 8px 12px;
    font-size: 0.78rem;
}

.flow-rail--compact .flow-rail__num {
    width: 24px;
    height: 24px;
    font-size: 0.65rem;
}

.catalog-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    margin-top: 10px;
}

.catalog-tile {
    display: block;
    padding: 22px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: linear-gradient(155deg, #ffffff 0%, #f8fafc 45%, #f1f5f9 100%);
    text-decoration: none;
    color: inherit;
    transition: transform 0.22s var(--ease-out), border-color 0.2s ease, box-shadow 0.22s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.catalog-tile__row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.catalog-tile__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.catalog-tile::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-bright), var(--accent));
    opacity: 0;
    transition: opacity 0.2s ease;
}

.catalog-tile:hover::before {
    opacity: 1;
}

.catalog-tile:hover {
    transform: translateY(-3px);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: var(--shadow-lg);
}

.catalog-tile:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.catalog-tile__icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-soft), var(--accent-soft));
    color: var(--primary-hover);
    flex-shrink: 0;
}

.catalog-tile__icon svg {
    display: block;
}

.catalog-tile__label {
    font-weight: 750;
    font-size: 1.08rem;
    letter-spacing: -0.025em;
}

.catalog-tile__hint {
    font-size: 0.88rem;
    color: var(--text-light);
    line-height: 1.5;
}

.catalog-tile__action {
    margin-top: 6px;
    font-size: 0.78rem;
    font-weight: 750;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--primary-bright);
}

.table-card {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
    margin: 16px 0;
}

.table-card table {
    margin: 0;
}

#table2 th.numeric,
#table2 td.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

#table2 .pricing-net-unit {
    white-space: nowrap;
    color: var(--text-muted);
    font-weight: 650;
}

#table2 th.pricing-select-col,
#table2 td.pricing-select-col {
    width: 2.75rem;
    padding-left: 12px;
    padding-right: 8px;
    text-align: center;
    vertical-align: middle;
}

#table2 .pricing-row-select,
#table2 #pricingSelectAll {
    width: 1rem;
    height: 1rem;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary, #2563eb);
}

#table2 tr.pricing-row--selected td {
    background: rgba(37, 99, 235, 0.06);
}

.pricing-bulk-bar {
    margin-bottom: 1rem;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.pricing-bulk-bar__summary {
    margin: 0 0 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.pricing-bulk-bar__fields {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 16px;
    align-items: flex-end;
}

.pricing-bulk-bar__field {
    margin: 0;
    min-width: 7rem;
}

.pricing-bulk-bar__field label {
    font-size: 0.78rem;
    margin-bottom: 4px;
}

.pricing-bulk-bar__field input {
    width: 6.5rem;
}

/* Editör · eşleştirme (envanter tablosu) */
.editor-match-panel.editor-match-panel {
    padding: clamp(20px, 3vw, 30px);
}

.editor-match-panel__intro {
    margin-bottom: 1.125rem;
}

.editor-match-panel__intro h2 {
    font-size: clamp(1.12rem, 2.4vw, 1.42rem);
    margin: 0 0 0.4rem;
    letter-spacing: -0.03em;
}

.editor-match-panel__intro .muted {
    margin: 0;
    max-width: 62ch;
    font-size: 0.93rem;
    line-height: 1.55;
}

.table-card--matching-editor {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    max-height: min(calc(100vh - 220px), 680px);
    max-height: min(calc(100dvh - 220px), 680px);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.5);
}

.editor-match-table {
    width: max(100%, 800px);
    font-size: 0.9rem;
}

.editor-match-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 1px 0 var(--border-strong);
}

.editor-match-table th.numeric,
.editor-match-table td.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.editor-match-table .match-price-cell {
    white-space: nowrap;
}

.editor-match-table__actions {
    text-align: right;
    width: 1%;
}

.editor-match-table td:first-child small {
    display: inline-block;
    max-width: 15rem;
    line-height: 1.38;
    color: var(--text-main);
    font-size: inherit;
}

.editor-match-table [data-match-unit-price] {
    color: var(--text-muted);
    font-weight: 650;
}

.editor-match-table [data-match-unit-price].is-filled {
    color: var(--text-main);
}

.editor-match-qty {
    width: 100%;
    max-width: 5rem;
    min-width: 3.75rem;
    padding: 8px 10px;
}

.editor-match-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
    gap: 0.5rem;
}

.editor-match-photo {
    min-width: 10rem;
}

.editor-match-photo__item {
    display: block;
    width: 100%;
    padding: 6px 8px;
    font-size: 0.875rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
}

.editor-match-rates-hint {
    font-size: 0.7rem;
    margin: 0.2rem 0 0;
}

.editor-match-replace-btn {
    display: block;
    width: 100%;
    margin-top: 0.35rem;
}

.editor-add-item-listeden-hint {
    margin-top: 0.35rem;
    font-size: 0.85rem;
}

.editor-combobox-host {
    position: relative;
    z-index: 1;
}

.editor-combobox-host:focus-within,
.editor-combobox-host.is-open {
    z-index: 60;
}

.editor-combobox {
    position: relative;
    min-width: 10rem;
}

.editor-combobox__control {
    display: flex;
    gap: 2px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.editor-combobox__input {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
    font-size: 0.875rem;
    background: var(--bg-surface);
    border: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    color: var(--text-main);
}

.editor-combobox__toggle {
    padding: 4px 8px;
    border: none;
    border-left: 1px solid var(--border);
    background: var(--bg-elevated);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    color: var(--text-main);
}

.editor-combobox__panel {
    position: absolute;
    z-index: 70;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 2px;
    max-height: 240px;
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
}

.editor-combobox__panel:not(.hidden) {
    isolation: isolate;
}

.editor-combobox__panel--fixed {
    z-index: 200;
    min-width: 12rem;
}

.editor-combobox__list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--bg-surface);
}

.editor-combobox__option {
    padding: 8px 10px;
    cursor: pointer;
    font-size: 0.8125rem;
    background: var(--bg-surface);
    color: var(--text-main);
}

.editor-combobox__option:hover,
.editor-combobox__option.is-active {
    background: var(--primary-soft);
}

.editor-combobox__option--clear {
    color: var(--text-muted);
    font-style: italic;
    border-bottom: 1px solid var(--border);
}

.editor-combobox__empty,
.editor-combobox__more {
    padding: 8px 10px;
    font-size: 0.8125rem;
    background: var(--bg-surface);
    color: var(--text-main);
}

.editor-match-table td {
    overflow: visible;
    vertical-align: top;
}

.editor-combobox__selected {
    margin: 0 0 0.35rem;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    border-left: 3px solid var(--primary);
}

.editor-combobox__selected.is-browsing {
    opacity: 0.92;
}

.editor-combobox__selected-kicker {
    display: block;
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 2px;
}

.editor-combobox__selected-value {
    display: block;
    font-size: 0.8125rem;
    line-height: 1.4;
    font-weight: 500;
    color: var(--text-main);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.editor-combobox.has-selected-label .editor-combobox__control {
    border-color: var(--border-strong);
}

.editor-combobox__hint {
    font-size: 0.7rem;
    margin: 2px 0 0;
}

.editor-combobox__meta {
    font-size: 0.7rem;
    padding: 6px 10px 4px;
    margin: 0;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.editor-combobox__more {
    display: block;
    width: 100%;
    text-align: center;
    padding: 8px 10px;
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
}

.editor-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.45);
}

.editor-modal.hidden {
    display: none;
}

body.kvkk-consent-pending {
    overflow: hidden;
}

.editor-modal__panel {
    position: relative;
    width: 100%;
    max-width: 28rem;
    max-height: 90vh;
    overflow-y: auto;
}

.editor-modal__close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1.5rem;
    line-height: 1;
}

.editor-modal__actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.editor-row-status {
    margin: 0 0 0.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    background: var(--primary-soft);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

.editor-row-num-col {
    width: 2.5rem;
    text-align: center;
}

.editor-row-num {
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-weight: 650;
    color: var(--text-muted);
    vertical-align: top;
    padding-top: 10px;
}

#table2 td.pricing-name-col,
#table2 th.pricing-name-col {
    min-width: 18rem;
    width: 28%;
    vertical-align: top;
}

.pricing-product {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pricing-product-card {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    border-left: 3px solid var(--primary);
}

.pricing-product-card__kicker {
    display: block;
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 4px;
}

.pricing-product-card__body {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pricing-product-card__brand {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.3;
}

.pricing-product-card__title,
.pricing-product-card__value {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.45;
    color: var(--text-main);
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.pricing-product-card__code {
    display: inline-block;
    align-self: flex-start;
    margin-top: 2px;
    padding: 1px 6px;
    font-size: 0.68rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.pricing-product-card__org-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 6px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--bg-surface);
    border-radius: var(--radius-sm);
}

.pricing-product-card__edit {
    margin-top: 6px;
    padding: 2px 0;
    font-size: 0.75rem;
    align-self: flex-start;
}

.pricing-product-edit {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
}

.pricing-product-edit__label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.pricing-product-edit__input {
    display: block;
    width: 100%;
    min-height: 4.5rem;
    padding: 8px 10px;
    resize: vertical;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.45;
    font-family: inherit;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-main);
}

.pricing-product-edit__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.pricing-product-edit__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

#table2 tr.pricing-row--selected .pricing-product-card {
    background: rgba(99, 102, 241, 0.16);
}

.btn-sm.btn-sm--secondary {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--primary-hover);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-sm.btn-sm--secondary:hover {
    background: #eef2ff;
    color: var(--primary-bright);
    border-color: rgba(99, 102, 241, 0.35);
}

@media (max-width: 720px) {
    .editor-match-table td:first-child small {
        max-width: 11rem;
    }

    .table-card--matching-editor {
        max-height: min(calc(100vh - 200px), 560px);
        max-height: min(calc(100dvh - 200px), 560px);
    }
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
}

.btn-success {
    width: auto;
    margin-top: 0;
}

.stack-section {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.stack-section:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.section-heading {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--text-main);
}

.team-member-card {
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 18px;
    background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: var(--shadow-sm);
}

.permission-list {
    display: grid;
    gap: 10px;
    margin: 12px 0;
}

.permission-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: #fff;
    border: 1px solid var(--border);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.permission-item:hover {
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 2px 8px rgba(67, 56, 202, 0.08);
}

.permission-item__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.permission-item__label {
    font-size: 0.92rem;
    font-weight: 650;
    color: var(--text-main);
    line-height: 1.35;
}

.permission-item__meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.permission-item__meta code {
    font-size: inherit;
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-light);
}

.permission-item input {
    margin-top: 3px;
    flex-shrink: 0;
}

.inline-form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 20px;
}

.inline-form-row .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 160px;
}

.inline-form-row .btn-primary,
.inline-form-row .btn-sm {
    align-self: flex-end;
}

.item-edit-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    align-items: end;
}

.item-edit-grid .form-group {
    margin-bottom: 0;
}

.item-row-sep td {
    border-top: 2px solid var(--border);
    padding-top: 16px;
    background: #fafafa;
    word-break: break-word;
}

.items-admin-table {
    font-size: 0.9rem;
}

.a11y-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.editor-phase-placeholder {
    max-width: 520px;
    padding: clamp(24px, 4vw, 36px);
    background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
    border-radius: var(--radius-xl);
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: var(--shadow-lg);
}

.editor-phase-placeholder h2 {
    font-size: 1.15rem;
    margin: 0 0 10px;
}

.editor-phase-placeholder p {
    margin: 0 0 20px;
}

a.btn-primary {
    text-decoration: none;
}

.proposal-meta.card {
    padding: 24px;
}

.proposal-meta-details {
    margin-top: 8px;
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

.proposal-meta-details summary {
    cursor: pointer;
    font-weight: 600;
    list-style: none;
    user-select: none;
}

.proposal-meta-details summary::-webkit-details-marker {
    display: none;
}

.proposal-meta-details summary::before {
    content: '▸ ';
    display: inline-block;
    transition: transform 0.15s ease;
}

.proposal-meta-details[open] summary::before {
    transform: rotate(90deg);
}

.proposal-meta-details[open] summary {
    margin-bottom: 16px;
}

.proposal-meta-grid {
    display: grid;
    gap: 12px 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.proposal-meta-grid__full {
    grid-column: 1 / -1;
}

.proposal-meta-grid .form-group {
    margin-bottom: 0;
}

@media (max-width: 640px) {
    .proposal-meta-grid {
        grid-template-columns: 1fr;
    }
}

.total-row td {
    font-weight: 700;
    background: #f1f5f9;
}

@media (max-width: 900px) {
    .editor-layout {
        flex-direction: column;
    }

    .editor-sidebar {
        width: 100%;
        max-height: min(42vh, 320px);
        flex-shrink: 0;
    }

    .editor-content {
        padding: 24px clamp(16px, 4vw, 28px);
    }

    body.app-shell--editor.editor-pricing-open .editor-content {
        padding-bottom: max(120px, calc(96px + env(safe-area-inset-bottom, 0px)));
    }
}

@media (max-width: 480px) {
    .card {
        padding: 22px 18px;
    }

    h1 {
        font-size: 1.65rem;
    }
}

/* --- Catalog admin (pro inventory) --- */

.catalog-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.catalog-toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.catalog-toolbar--compact {
    border-bottom: none;
    padding-bottom: 0;
}

.catalog-toolbar__row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.catalog-toolbar__row--secondary {
    align-items: flex-end;
}

.catalog-toolbar__search {
    flex: 2;
    min-width: 200px;
}

.catalog-toolbar .form-group {
    margin-bottom: 0;
    min-width: 120px;
}

.catalog-toolbar__check {
    align-self: center;
}

.catalog-multi-select {
    min-height: 38px;
    max-width: 180px;
}

.catalog-range {
    margin-bottom: 8px;
}

.catalog-loading.hidden,
.catalog-empty.hidden {
    display: none;
}

.catalog-table {
    width: 100%;
    font-size: 0.9rem;
}

.catalog-table tbody tr {
    cursor: default;
    transition: background 0.12s ease;
}

.catalog-table tbody tr:hover {
    background: #f8fafc;
}

.catalog-pagination {
    margin-top: 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.catalog-drawer__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 900;
}

.catalog-drawer__backdrop.hidden {
    display: none;
}

.catalog-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: min(440px, 100vw);
    height: 100vh;
    height: 100dvh;
    background: #fff;
    box-shadow: -8px 0 32px rgba(15, 23, 42, 0.12);
    z-index: 901;
    transform: translateX(100%);
    transition: transform 0.22s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.catalog-drawer--narrow {
    width: min(360px, 100vw);
}

.catalog-drawer--open {
    transform: translateX(0);
}

.catalog-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 12px;
    border-bottom: 1px solid var(--border);
}

.catalog-drawer__head .section-heading {
    margin: 0;
}

.catalog-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 24px;
}

.catalog-drawer__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.catalog-search-select__input {
    margin-bottom: 6px;
}

body.catalog-drawer-open {
    overflow: hidden;
}

.catalog-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    padding: 12px 20px;
    border-radius: var(--radius-md);
    background: #1e293b;
    color: #fff;
    font-size: 0.9rem;
    z-index: 950;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    max-width: min(90vw, 420px);
    text-align: center;
}

.catalog-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.catalog-toast--success {
    background: #166534;
}

.catalog-toast--error {
    background: #b91c1c;
}

.page-desc kbd {
    font-size: 0.85em;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f1f5f9;
    border: 1px solid var(--border);
}

@media (max-width: 768px) {
    .catalog-drawer {
        width: 100vw;
    }

    .catalog-toolbar__row {
        flex-direction: column;
        align-items: stretch;
    }

    .catalog-multi-select {
        max-width: none;
    }
}

/* --- User guide (center/guide.php) --- */
body.app-shell--guide {
    min-height: 100vh;
}

.container--guide {
    max-width: 1120px;
}

.page-hero--guide {
    margin-bottom: 1.25rem;
}

.guide-quota-banner {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    background: var(--primary-soft);
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.guide-layout {
    display: grid;
    grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.guide-toc {
    position: sticky;
    top: 88px;
    padding: 18px 16px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.guide-toc__title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-light);
    margin: 0 0 12px;
}

.guide-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.guide-toc__list a {
    display: block;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    color: var(--text-main);
    text-decoration: none;
    line-height: 1.35;
    border: 1px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.guide-toc__list a:hover {
    background: var(--bg-elevated);
    border-color: var(--border);
}

.guide-toc__list a.is-active {
    background: var(--primary-soft);
    border-color: rgba(99, 102, 241, 0.35);
    color: var(--primary);
    font-weight: 600;
}

.guide-content {
    padding: 28px 32px;
}

.guide-section {
    padding-bottom: 2rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.guide-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

.guide-section__title {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 14px;
    color: var(--text-main);
    scroll-margin-top: 96px;
}

.guide-section__lead {
    margin-bottom: 16px;
    color: var(--text-light);
    font-size: 0.95rem;
}

.guide-subtitle {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 1.5rem 0 10px;
    color: var(--text-main);
}

.guide-steps {
    margin: 12px 0 16px;
    padding-left: 1.25rem;
}

.guide-steps li {
    margin-bottom: 10px;
}

.guide-steps--numbered {
    list-style: decimal;
}

.guide-list {
    margin: 12px 0 16px;
    padding-left: 1.25rem;
}

.guide-list li {
    margin-bottom: 8px;
}

.guide-list--tips li {
    margin-bottom: 10px;
}

.guide-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 14px 0 18px;
}

.guide-table th,
.guide-table td {
    padding: 10px 12px;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.guide-table th {
    background: var(--bg-elevated);
    font-weight: 600;
}

.guide-table tbody tr:nth-child(even) {
    background: rgba(248, 250, 252, 0.7);
}

.guide-callout {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin: 16px 0;
    border: 1px solid var(--border);
}

.guide-callout p {
    margin: 0;
    font-size: 0.92rem;
}

.guide-callout--info {
    background: rgba(13, 148, 136, 0.08);
    border-color: rgba(13, 148, 136, 0.3);
}

.guide-callout--warning {
    background: #fffbeb;
    border-color: #fcd34d;
}

.guide-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
}

.guide-footer p {
    margin: 0 0 8px;
}

@media (max-width: 900px) {
    .guide-layout {
        grid-template-columns: 1fr;
    }

    .guide-toc {
        position: static;
        max-height: none;
    }

    .guide-toc__list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
    }

    .guide-content {
        padding: 20px 18px;
    }

    .guide-table {
        display: block;
        overflow-x: auto;
    }
}

@media (max-width: 520px) {
    .guide-toc__list {
        grid-template-columns: 1fr;
    }
}
