/* =====================================================================
   Page Design System — main.css
   Token layer + shared components.
   Brands:  Premium = default (PRM / investment side)
            Evolved = [data-brand="evolved"] (CRM side)
   Theme:   light by default; dark is opt-in via [data-theme="dark"]
            (toggled from the sidebar). No auto OS-dark, so the app is
            predictable for demos.
   ===================================================================== */

:root{
    color-scheme: light;
    --bg:#E9ECEA; --surface:#FBFCFB; --surface-2:#F2F5F2; --surface-3:#E9EEEA;
    --ink:#16211E; --ink-2:#33413B; --muted:#5F6E68; --faint:#8A968F;
    --border:#DBE1DD; --border-2:#C9D2CC; --field:#FFFFFF;
    --shadow:0 1px 2px rgba(20,30,26,.05),0 10px 26px rgba(20,30,26,.06);
    --shadow-lg:0 20px 50px rgba(20,30,26,.16);
    --good:#3B8A5B; --good-soft:rgba(59,138,91,.13);
    --warn:#A9791F; --warn-soft:rgba(169,121,31,.15);
    --crit:#B84A38; --crit-soft:rgba(184,74,56,.12);
    --r-sm:8px; --r:12px; --r-lg:16px; --r-xl:20px;
    --serif:'Iowan Old Style','Palatino Linotype',Palatino,'Book Antiqua',Georgia,serif;
    --sans:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',system-ui,Roboto,sans-serif;
    --accent:#A97C4F; --accent-strong:#8A6238; --accent-soft:rgba(169,124,79,.15);
    --brand:#1C3B34; --brand-2:#274A41; --brand-ink:#F2EEE4;
    --brand-grad:linear-gradient(135deg,#274A41 0%,#1C3B34 100%);
}
:root[data-brand="evolved"]{
    --accent:#5B63D3; --accent-strong:#464CB0; --accent-soft:rgba(91,99,211,.14);
    --brand:#363B85; --brand-2:#474DA6; --brand-ink:#FFFFFF;
    --brand-grad:linear-gradient(135deg,#474DA6 0%,#363B85 100%);
}
/* dark — opt-in via the sidebar toggle */
:root[data-theme="dark"]{
    color-scheme: dark;
    --bg:#0E1513; --surface:#141D19; --surface-2:#1A241F; --surface-3:#212D27;
    --ink:#EAF0EC; --ink-2:#C4CFC9; --muted:#93A29B; --faint:#6E7D77;
    --border:#25322C; --border-2:#30403A; --field:#1A241F;
    --shadow:0 1px 2px rgba(0,0,0,.3),0 12px 30px rgba(0,0,0,.38);
    --shadow-lg:0 22px 56px rgba(0,0,0,.55);
    --good:#5DB081; --good-soft:rgba(93,176,129,.16);
    --warn:#D6A24A; --warn-soft:rgba(214,162,74,.16);
    --crit:#E06B57; --crit-soft:rgba(224,107,87,.15);
    --brand:#26493F; --brand-2:#2F574B; --brand-ink:#EFEADD;
    --brand-grad:linear-gradient(135deg,#2F574B 0%,#1F3E36 100%);
}
:root[data-theme="dark"][data-brand="evolved"]{
    --brand:#474DA6; --brand-2:#565CBB; --brand-ink:#FFFFFF;
    --brand-grad:linear-gradient(135deg,#565CBB 0%,#3D4293 100%);
    --accent-soft:rgba(124,131,229,.2);
}

*{ box-sizing:border-box; }
body{ font-family:var(--sans); background:var(--bg); margin:0; padding:0; min-height:100vh; color:var(--ink); -webkit-font-smoothing:antialiased; }
#kyte-page-container{ padding:0 24px; max-width:1400px; margin:0 auto; }

/* Header */
.page-header{ background:var(--surface); border-radius:var(--r-lg); padding:32px; margin:24px 0; box-shadow:var(--shadow); border:1px solid var(--border); }
.header-content{ display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:16px; }
.page-title{ display:flex; align-items:center; gap:16px; margin:0; }
.page-icon{ width:48px; height:48px; background:var(--brand-grad); border-radius:var(--r); display:flex; align-items:center; justify-content:center; color:var(--brand-ink); font-size:20px; }
.page-title h1{ font-family:var(--serif); font-size:30px; font-weight:700; color:var(--ink); margin:0; letter-spacing:-.01em; }
.page-subtitle{ font-size:15px; color:var(--muted); margin:8px 0 0 0; font-weight:400; }
.header-actions{flex-wrap:wrap; display:flex; gap:12px; align-items:center; }

/* Buttons */
.btn-primary{ background:var(--brand); border:none; color:var(--brand-ink); padding:12px 22px; border-radius:var(--r); font-weight:600; font-size:14px; cursor:pointer; transition:transform .2s ease, box-shadow .2s ease, background .2s ease; text-decoration:none; display:inline-flex; align-items:center; gap:8px; box-shadow:var(--shadow); }
.btn-primary:hover{ background:var(--brand-2); transform:translateY(-1px); box-shadow:var(--shadow-lg); text-decoration:none; color:var(--brand-ink); }
.btn-primary:active{ transform:translateY(0); }
.btn-secondary{ background:var(--surface); border:1px solid var(--border); color:var(--ink-2); padding:11px 20px; border-radius:var(--r); font-weight:600; font-size:14px; cursor:pointer; transition:all .2s ease; text-decoration:none; display:inline-flex; align-items:center; gap:8px; }
.btn-secondary:hover{ border-color:var(--border-2); background:var(--surface-2); text-decoration:none; color:var(--ink); }
.btn-success{ background:var(--good); color:#fff; border:none; box-shadow:var(--shadow); }
.btn-success:hover{ transform:translateY(-1px); box-shadow:var(--shadow-lg); text-decoration:none; color:#fff; }
.btn-sm{ padding:8px 16px; font-size:13px; }

/* Return link */
.return-link-wrapper{ margin:24px 0 16px 0; }
.return-link-wrapper a{ display:inline-flex; align-items:center; gap:8px; color:var(--accent-strong); text-decoration:none; font-weight:500; font-size:14px; padding:8px 16px; border-radius:var(--r-sm); transition:all .2s ease; background:var(--accent-soft); border:1px solid var(--border); }
.return-link-wrapper a:hover{ transform:translateX(-4px); text-decoration:none; color:var(--accent-strong); border-color:var(--accent); }
.return-link-wrapper a::before{ content:"\2039"; font-weight:700; font-size:18px; line-height:1; }

/* Modal (KyteForm) */
.modal-content{ background:var(--surface); margin:5% auto; padding:0; border-radius:var(--r-xl); width:90%; max-width:600px; position:relative; box-shadow:var(--shadow-lg); border:1px solid var(--border); overflow:hidden; animation:modalSlideIn .3s ease; }
@keyframes modalSlideIn{ from{ transform:translateY(-30px) scale(.95); opacity:0; } to{ transform:translateY(0) scale(1); opacity:1; } }
.modal-content h2{ background:var(--surface-2); padding:28px 32px; margin:0; font-family:var(--serif); font-size:22px; font-weight:700; color:var(--ink); border-bottom:1px solid var(--border); position:relative; }
.modal-body{ padding:32px; background:var(--surface); }
.modal-section{ margin:20px 0; text-align:left; }
.modal-section label{ font-weight:600; color:var(--ink-2); margin-bottom:8px; display:block; }
.modal-section p{ margin:12px 0; font-size:14px; line-height:1.6; color:var(--ink-2); }
.modal-section strong{ color:var(--ink); font-weight:600; }
.modal-footer{ background:var(--surface-2); border-top:1px solid var(--border); padding:20px 32px; display:flex; gap:12px; justify-content:flex-end; flex-wrap:wrap; }

/* Form fields */
.modal-dropdown, input[type="text"], input[type="date"], input[type="time"], input[type="email"], input[type="password"], input[type="number"], select, textarea{ width:100%; padding:12px 16px; border:1px solid var(--border); border-radius:var(--r-sm); font-size:14px; background:var(--field); color:var(--ink); transition:all .2s ease; font-family:inherit; margin-top:8px; }
.modal-dropdown:focus, input:focus, select:focus, textarea:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder{ color:var(--faint); }
.modal-content .close{ position:absolute; right:20px; top:20px; font-size:26px; font-weight:bold; cursor:pointer; color:var(--muted); transition:all .2s ease; z-index:10; width:32px; height:32px; display:flex; align-items:center; justify-content:center; border-radius:50%; background:var(--surface-2); }
.modal-content .close:hover{ color:var(--crit); background:var(--crit-soft); }
.form-control{ border:1px solid var(--border); border-radius:var(--r-sm); padding:12px 16px; font-size:14px; background:var(--field); color:var(--ink); transition:all .2s ease; }
.form-control:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }

/* Select2 */
.select2-container--default .select2-selection--single{ height:44px; border:1px solid var(--border); border-radius:var(--r-sm); background:var(--field); }
.select2-container--default .select2-selection--single .select2-selection__rendered{ line-height:42px; padding-left:16px; color:var(--ink); }
.select2-container--default .select2-selection--single .select2-selection__arrow{ height:42px; right:16px; }
.select2-dropdown{ border:1px solid var(--border); border-radius:var(--r-sm); box-shadow:var(--shadow); background:var(--surface); }