/* ============================================================
   360° Meridian Platform — Design System v4
   ------------------------------------------------------------
   Editorial Intelligence Interface
   Display : Cormorant Garamond   (headlines, KPI values, titles)
   UI/Body : Plus Jakarta Sans    (all UI text)
   Data    : IBM Plex Mono        (figures, codes, data)

   Accent  : Warm amber gold — distinctive vs generic SaaS blue
   Dark    : Deep navy-black + warm ivory text
   Light   : Warm ivory background + rich amber
   ============================================================ */

@import url('https://fonts.bunny.net/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ── Light theme ─────────────────────────────────────────── */
:root,
[data-theme="light"] {
    color-scheme: light;

    --bg:           #f5f0e8;
    --bg-grad:      radial-gradient(1000px 500px at 80% -10%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 60%);
    --surface:      #faf7f2;
    --surface-2:    #ede8df;
    --surface-3:    #e4ddd2;
    --elevated:     #ffffff;

    --border:        #ddd6ca;
    --border-strong: #c8bfb0;
    --ring:          color-mix(in srgb, var(--accent) 28%, transparent);

    --text:    #1a1208;
    --text-2:  #4a3f2f;
    --text-3:  #8a7d6a;

    --shadow-sm: 0 1px 3px rgba(26,18,8,.06);
    --shadow:    0 2px 6px rgba(26,18,8,.06), 0 6px 22px rgba(26,18,8,.07);
    --shadow-lg: 0 12px 40px rgba(26,18,8,.10);
    --shadow-xl: 0 28px 72px rgba(26,18,8,.13);

    --success: #187a4a; --success-bg: #e5f5ec; --success-fg: #0e5c36;
    --warning: #a8600e; --warning-bg: #fdf0dc; --warning-fg: #7a4208;
    --danger:  #c43b3b; --danger-bg:  #fce8e8; --danger-fg:  #9e2222;
    --info:    #2260c4; --info-bg:    #e2ecfb; --info-fg:    #153d8f;
}

/* ── Dark theme ──────────────────────────────────────────── */
[data-theme="dark"] {
    color-scheme: dark;

    --bg:           #0c0e15;
    --bg-grad:      radial-gradient(1000px 600px at 75% -5%, color-mix(in srgb, var(--accent) 11%, transparent), transparent 58%);
    --surface:      #12161f;
    --surface-2:    #191e2b;
    --surface-3:    #202636;
    --elevated:     #161b26;

    --border:        #242c3f;
    --border-strong: #2e3850;
    --ring:          color-mix(in srgb, var(--accent) 42%, transparent);

    --text:    #ede8df;
    --text-2:  #a09890;
    --text-3:  #5f584e;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.44);
    --shadow:    0 2px 6px rgba(0,0,0,.5), 0 8px 26px rgba(0,0,0,.38);
    --shadow-lg: 0 16px 50px rgba(0,0,0,.55);
    --shadow-xl: 0 32px 80px rgba(0,0,0,.65);

    --success: #3ecf8e; --success-bg: #0d2b1d; --success-fg: #5ddfaa;
    --warning: #e0a93c; --warning-bg: #291e08; --warning-fg: #edbf64;
    --danger:  #f07070; --danger-bg:  #2a1212; --danger-fg:  #f59090;
    --info:    #5b95f5; --info-bg:    #101d38; --info-fg:    #84b1f8;
}

/* ── Global tokens (theme-independent) ───────────────────── */
:root {
    --accent:       var(--cfg-primary,   #c4871f);
    --accent-2:     var(--cfg-secondary, #a06c10);
    --accent-fg:    #ffffff;
    --accent-tint:  color-mix(in srgb, var(--accent) 13%, var(--surface));

    /* Legacy aliases — kept for backward compatibility */
    --brand-primary:   var(--accent);
    --brand-secondary: var(--accent-2);
    --brand-accent:    color-mix(in srgb, var(--accent) 70%, #fff);
    --brand-tint:      var(--accent-tint);
    --brand-gradient:  linear-gradient(135deg, var(--accent), var(--accent-2));

    --content-bg:    var(--bg);
    --content-bg-2:  var(--surface-2);
    --card-bg:       var(--surface);
    --topbar-bg:     var(--surface);
    --topbar-height: 60px;

    --sidebar-bg:          var(--surface);
    --sidebar-border:      var(--border);
    --sidebar-hover:       var(--surface-2);
    --sidebar-active-bg:   var(--accent-tint);
    --sidebar-active-text: var(--accent);
    --sidebar-text:        var(--text-2);
    --sidebar-text-hover:  var(--text);
    --sidebar-width:       252px;
    --sidebar-collapsed-w: 64px;

    --text-primary:   var(--text);
    --text-secondary: var(--text-2);
    --text-muted:     var(--text-3);
    --border-light:   color-mix(in srgb, var(--border) 55%, transparent);

    --ochre: #c2872e;

    --radius-sm: 5px; --radius: 8px; --radius-lg: 12px; --radius-xl: 18px; --radius-pill: 9999px;

    --font-heading: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --font-body:    'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono:    'IBM Plex Mono', ui-monospace, 'Cascadia Code', monospace;

    --transition: all .18s cubic-bezier(.4,0,.2,1);
    --ease: cubic-bezier(.4,0,.2,1);

    /* Semantic aliases */
    --success-light: var(--success-bg); --success-dark: var(--success-fg);
    --warning-light: var(--warning-bg); --warning-dark: var(--warning-fg);
    --danger-light:  var(--danger-bg);  --danger-dark:  var(--danger-fg);
    --info-light:    var(--info-bg);    --info-dark:    var(--info-fg);
    --tdi-primary: var(--accent); --tdi-secondary: var(--accent-2); --tdi-dark: var(--text);
    --tdi-light: var(--bg); --tdi-gray: var(--text-3);
    --tdi-success: var(--success); --tdi-warning: var(--warning); --tdi-danger: var(--danger); --tdi-info: var(--info);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-body);
    font-size: 14px; line-height: 1.56;
    color: var(--text);
    background: var(--bg);
    background-image: var(--bg-grad);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
    transition: background-color .3s var(--ease), color .3s var(--ease);
}

h1,h2,h3,h4,h5 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
    line-height: 1.14;
}
a { color: var(--accent); text-decoration: none; }
::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); }
.kpi-value, .stat-info, table td, .session-table td, [data-num] { font-variant-numeric: tabular-nums; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    position: fixed; top: 0; left: 0; width: var(--sidebar-width); height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column; z-index: 200; overflow: hidden auto;
    transition: width .24s var(--ease), background-color .3s var(--ease), border-color .3s var(--ease);
    flex-shrink: 0;
}
/* Amber top accent line */
.sidebar::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent) 0%, color-mix(in srgb, var(--accent) 20%, transparent) 80%, transparent 100%);
    z-index: 1;
}
.sidebar.collapsed { width: var(--sidebar-collapsed-w); }
.sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 14px;
    border-bottom: 1px solid var(--border);
    min-height: var(--topbar-height); flex-shrink: 0;
}
.sidebar-logo {
    display: flex; align-items: center; gap: 10px;
    color: var(--text);
    font-family: var(--font-heading);
    font-size: 20px; font-weight: 700;
    letter-spacing: -0.02em;
    white-space: nowrap; overflow: hidden;
}
.sidebar-logo i {
    width: 30px; height: 30px;
    background: var(--accent);
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    color: var(--accent-fg); font-size: 12px; flex-shrink: 0;
}
.sidebar-logo-img { height: 30px; width: auto; max-width: 146px; object-fit: contain; flex-shrink: 0; }
.sidebar.collapsed .sidebar-logo-img { max-width: 32px; }
.sidebar.collapsed .sidebar-logo-text { display: none; }
.sidebar-toggle {
    background: none; border: none; color: var(--text-3); cursor: pointer;
    padding: 5px; border-radius: var(--radius-sm); font-size: 11px;
    transition: var(--transition); flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--accent); }
