/* =====================================================================
   TIMOPDF — Admin Design System
   Luxury Blue · Midnight · Platinum · Muted Gold
   ===================================================================== */

:root {
    /* Brand */
    --primary-50:  #EEF3FF;
    --primary-100: #DCE6FF;
    --primary-200: #B8CDFF;
    --primary-300: #8AAAFF;
    --primary-400: #5C82FF;
    --primary-500: #2E59F0;
    --primary-600: #1E4FD8;
    --primary-700: #143CB0;
    --primary-800: #0B2A6B;
    --primary-900: #061739;
    --midnight:    #050B22;

    /* Accents */
    --gold-300: #E8C887;
    --gold-400: #D9B86E;
    --gold-500: #C9A55C;
    --gold-600: #A88742;

    /* Neutrals */
    --white: #FFFFFF;
    --paper: #F7F9FE;
    --silver-50:  #F4F6FB;
    --silver-100: #E6EBF5;
    --silver-200: #D2DAEA;
    --silver-300: #B7C1D6;
    --silver-400: #8B96B0;
    --silver-500: #5E6A85;
    --silver-600: #3E4862;
    --silver-700: #25304B;
    --silver-800: #131B32;

    /* Semantic */
    --success: #16A079;
    --warning: #E0A526;
    --danger:  #DC3F4C;
    --info:    #2E78E0;

    /* Surfaces */
    --bg:        #F2F5FC;
    --surface:   #FFFFFF;
    --surface-2: #F7F9FE;
    --border:    rgba(11, 42, 107, 0.08);
    --border-strong: rgba(11, 42, 107, 0.18);
    --text:      #0F1A36;
    --text-mute: #5C6A88;
    --text-dim:  #8693AF;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(11,42,107,0.06);
    --shadow-sm: 0 2px 6px rgba(11,42,107,0.07);
    --shadow:    0 8px 24px rgba(11,42,107,0.10);
    --shadow-lg: 0 18px 48px rgba(11,42,107,0.16);
    --shadow-xl: 0 28px 72px rgba(6,23,57,0.24);

    /* Radii */
    --r-xs: 6px;
    --r-sm: 8px;
    --r:    12px;
    --r-lg: 16px;
    --r-xl: 22px;
    --r-2xl: 32px;
    --r-full: 999px;

    /* Spacing scale */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 20px;
    --s-6: 24px;
    --s-8: 32px;
    --s-10: 40px;
    --s-12: 48px;
    --s-16: 64px;

    /* Type */
    --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-display: 'Playfair Display', 'Inter', serif;
    --font-arabic: 'Cairo', 'Tajawal', 'Segoe UI', sans-serif;

    /* Gradients */
    --grad-royal: linear-gradient(135deg, #1E4FD8 0%, #0B2A6B 65%, #050B22 100%);
    --grad-soft:  linear-gradient(135deg, #EEF3FF 0%, #FFFFFF 100%);
    --grad-gold:  linear-gradient(135deg, #E8C887 0%, #C9A55C 65%, #A88742 100%);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html { font-size: 15px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.55;
}
body[dir="rtl"] { font-family: var(--font-arabic); }

a { color: var(--primary-600); text-decoration: none; }
a:hover { color: var(--primary-700); }

h1, h2, h3, h4, h5 { margin: 0 0 var(--s-3); color: var(--primary-900); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 16px; }

.display-font { font-family: var(--font-display); letter-spacing: -0.01em; }

/* ----------------------------- Layout shell --------------------------- */

.app {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--grad-royal);
    color: var(--silver-100);
    padding: var(--s-6) var(--s-4);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 3px; }

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: var(--s-2) var(--s-3) var(--s-6);
    margin-bottom: var(--s-4);
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-mark {
    width: 44px; height: 44px;
    border-radius: var(--r);
    background: var(--grad-gold);
    color: var(--primary-900);
    display: grid; place-items: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 20px;
    box-shadow: 0 6px 18px rgba(201,165,92,0.45);
}

.brand-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #fff;
    line-height: 1.1;
}
.brand-subtitle { font-size: 11px; color: var(--silver-300); letter-spacing: 0.25em; text-transform: uppercase; margin-top: 4px; }

.nav-group { margin-bottom: var(--s-6); }
.nav-group-title {
    color: var(--silver-300);
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding: 0 var(--s-3) var(--s-2);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px var(--s-3);
    border-radius: var(--r);
    color: var(--silver-100);
    margin-bottom: 2px;
    font-weight: 500;
    transition: background .18s ease, color .18s ease, transform .18s ease;
    font-size: 14px;
}
.nav-link:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-link.active {
    background: rgba(255,255,255,0.13);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--gold-500);
}
.nav-link .icon { width: 18px; height: 18px; opacity: 0.9; }

