/* ============================================================
   SYNVORA — Apple-inspired design system overrides
   Palette: maximum white, very light grey, grey, black.
   Primary colors reserved for accents (sidebar, actions, status).
   ============================================================ */

:root {
    --sv-white: #FFFFFF;
    --sv-bg: #FFFFFF;
    --sv-bg-2: #F5F5F7;      /* very light grey surface */
    --sv-bg-3: #F2F2F7;      /* grouped table background */
    --sv-fill: #E9E9EB;      /* grey fill (chips, toggles) */
    --sv-separator: #E5E5EA; /* hairline */
    --sv-text: #1D1D1F;      /* near-black */
    --sv-text-2: #6E6E73;    /* grey */
    --sv-text-3: #86868B;    /* secondary */
    --sv-blue: #0071E3;      /* Apple blue */
    --sv-green: #34C759;
    --sv-red: #FF3B30;
    --sv-orange: #FF9500;
    --sv-purple: #AF52DE;
    --sv-indigo: #5856D6;
    --sv-teal: #5AC8FA;
    --sv-pink: #FF2D55;
    --sv-yellow: #FFCC00;
    --sv-radius: 18px;
    --sv-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.05);
    --sv-shadow-lg: 0 2px 6px rgba(0,0,0,0.04), 0 24px 48px rgba(0,0,0,0.10);
}

/* ---------- Base ---------- */
html { background: var(--sv-white); }
body,
.bg-ios-bg,
main.app-content,
#mainScroll {
    background-color: var(--sv-bg) !important;
}

body {
    color: var(--sv-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

h1, h2, h3 { letter-spacing: -0.022em; }

/* Hairline separators instead of hard borders */
.border-gray-100, .border-gray-200, .border-gray-200\/80, .border-gray-200\/60 {
    border-color: var(--sv-separator) !important;
}
.border-t, .border-b { border-color: var(--sv-separator) !important; }

/* ---------- Cards ---------- */
.bg-white {
    background-color: var(--sv-white) !important;
    border: 1px solid var(--sv-separator);
    box-shadow: var(--sv-shadow);
}
/* keep plain white elements that shouldn't look like cards */
.bg-white.border-transparent,
input.bg-white, select.bg-white, textarea.bg-white,
.bg-white.shadow-none {
    border-color: transparent;
}
.shadow-sm { box-shadow: 0 1px 2px rgba(0,0,0,0.03) !important; }
.shadow-md { box-shadow: var(--sv-shadow) !important; }
.shadow-lg, .shadow-xl, .shadow-2xl { box-shadow: var(--sv-shadow-lg) !important; }
.shadow-float { box-shadow: var(--sv-shadow-lg) !important; }

/* Neutralize dark gradient hero cards → white cards */
[class*="from-[#1"], [class*="to-[#1"], [class*="from-[#0"], [class*="from-gray-900"], [class*="from-slate-9"],
.bg-gradient-to-br[class*="from-"] {
    background-image: none !important;
    background-color: var(--sv-white) !important;
    color: var(--sv-text) !important;
    border: 1px solid var(--sv-separator);
    box-shadow: var(--sv-shadow);
}
[class*="from-[#1"] .text-white, [class*="from-[#0"] .text-white { color: var(--sv-text) !important; }
[class*="from-[#1"] .text-indigo-200, [class*="from-[#1"] .text-indigo-300,
[class*="from-[#0"] .text-indigo-200, [class*="from-[#0"] .text-indigo-300 { color: var(--sv-text-3) !important; }
[class*="from-[#1"] .bg-white\/10, [class*="from-[#0"] .bg-white\/10 { background: var(--sv-bg-2) !important; }
[class*="from-[#1"] .border-white\/10, [class*="from-[#0"] .border-white\/10 { border-color: var(--sv-separator) !important; }

/* Light grey secondary surfaces */
.bg-gray-50, .bg-gray-50\/50, .bg-\[\#F5F5F7\], .bg-\[\#f5f5f7\] { background-color: var(--sv-bg-2) !important; }
.bg-gray-100 { background-color: var(--sv-fill) !important; }
.bg-gray-200 { background-color: var(--sv-separator) !important; }

/* ---------- Header: frosted glass ---------- */
.app-header, #mainHeader {
    background-color: rgba(255,255,255,0.78) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--sv-separator);
}

/* ---------- Sidebar: white rail + accent icons ---------- */
#sidebar, .sidebar {
    background-color: var(--sv-white) !important;
    border-right: 1px solid var(--sv-separator) !important;
    box-shadow: none !important;
}

#sidebar nav > a,
#sidebar nav > button {
    border: 1px solid transparent;
    transition: background-color .2s ease, color .2s ease, transform .12s ease;
}
#sidebar nav > a:active,
#sidebar nav > button:active { transform: scale(0.97); }

#sidebar nav > a:hover,
#sidebar nav > button:hover {
    background-color: var(--sv-bg-2) !important;
}

/* Active item (rendered as bg-white + shadow-sm) → black pill */
#sidebar nav > a.bg-white,
#sidebar nav > button.bg-white {
    background-color: var(--sv-text) !important;
    color: var(--sv-white) !important;
    border-color: var(--sv-text);
    box-shadow: 0 4px 12px rgba(0,0,0,0.18) !important;
}
#sidebar nav > a.bg-white i,
#sidebar nav > button.bg-white i { color: var(--sv-white) !important; }