.sidebar.collapsed .sidebar-toggle i { transform: rotate(180deg); }

.sidebar-nav { display: flex; flex-direction: column; padding: 12px 10px 20px; flex: 1; gap: 1px; }
.nav-section-label {
    font-family: var(--font-body);
    font-size: 9.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.3px;
    color: var(--text-3);
    padding: 14px 10px 5px;
    white-space: nowrap; transition: opacity .2s;
}
.sidebar.collapsed .nav-section-label { opacity: 0; height: 14px; padding: 3px 0; }

.nav-item {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-3);
    font-size: 12.5px; font-weight: 500;
    white-space: nowrap;
    transition: var(--transition);
}
.nav-item::after {
    content: '';
    position: absolute; left: -10px; top: 50%;
    width: 3px; height: 0;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
    transform: translateY(-50%);
    transition: height .22s var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-tint); color: var(--accent); font-weight: 600; }
.nav-item.active::after { height: 18px; }
.nav-icon { font-size: 12.5px; width: 17px; text-align: center; opacity: .65; flex-shrink: 0; }
.nav-item.active .nav-icon, .nav-item:hover .nav-icon { opacity: 1; }
.nav-label { overflow: hidden; text-overflow: ellipsis; }
.sidebar.collapsed .nav-label { display: none; }