/* Main area */
.main { min-width: 0; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-4);
    padding: var(--s-5) var(--s-8);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar-title { font-family: var(--font-display); font-size: 22px; color: var(--primary-900); margin: 0; }
.topbar-sub  { color: var(--text-mute); font-size: 13px; }

.user-chip {
    display: flex; align-items: center; gap: 12px;
    padding: 6px 14px 6px 6px;
    background: var(--silver-50);
    border-radius: var(--r-full);
}
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--grad-royal); color: #fff;
    display: grid; place-items: center; font-weight: 600;
    box-shadow: var(--shadow-xs);
}
.user-name { font-size: 13px; font-weight: 600; color: var(--primary-900); }
.user-meta { font-size: 11px; color: var(--text-mute); }

.content { padding: var(--s-8); max-width: 1400px; }

/* Page header */
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: var(--s-6);
    margin-bottom: var(--s-6);
    flex-wrap: wrap;
}
.page-head .lead h1 { margin: 0; font-family: var(--font-display); font-size: 30px; }
.page-head .lead p  { color: var(--text-mute); margin: 4px 0 0; }
.page-head .actions { display: flex; gap: 10px; }

/* Breadcrumb */
.breadcrumb {
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--text-mute);
    text-transform: uppercase; letter-spacing: 0.16em;
    margin-bottom: var(--s-3);
}
.breadcrumb a { color: var(--text-mute); }
.breadcrumb a:hover { color: var(--primary-700); }
.breadcrumb .sep { opacity: 0.45; }

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}
.card-pad { padding: var(--s-6); }
.card-head {
    padding: var(--s-5) var(--s-6);
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
}
.card-head h3 { margin: 0; font-size: 16px; color: var(--primary-900); font-family: var(--font-display); }
.card-body  { padding: var(--s-6); }
.card-foot  { padding: var(--s-4) var(--s-6); border-top: 1px solid var(--border); background: var(--surface-2); }

/* Grid helpers */
.grid { display: grid; gap: var(--s-5); }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1024px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 640px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Stats card */
.stat {
    display: flex; flex-direction: column; gap: 8px;
    padding: var(--s-6);
    border-radius: var(--r-lg);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden;
}
.stat::before {
    content: ''; position: absolute; right: -40px; top: -40px;
    width: 140px; height: 140px;
    background: radial-gradient(circle at center, rgba(30,79,216,0.12), transparent 60%);
}
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.18em; color: var(--text-mute); }
.stat .value { font-family: var(--font-display); font-size: 32px; color: var(--primary-900); }
.stat .delta { color: var(--success); font-size: 12px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px;
    border-radius: var(--r);
    border: 1px solid transparent;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
    text-decoration: none;
    background: transparent;
    color: var(--primary-800);
    line-height: 1;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--grad-royal); color: #fff; box-shadow: 0 8px 22px rgba(30,79,216,0.30); }
.btn-primary:hover { color: #fff; box-shadow: 0 12px 28px rgba(30,79,216,0.40); }

.btn-gold { background: var(--grad-gold); color: var(--primary-900); }
.btn-gold:hover { color: var(--primary-900); }

.btn-outline { background: var(--surface); border-color: var(--border-strong); color: var(--primary-800); }
.btn-outline:hover { background: var(--silver-50); }

.btn-ghost { background: transparent; color: var(--text-mute); }
.btn-ghost:hover { background: var(--silver-50); color: var(--primary-800); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-lg { padding: 14px 26px; font-size: 15px; border-radius: var(--r-lg); }

/* Form */
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--s-4); }
.form-row label, .form-label {
    font-size: 12px; font-weight: 600; color: var(--silver-700);
    text-transform: uppercase; letter-spacing: 0.12em;
}
.form-row .hint, .form-hint { color: var(--text-mute); font-size: 12px; }

.input, .select, .textarea {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--r);
    border: 1.5px solid var(--silver-200);
    background: var(--surface);
    font-size: 14px;
    font-family: inherit;
    color: var(--text);
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
    outline: none;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px rgba(46,89,240,0.12);
    background: #fff;
}
.input[readonly], .input:disabled { background: var(--silver-50); color: var(--silver-600); }