/* Accent-colored icons per destination (Apple system palette) */
#sidebar nav > *:nth-child(1) i { color: var(--sv-blue); }
#sidebar nav > *:nth-child(2) i { color: var(--sv-green); }
#sidebar nav > *:nth-child(3) i { color: var(--sv-teal); }
#sidebar nav > *:nth-child(4) i { color: var(--sv-indigo); }
#sidebar nav > *:nth-child(5) i { color: var(--sv-orange); }
#sidebar nav > *:nth-child(6) i { color: var(--sv-purple); }
#sidebar nav > *:nth-child(7) i { color: var(--sv-yellow); }
#sidebar nav > *:nth-child(8) i { color: var(--sv-pink); }
#sidebar nav > *:nth-child(9) i { color: var(--sv-blue); }
#sidebar nav > *:nth-child(10) i { color: var(--sv-indigo); }
#sidebar nav > *:nth-child(11) i { color: var(--sv-text-3); }
#sidebar nav > a.bg-white i, #sidebar nav > button.bg-white i { color: var(--sv-white) !important; }

/* Sign out */
#sidebar .mt-auto button:hover { background-color: #FFF1F0 !important; color: var(--sv-red) !important; }

/* ---------- Buttons ---------- */
button, .btn-black, a[class*="rounded-2xl"]:active { -webkit-tap-highlight-color: transparent; }

.btn-black,
button.bg-black, a.bg-black {
    background-color: var(--sv-text) !important;
    color: var(--sv-white) !important;
    border-radius: 980px !important;
    transition: transform .12s ease, opacity .2s ease, background-color .2s ease;
}
.btn-black:hover, button.bg-black:hover { background-color: #000 !important; }
.btn-black:active, button.bg-black:active { transform: scale(0.97); }

/* Small utility buttons → grey fill, black text */
button.bg-gray-100, button.bg-gray-200,
a.bg-gray-100, a.bg-gray-200 {
    background-color: var(--sv-fill) !important;
    color: var(--sv-text) !important;
    border-radius: 980px;
}
button.bg-gray-100:hover, button.bg-gray-200:hover,
a.bg-gray-100:hover, a.bg-gray-200:hover { background-color: var(--sv-separator) !important; }

/* Accent action buttons keep system colors, pill shape */
button.bg-blue-600, a.bg-blue-600, .btn-blue { border-radius: 980px !important; }
button.bg-green-600, a.bg-green-600, .btn-green { border-radius: 980px !important; }
button.bg-red-600, a.bg-red-600, .btn-red { border-radius: 980px !important; }

/* ---------- Inputs ---------- */
input, select, textarea {
    border-radius: 12px !important;
    border: 1px solid #D2D2D7 !important;
    transition: border-color .2s ease, box-shadow .2s ease;
}
input.bg-gray-50, select.bg-gray-50, textarea.bg-gray-50,
input.bg-gray-100, select.bg-gray-100, textarea.bg-gray-100 {
    border-color: transparent !important;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
select:focus, textarea:focus {
    outline: none !important;
    border-color: var(--sv-blue) !important;
    box-shadow: 0 0 0 3.5px rgba(0,113,227,0.18) !important;
}
input::placeholder, textarea::placeholder { color: #C7C7CC !important; }
input[type="checkbox"] { accent-color: var(--sv-green); }
input[type="radio"] { accent-color: var(--sv-blue); }

/* ---------- Tables / lists ---------- */
table { border-collapse: separate; border-spacing: 0; }
tbody tr:not(:last-child) td, tbody tr:not(:last-child) th { border-bottom: 1px solid var(--sv-separator); }
tbody tr:hover td { background-color: var(--sv-bg-2); }

/* ---------- Modals & sheets ---------- */
.bg-black\/40, .bg-black\/50, .bg-black\/60 {
    background-color: rgba(0,0,0,0.42) !important;
    -webkit-backdrop-filter: saturate(180%) blur(8px);
    backdrop-filter: saturate(180%) blur(8px);
}
[class*="rounded-3xl"], [class*="rounded-[28px]"], [class*="rounded-[32px]"] {
    border-radius: var(--sv-radius) !important;
}

/* ---------- Badges / pills ---------- */
.rounded-full.bg-blue-50  { background-color: rgba(0,113,227,0.10) !important; color: var(--sv-blue) !important; }
.rounded-full.bg-green-50 { background-color: rgba(52,199,89,0.12) !important; color: #248A3D !important; }
.rounded-full.bg-red-50   { background-color: rgba(255,59,48,0.10) !important; color: #D70015 !important; }
.rounded-full.bg-orange-50{ background-color: rgba(255,149,0,0.12) !important; color: #C93400 !important; }

/* ---------- Misc ---------- */
.no-scrollbar::-webkit-scrollbar { display: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--sv-fill); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #D1D1D6; }
::-webkit-scrollbar-track { background: transparent; }

.text-gray-400 { color: var(--sv-text-3) !important; }
.text-gray-500 { color: var(--sv-text-2) !important; }
.text-ios-subtext { color: var(--sv-text-3) !important; }

/* Apple-style spinner keeps black */
.apple-spinner { border-top-color: var(--sv-text) !important; }

/* Avatar rings */
.border-2.border-white { border-color: var(--sv-white) !important; }