.sidebar-footer { padding: 10px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); transition: var(--transition); }
.sidebar-user:hover { background: var(--surface-2); }
.sidebar-avatar { width: 30px; height: 30px; border-radius: 7px; background: var(--accent); display: flex; align-items: center; justify-content: center; color: var(--accent-fg); font-size: 11px; font-weight: 700; flex-shrink: 0; }
.sidebar-user-info { overflow: hidden; flex: 1; }
.sidebar-user-name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 10px; color: var(--text-3); }

/* ── Main wrapper + topbar ───────────────────────────────── */
.main-wrapper { margin-left: var(--sidebar-width); min-height: 100vh; display: flex; flex-direction: column; transition: margin-left .24s var(--ease); }
.main-wrapper.sidebar-collapsed { margin-left: var(--sidebar-collapsed-w); }

.topbar {
    position: sticky; top: 0; z-index: 100;
    height: var(--topbar-height);
    background: color-mix(in srgb, var(--surface) 84%, transparent);
    backdrop-filter: saturate(1.5) blur(14px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px; flex-shrink: 0;
    transition: background-color .3s var(--ease), border-color .3s var(--ease);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-menu-btn { display: none; background: none; border: none; cursor: pointer; font-size: 17px; color: var(--text-3); padding: 4px; }
.topbar-page-title {
    font-family: var(--font-heading);
    font-size: 21px; font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-fg);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 12.5px; font-weight: 600; color: var(--text); line-height: 1.2; }
.user-role { font-size: 10.5px; color: var(--text-3); }
.topbar-logout { color: var(--text-3); padding: 7px 8px; border-radius: var(--radius-sm); transition: var(--transition); font-size: 13px; }
.topbar-logout:hover { color: var(--danger); background: var(--danger-bg); }
.topbar-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 11px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface); color: var(--text-2); font-size: 12.5px;
    cursor: pointer; transition: var(--transition);
}
.topbar-btn:hover { border-color: var(--accent); color: var(--accent); }

.theme-toggle {
    position: relative; width: 36px; height: 36px;
    border-radius: var(--radius-sm); border: 1px solid var(--border);
    background: var(--surface); color: var(--text-3); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; transition: var(--transition);
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle .fa-sun { display: none; } .theme-toggle .fa-moon { display: inline-block; }
[data-theme="dark"] .theme-toggle .fa-sun { display: inline-block; }
[data-theme="dark"] .theme-toggle .fa-moon { display: none; }

.flash-container { display: flex; flex-direction: column; gap: 5px; }

/* ── Content / page headers ──────────────────────────────── */
.content { flex: 1; padding: 28px 32px; max-width: 1540px; width: 100%; }
.page-header { margin-bottom: 24px; }
.page-title {
    font-family: var(--font-heading);
    font-size: 34px; font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text); line-height: 1.08;
}
.page-subtitle { font-size: 13.5px; color: var(--text-3); margin-top: 5px; }