.input-group { display: flex; gap: var(--s-3); }
.input-group > * { flex: 1; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); }
.table {
    width: 100%;
    border-collapse: separate; border-spacing: 0;
    font-size: 14px;
}
.table thead th {
    text-align: left;
    padding: 14px var(--s-5);
    background: var(--silver-50);
    color: var(--silver-700);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    border-bottom: 1px solid var(--border);
}
.table tbody td {
    padding: 14px var(--s-5);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--silver-50); }
.table .row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.empty-state {
    padding: var(--s-12) var(--s-6);
    text-align: center;
    color: var(--text-mute);
}
.empty-state .icon { font-size: 40px; opacity: 0.4; margin-bottom: 12px; }
.empty-state h3 { color: var(--primary-900); }

/* Badges */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: var(--r-full);
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: var(--silver-100); color: var(--silver-700);
}
.badge-success { background: rgba(22,160,121,0.12); color: var(--success); }
.badge-warning { background: rgba(224,165,38,0.15); color: var(--warning); }
.badge-danger  { background: rgba(220,63,76,0.12); color: var(--danger); }
.badge-info    { background: rgba(46,120,224,0.12); color: var(--info); }
.badge-primary { background: rgba(30,79,216,0.12); color: var(--primary-700); }
.badge-gold    { background: rgba(201,165,92,0.20); color: var(--gold-600); }
.badge-muted   { background: var(--silver-100); color: var(--silver-500); }

/* Alerts / flash */
.alerts { display: flex; flex-direction: column; gap: 10px; margin-bottom: var(--s-5); }
.alert {
    padding: 14px 18px;
    border-radius: var(--r);
    border-left: 4px solid var(--primary-500);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    font-size: 14px;
}
.alert-success { border-color: var(--success); background: rgba(22,160,121,0.06); }
.alert-error   { border-color: var(--danger);  background: rgba(220,63,76,0.06); }
.alert-warning { border-color: var(--warning); background: rgba(224,165,38,0.06); }
.alert-info    { border-color: var(--info);    background: rgba(46,120,224,0.06); }