/* ── Panel / Card ────────────────────────────────────────── */
.panel, .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden; transition: var(--transition);
}
.card { margin-bottom: 18px; }
.card:hover { box-shadow: var(--shadow); }
.panel-head, .card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 20px;
    border-bottom: 1px solid var(--border);
}
.panel-title, .card-header {
    font-family: var(--font-body);
    font-size: 10.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .9px;
    color: var(--text-2);
}
.panel-title { display: flex; align-items: center; gap: 8px; }
.panel-title i { color: var(--accent); font-size: 11px; }
.panel-sub { font-size: 11.5px; color: var(--text-3); }
.panel-body { padding: 18px 20px; }
.panel-body-flush { padding: 0; }
.card-header-plain { padding: 16px 20px 0; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ── Stat cards ──────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px 22px;
    display: flex; align-items: flex-start; gap: 14px;
    transition: var(--transition); position: relative; overflow: hidden; box-shadow: var(--shadow-sm);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.stat-icon { width: 44px; height: 44px; flex-shrink: 0; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 17px; background: var(--accent-tint); color: var(--accent); }
.stat-info { flex: 1; }
.stat-info h3, .stat-info .value {
    font-family: var(--font-heading);
    font-size: 36px; font-weight: 600;
    line-height: 1; color: var(--text); letter-spacing: -0.02em;
}
.stat-info p, .stat-info .label { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.stat-trend { font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; margin-top: 6px; }
.stat-trend.up { color: var(--success); } .stat-trend.down { color: var(--danger); }
.dashboard-grid { display: grid; gap: 18px; }
.dashboard-section { margin-bottom: 22px; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px;
    border: 1px solid transparent; border-radius: var(--radius);
    font-family: var(--font-body); font-size: 13px; font-weight: 600;
    cursor: pointer; white-space: nowrap; line-height: 1.4;
    transition: var(--transition);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--accent); color: var(--accent-fg); border-color: var(--accent);
    box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 32%, transparent);
}
.btn-primary:hover {
    background: var(--accent-2); border-color: var(--accent-2);
    box-shadow: 0 4px 18px color-mix(in srgb, var(--accent) 42%, transparent);
}
.btn-secondary { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: var(--accent-fg); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(.93); }
.btn-block { width: 100%; }
.btn-large { padding: 12px 22px; font-size: 14px; }
.btn-small { padding: 5px 11px; font-size: 11.5px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block; font-size: 11px; font-weight: 700; color: var(--text-2);
    margin-bottom: 6px; letter-spacing: .06em; text-transform: uppercase;
}
.form-hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.required { color: var(--danger); }
input[type="text"],input[type="email"],input[type="password"],input[type="number"],input[type="date"],
input[type="datetime-local"],input[type="search"],input[type="tel"],input[type="url"],textarea,select,.form-control {
    width: 100%; padding: 9px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body); font-size: 13.5px; color: var(--text);
    transition: var(--transition); appearance: none;
}
input:focus,textarea:focus,select:focus,.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23888f9c' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }
textarea { min-height: 96px; resize: vertical; }
.input-group { position: relative; }
.input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 12px; pointer-events: none; }
.password-input-group { position: relative; }
.password-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-3); cursor: pointer; padding: 6px 8px; font-size: 13px; }
.password-toggle:hover { color: var(--accent); }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-lg); }
.table, .session-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .session-table th {
    background: var(--surface-2); text-align: left;
    padding: 10px 16px;
    font-size: 9.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .8px; color: var(--text-3);
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td, .session-table td { padding: 12px 16px; color: var(--text-2); border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.table tbody tr:last-child td, .session-table tbody tr:last-child td { border-bottom: none; }
.table tbody tr, .session-table tbody tr { transition: background .14s; }
.table tbody tr:hover, .session-table tbody tr:hover { background: var(--surface-2); }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 2px 8px; border-radius: var(--radius-pill);
    font-size: 10px; font-weight: 700; letter-spacing: .25px;
    font-family: var(--font-body);
}
.badge-primary { background: var(--accent-tint); color: var(--accent); }
.badge-secondary { background: var(--surface-3); color: var(--text-2); }
.badge-success { background: var(--success-bg); color: var(--success-fg); }
.badge-warning { background: var(--warning-bg); color: var(--warning-fg); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger-fg); }
.badge-info    { background: var(--info-bg);    color: var(--info-fg); }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius-sm); margin-bottom: 14px;
    font-size: 13px; border: 1px solid transparent;
}
.alert i { margin-top: 1px; }
.alert-success { background: var(--success-bg); color: var(--success-fg); border-color: color-mix(in srgb, var(--success) 30%, transparent); }
.alert-warning { background: var(--warning-bg); color: var(--warning-fg); border-color: color-mix(in srgb, var(--warning) 30%, transparent); }
.alert-danger, .alert-error { background: var(--danger-bg); color: var(--danger-fg); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-info { background: var(--info-bg); color: var(--info-fg); border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.alert-dismissible { align-items: center; }

/* ── Progress ────────────────────────────────────────────── */
.progress-container, .progress-bar { width: 100%; height: 7px; background: var(--surface-3); border-radius: var(--radius-pill); overflow: hidden; }
.progress-fill, .progress-bar-survey, .progress-fill-survey { height: 100%; background: var(--brand-gradient); border-radius: var(--radius-pill); transition: width .6s var(--ease); }

/* ── Modal ───────────────────────────────────────────────── */
.modal { display: none; position: fixed; z-index: 1000; inset: 0; background: rgba(4,5,9,.62); backdrop-filter: blur(6px); align-items: center; justify-content: center; padding: 24px; }
.modal.open, .modal.show { display: flex; }
.modal-content { background: var(--elevated); border: 1px solid var(--border); border-radius: var(--radius-xl); width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-xl); animation: modalIn .26s var(--ease); }
.modal-large { max-width: 760px; } .modal-xl { max-width: 1020px; }
.modal-header { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; font-family: var(--font-heading); font-weight: 600; font-size: 22px; letter-spacing: -0.01em; }
.modal-body { padding: 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.close { background: none; border: none; font-size: 20px; line-height: 1; color: var(--text-3); cursor: pointer; }
.close:hover { color: var(--text); }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

/* ── Misc components ─────────────────────────────────────── */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.action-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.action-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); font-size: 12.5px; cursor: pointer; transition: var(--transition); }
.action-btn:hover { border-color: var(--accent); color: var(--accent); }
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-3); }
.empty-state i { font-size: 2.4rem; opacity: .25; margin-bottom: 12px; display: block; color: var(--accent); }
.empty-state h3 { font-family: var(--font-heading); font-size: 24px; color: var(--text-2); margin-bottom: 6px; }
.loading { display: inline-flex; align-items: center; gap: 8px; color: var(--text-3); }
.fa-spin { animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
.error-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.error-content { text-align: center; max-width: 440px; }
.error-icon { font-size: 3.2rem; color: var(--danger); margin-bottom: 16px; }
.error-message { color: var(--text-2); margin-bottom: 22px; }
.error-actions { display: flex; gap: 12px; justify-content: center; }
.activity-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border-light); }
.activity-item:last-child { border-bottom: none; }
.activity-time { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ── Survey components ───────────────────────────────────── */
.survey-builder-container, .survey-container { max-width: 900px; margin: 0 auto; }
.survey-header { text-align: center; margin-bottom: 26px; }
.survey-header h1 { font-family: var(--font-heading); font-size: 38px; letter-spacing: -0.02em; }
.survey-info, .survey-instructions { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 17px 22px; margin-bottom: 18px; }
.survey-navigation { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; }
.category-builder, .category { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 16px; overflow: hidden; }
.category-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 18px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.category-name-input { font-family: var(--font-heading); font-weight: 600; font-size: 20px; border: none; background: transparent; padding: 4px 0; }
.category-name-input:focus { box-shadow: none; border-bottom: 2px solid var(--accent); }
.question-builder, .question { padding: 15px 18px; border-bottom: 1px solid var(--border-light); }
.question:last-child, .question-builder:last-child { border-bottom: none; }
.question-text { font-weight: 500; color: var(--text); margin-bottom: 10px; }
.question-preview { background: var(--surface-2); border-radius: var(--radius-sm); padding: 13px 15px; }
.rating-guide { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.rating-item { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); }
.star-rating { display: inline-flex; gap: 4px; font-size: 1.5rem; color: var(--warning); }
.emoji-rating { display: flex; gap: 8px; }
.emoji-rating input[type="radio"] { display: none; }
.emoji-rating label { font-size: 1.8rem; cursor: pointer; padding: 6px; border-radius: var(--radius-sm); transition: var(--transition); filter: grayscale(1) opacity(.5); }
.emoji-rating label:hover, .emoji-rating input:checked + label { filter: none; transform: scale(1.14); }
.na-option { font-size: 12px; color: var(--text-3); }
.upload-area { border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 36px 24px; text-align: center; color: var(--text-3); cursor: pointer; transition: var(--transition); background: var(--surface); }
.upload-area:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-tint); }
.lang-option:hover { background: var(--surface-2); }
.lang-option-active { color: var(--accent); font-weight: 600; }