/* Stepper (proposal builder) */
.stepper {
    display: flex; gap: 8px; flex-wrap: wrap;
    background: var(--surface);
    padding: var(--s-3);
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    margin-bottom: var(--s-6);
}
.step {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-radius: var(--r);
    background: transparent;
    color: var(--silver-600);
    flex: 1; min-width: 130px;
    text-decoration: none;
    transition: background .18s ease, color .18s ease;
}
.step:hover { background: var(--silver-50); color: var(--primary-800); }
.step.active   { background: var(--grad-royal); color: #fff; box-shadow: var(--shadow); }
.step.done     { color: var(--primary-700); background: var(--primary-50); }
.step .num {
    width: 26px; height: 26px; border-radius: 50%;
    background: rgba(255,255,255,0.18); color: inherit;
    display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.step:not(.active) .num { background: var(--silver-200); color: var(--silver-600); }
.step.done .num { background: var(--primary-200); color: var(--primary-800); }
.step .label { font-size: 13px; font-weight: 600; }
.step .sub { font-size: 10.5px; opacity: 0.7; letter-spacing: 0.06em; text-transform: uppercase; }

/* Image upload */
.upload-zone {
    border: 2px dashed var(--silver-300);
    border-radius: var(--r-lg);
    padding: var(--s-6);
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    background: var(--silver-50);
    text-align: center;
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease;
    color: var(--text-mute);
}
.upload-zone:hover { border-color: var(--primary-400); background: var(--primary-50); color: var(--primary-700); }
.upload-zone img { max-width: 100%; max-height: 220px; border-radius: var(--r); box-shadow: var(--shadow-sm); }

/* Tag chips for multiple selection */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: var(--r-full);
    background: var(--primary-50); color: var(--primary-700);
    font-size: 12px; font-weight: 600;
}
.chip .x { cursor: pointer; opacity: 0.6; }
.chip .x:hover { opacity: 1; }

/* Divider */
.divider { height: 1px; background: var(--border); margin: var(--s-5) 0; }

/* Auth page */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    background: var(--bg);
}
.auth-hero {
    background:
        linear-gradient(135deg, rgba(5,11,34,0.92), rgba(11,42,107,0.85)),
        url('https://images.unsplash.com/photo-1503220317375-aaad61436b1b?auto=format&fit=crop&w=1600&q=80') center/cover;
    color: #fff;
    padding: var(--s-12);
    display: flex; flex-direction: column; justify-content: space-between;
    position: relative;
}
.auth-hero::after {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at top right, rgba(201,165,92,0.18), transparent 50%);
    pointer-events: none;
}
.auth-hero h1 { color: #fff; font-family: var(--font-display); font-size: 46px; line-height: 1.05; max-width: 520px; }
.auth-hero p { color: var(--silver-200); max-width: 480px; font-size: 15px; }
.auth-hero .pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: var(--r-full); background: rgba(255,255,255,0.10); color: #fff; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; backdrop-filter: blur(4px); }
.auth-hero ul { list-style: none; padding: 0; margin: 0; color: var(--silver-100); }
.auth-hero ul li { padding: 8px 0 8px 28px; position: relative; }
.auth-hero ul li::before { content: '✦'; position: absolute; left: 0; color: var(--gold-400); }

.auth-form-side {
    display: grid; place-items: center;
    padding: var(--s-12);
}
.auth-card {
    width: 100%; max-width: 440px;
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: var(--s-10);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.auth-card .logo {
    width: 64px; height: 64px; border-radius: var(--r-lg);
    background: var(--grad-royal); color: #fff;
    display: grid; place-items: center; font-family: var(--font-display); font-size: 28px;
    box-shadow: var(--shadow);
    margin-bottom: var(--s-5);
}
.auth-card h2 { font-family: var(--font-display); font-size: 28px; margin-bottom: 6px; }
.auth-card .sub { color: var(--text-mute); margin-bottom: var(--s-6); }
.auth-card .demo-creds {
    background: var(--primary-50);
    border-left: 3px solid var(--primary-500);
    padding: 12px 14px;
    border-radius: var(--r-sm);
    font-size: 12px; color: var(--primary-800);
    margin-bottom: var(--s-5);
}
.auth-card .demo-creds b { color: var(--primary-900); }

@media (max-width: 960px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
}

/* Mobile sidebar toggle */
@media (max-width: 960px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { position: fixed; top: 0; left: -300px; width: 280px; transition: left .25s ease; }
    .sidebar.is-open { left: 0; }
    .content { padding: var(--s-5); }
    .topbar { padding: var(--s-4) var(--s-5); }
}

/* Utilities */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-mute); }
.text-gold { color: var(--gold-500); }
.text-primary { color: var(--primary-700); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11.5px; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.divider-spacer { height: 24px; }

/* Image thumbs */
.thumb { width: 48px; height: 48px; border-radius: var(--r-sm); object-fit: cover; box-shadow: var(--shadow-xs); }
.thumb-lg { width: 96px; height: 96px; border-radius: var(--r); }

/* Form rows variations — auto-flow into as many columns as fit (240px minimum) */
.form-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
@media (max-width: 540px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid.col-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-grid.col-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
/* Reset .form-grid inside the builder-form to fewer columns when content is tight */
.builder-form .form-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* Toggle */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: var(--silver-300); border-radius: 999px; transition: .2s; }
.switch .slider::before { content: ''; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: var(--shadow-xs); }
.switch input:checked + .slider { background: var(--primary-600); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* Itinerary / day cards */
.day-card {
    border-left: 4px solid var(--primary-500);
    background: var(--surface);
    border-radius: var(--r-lg);
    padding: var(--s-5) var(--s-6);
    margin-bottom: var(--s-4);
    box-shadow: var(--shadow-sm);
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.day-card .day-head { display: flex; align-items: center; gap: 12px; margin-bottom: var(--s-4); }
.day-card .day-num {
    background: var(--grad-royal);
    color: #fff;
    border-radius: var(--r);
    padding: 6px 14px;
    font-family: var(--font-display);
    font-size: 14px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

/* Login responsive demo */
.login-toggle { display: flex; gap: 4px; background: var(--silver-100); padding: 4px; border-radius: var(--r); margin-bottom: var(--s-5); }
.login-toggle button { flex: 1; padding: 10px; border: 0; background: transparent; border-radius: var(--r-sm); font-weight: 600; cursor: pointer; color: var(--silver-600); }
.login-toggle button.active { background: #fff; color: var(--primary-800); box-shadow: var(--shadow-xs); }

/* ============================================================
   Proposal builder shell — 2 columns: form (left) + live preview (right)
   ============================================================ */
/* Stacked vertical layout: form full-width on top, big preview below */
.builder-grid {
    display: block;
}
.builder-form { width: 100%; max-width: 100%; }

.builder-preview {
    margin-top: var(--s-6);
    width: 100%;
    height: 1200px;
    max-height: 92vh;
    min-height: 900px;
    border-radius: var(--r-lg);
    background: linear-gradient(160deg, #131B32 0%, #050B22 100%);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    color: #fff;
    display: flex;
    flex-direction: column;
}
.builder-preview.is-expanded {
    position: fixed;
    inset: 24px;
    top: 24px; right: 24px; bottom: 24px; left: 24px;
    z-index: 1000;
    height: auto;
    max-height: none;
    min-height: 0;
}
.builder-preview.is-expanded ~ * { pointer-events: none; }
body.preview-expanded { overflow: hidden; }
body.preview-expanded::before {
    content: '';
    position: fixed; inset: 0;
    background: rgba(5, 11, 34, 0.55);
    z-index: 999;
}
.preview-head {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.10);
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.7);
}
.preview-head .dots { display: flex; gap: 6px; }
.preview-head .dot { width: 10px; height: 10px; border-radius: 50%; background: rgba(255,255,255,0.18); }
.preview-head .dot.red { background: #FF6B6B; }
.preview-head .dot.yellow { background: #F0B85B; }
.preview-head .dot.green { background: #5BD9A4; }
.preview-head .preview-actions { display: flex; gap: 8px; }
.preview-head button {
    background: rgba(255,255,255,0.10);
    color: #fff;
    border: 0; border-radius: 6px;
    padding: 5px 10px;
    font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
    cursor: pointer;
    font-weight: 600;
}
.preview-head button:hover { background: rgba(255,255,255,0.20); }

.preview-stage {
    flex: 1;
    overflow: auto;
    background:
        radial-gradient(circle at 50% 0%, rgba(201,165,92,0.08), transparent 50%),
        #1A2238;
    padding: 16px;
    position: relative;
}
.preview-stage::-webkit-scrollbar { width: 8px; }
.preview-stage::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.preview-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.45);
    display: block;
}

.preview-empty {
    color: rgba(255,255,255,0.6);
    text-align: center;
    padding: 60px 20px;
    font-size: 13px;
}

/* Language-aware field hiding */
.builder-form[data-language="en"]  .lang-ar { display: none !important; }
.builder-form[data-language="ar"]  .lang-en { display: none !important; }
form[data-language="en"]  .lang-ar { display: none !important; }
form[data-language="ar"]  .lang-en { display: none !important; }
.lang-pill {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    border-radius: 999px;
    background: var(--silver-100);
    color: var(--silver-600);
}
.lang-ar .lang-pill { background: rgba(201,165,92,0.18); color: var(--gold-600); }
.lang-en .lang-pill { background: rgba(30,79,216,0.12); color: var(--primary-700); }

/* Language switcher banner */
.lang-banner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px;
    background: linear-gradient(135deg, #EEF3FF 0%, #FFF 100%);
    border: 1px solid var(--border);
    border-radius: var(--r);
    margin-bottom: var(--s-4);
    font-size: 13px;
    color: var(--primary-800);
}
.lang-banner b { color: var(--primary-900); }
.lang-banner .seg {
    display: inline-flex;
    background: var(--surface);
    border-radius: var(--r-sm);
    padding: 3px;
    border: 1px solid var(--border);
}
.lang-banner .seg button {
    border: 0; background: transparent;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
    color: var(--silver-600);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.lang-banner .seg button.is-on {
    background: var(--grad-royal);
    color: #fff;
    box-shadow: var(--shadow-xs);
}

/* Inline-edit hover affordance (used inside iframe via injected styles) */
[contenteditable][data-field] {
    cursor: text;
    outline: 2px dashed transparent;
    outline-offset: 4px;
    transition: outline-color .18s ease, background .18s ease;
    border-radius: 4px;
}
[contenteditable][data-field]:hover {
    outline-color: rgba(255, 215, 130, 0.55);
    background: rgba(255, 235, 180, 0.10);
}
[contenteditable][data-field]:focus {
    outline-color: var(--gold-400);
    outline-style: solid;
    background: rgba(255, 235, 180, 0.18);
}
[contenteditable][data-field][data-saving="1"] {
    outline-color: var(--success);
    outline-style: solid;
}

/* Step view tightening for builder grid */
.builder-form .card { margin-bottom: var(--s-4); }
.builder-form .form-grid { gap: var(--s-3); }

/* Refresh toast */
.preview-toast {
    position: absolute;
    left: 50%; bottom: 24px;
    transform: translateX(-50%);
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity .25s ease;
    pointer-events: none;
}
.preview-toast.is-on { opacity: 1; }