/* ── Login page ──────────────────────────────────────────── */
.login-page { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }

.login-left {
    position: relative; padding: 56px 60px;
    display: flex; flex-direction: column; justify-content: space-between;
    color: #ede8df; overflow: hidden;
    background: #0c0e14;
}
/* Warm amber atmospheric glow */
.login-left::before {
    content: ''; position: absolute; inset: 0;
    background:
        radial-gradient(700px 500px at 95% 5%, rgba(196,135,31,.20), transparent 55%),
        radial-gradient(500px 600px at -5% 95%, rgba(160,108,16,.15), transparent 52%);
}
/* Fine dot matrix */
.login-left::after {
    content: ''; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,.055) 1px, transparent 1px);
    background-size: 26px 26px;
    -webkit-mask-image: radial-gradient(ellipse at 65% 18%, black, transparent 68%);
    mask-image: radial-gradient(ellipse at 65% 18%, black, transparent 68%);
}
.login-left > * { position: relative; z-index: 1; }

.login-brand { display: flex; flex-direction: column; gap: 8px; }
.login-brand-icon {
    width: 46px; height: 46px;
    border-radius: 11px;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: var(--accent-fg);
    box-shadow: 0 8px 28px rgba(196,135,31,.42);
}
.login-brand-logo { height: 46px; width: auto; max-width: 200px; object-fit: contain; }
.login-brand-name { font-family: var(--font-heading); font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: #ede8df; }
.login-brand-sub { font-size: 10.5px; color: rgba(237,232,223,.35); letter-spacing: .12em; text-transform: uppercase; }

.login-headline { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 40px 0; }
.login-headline h1 {
    font-family: var(--font-heading);
    font-size: 60px; line-height: 1.0; font-weight: 600;
    letter-spacing: -0.03em; color: #ede8df;
    margin-bottom: 20px;
}
.login-headline h1 em {
    font-style: italic;
    color: var(--accent);
}
.login-headline p { max-width: 375px; color: rgba(237,232,223,.5); font-size: 14.5px; line-height: 1.68; }

.login-features { display: flex; flex-direction: column; gap: 12px; }
.login-feature { display: flex; align-items: center; gap: 12px; }
.login-feature-icon {
    width: 33px; height: 33px; border-radius: 8px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
    display: flex; align-items: center; justify-content: center;
    color: var(--accent); font-size: 12px; flex-shrink: 0;
}
.login-feature-text { font-size: 13px; color: rgba(237,232,223,.45); }

.login-right { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg); }
.login-form-wrap, .login-container, .login-form { width: 100%; max-width: 380px; }
.login-form-title {
    font-family: var(--font-heading);
    font-size: 38px; font-weight: 600;
    letter-spacing: -0.02em; color: var(--text);
    margin-bottom: 4px;
}
.login-form-subtitle { font-size: 13.5px; color: var(--text-3); margin: 4px 0 26px; }

/* ── Utilities ───────────────────────────────────────────── */
.flex { display: flex; } .gap-2 { gap: 8px; } .justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
.text-center { text-align: center; } .text-right { text-align: right; }
.text-sm { font-size: 12px; } .text-muted { color: var(--text-3); }
.mb-1 { margin-bottom: 6px; } .mb-3 { margin-bottom: 18px; } .mt-1 { margin-top: 6px; } .mt-3 { margin-top: 18px; }

/* ── Motion ──────────────────────────────────────────────── */
@keyframes riseIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.reveal { opacity: 0; } .reveal.in { animation: riseIn .48s var(--ease) forwards; }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { animation: none !important; transition: none !important; } .reveal { opacity: 1 !important; } }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1024px) { .login-page { grid-template-columns: 1fr; } .login-left { display: none; } .grid-3 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .24s var(--ease); }
    .sidebar.mobile-open { transform: translateX(0); box-shadow: var(--shadow-xl); }
    .main-wrapper, .main-wrapper.sidebar-collapsed { margin-left: 0; }
    .topbar-menu-btn { display: block; }
    .content { padding: 18px 16px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .user-info { display: none; }
    .login-headline h1 { font-size: 42px; }
}

[x-cloak]{display:none!important;}
