/* iOS layer over style.css: system font, grouped grey background, soft borderless cards, tinted buttons,
   segmented tabs, frosted bars, 44px touch targets and a bottom tab bar on phones. Remove this file to go back. */
:root {
    --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', 'Segoe UI', Roboto, sans-serif;
    --ink: #1c1c1e;
    --ink-soft: #6e6e73;
    --ink-faint: #aeaeb2;
    --paper: #f2f2f7;
    --border: #e5e5ea;
    --border-strong: #d1d1d6;
    --hover: #f2f2f7;
    --fill: rgba(118,118,128,.12);
    --fill-strong: rgba(118,118,128,.2);
    --green: #248a3d;
    --green-soft: #e9f8ed;
    --blue: #007aff;
    --blue-soft: #e8f1ff;
    --amber: #b25000;
    --amber-soft: #fff4e5;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.04), 0 1px 6px rgba(0,0,0,.03);
    --shadow-md: 0 6px 24px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
    --shadow-lg: 0 24px 60px rgba(0,0,0,.18), 0 4px 14px rgba(0,0,0,.08);
    --glass: rgba(249,249,251,.82);
}
body { font-size: 14.5px; letter-spacing: -.006em; background: var(--paper); }
h1, h2, h3 { letter-spacing: -.022em; }
::selection { background: rgba(192,41,43,.18); }

/* Surfaces: white, no hard outline, gentle shadow */
.card, .stat-card, .table-wrap, .grid-wrap, .bp-list, .bp-card, .bp-kpis a, .login-card, .cv-stats > div, .pk, .cv-list, .cv-hero {
    border-color: rgba(0,0,0,.05);
    box-shadow: var(--shadow-sm);
}
.card, .table-wrap, .grid-wrap, .bp-list { border-radius: 18px; }
.stat-card, .bp-kpis a, .bp-card { border-radius: 16px; }
a.stat-card:hover, .bp-kpis a:hover { box-shadow: var(--shadow-md); border-color: rgba(0,0,0,.05); }
a.stat-card:active, .bp-kpis a:active { transform: scale(.98); }
.stat-card .num, .bp-kpis b { font-weight: 700; letter-spacing: -.03em; }

/* Large titles */
.page-header { margin-bottom: 20px; }
.page-header h1 { font-size: 1.85rem; font-weight: 700; letter-spacing: -.035em; line-height: 1.1; }
.page-header .sub { font-size: .9rem; margin-top: 4px; }
.section-title h2, .card h2 { letter-spacing: -.02em; }

/* Buttons: filled primary, tinted secondary, springy press */
.btn { border-radius: 11px; padding: 8px 16px; font-weight: 600; transition: background .15s, transform .08s, box-shadow .15s; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.97); }
.btn-sm { border-radius: 9px; padding: 5px 11px; }
.btn-secondary { background: var(--fill); border-color: transparent; box-shadow: none; color: var(--ink); }
.btn-secondary:hover { background: var(--fill-strong); border-color: transparent; }
.btn-gold { background: var(--green-soft); border-color: transparent; color: var(--green); }
.btn-gold:hover { background: #d6f2de; border-color: transparent; color: var(--green); }
.btn-danger { background: #fdecec; border-color: transparent; color: var(--brand-red); }
.btn-danger:hover { background: #fbdcdc; border-color: transparent; }
.btn-ghost:hover { background: var(--fill); }
.btn-wa { border-radius: 11px; }

/* Inputs */
input[type=text], input[type=password], input[type=date], input[type=number], input[type=email], input[type=tel], input[type=search], input[type=url], select, textarea {
    border-radius: 11px; padding: 9px 12px; border-color: var(--border-strong); background: #fff; font-size: .92rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0,122,255,.15); }
select { -webkit-appearance: none; appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
select[multiple] { background-image: none; padding-right: 12px; }
label { color: var(--ink-soft); font-weight: 600; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand-red); }
.inline-toggle-body { background: #fff; border: 0; border-radius: 14px; box-shadow: var(--shadow-sm); }

/* Segmented tabs */
.tabs { display: flex; width: fit-content; max-width: 100%; gap: 2px; padding: 3px; background: var(--fill); border: 0; border-radius: 12px; margin-bottom: 14px; }
.tabs a { border: 0; margin: 0; padding: 6px 14px; border-radius: 9px; color: var(--ink); font-weight: 500; font-size: .85rem; transition: background .15s, box-shadow .15s; }
.tabs a.on { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); font-weight: 600; }
.tabs a:hover:not(.on) { background: rgba(255,255,255,.5); }

/* Chips */
.chip { background: var(--fill); border-color: transparent; font-weight: 500; }
.chip:hover { background: var(--fill-strong); border-color: transparent; }
.chip.on { background: var(--ink); color: #fff; }

/* Tables */
th { background: #fff; color: var(--ink-faint); font-size: .7rem; border-bottom-color: var(--border); }
th, td { border-bottom-color: #ededf0; padding: 11px 14px; }
tbody tr:hover td { background: #f8f8fa; }
.sheet th { background: #fafafc; }
.sheet tr.sel td { background: #fff5f5; }

/* Badges */
.badge { font-weight: 600; padding: 2px 9px; }

/* Sidebar */
.sidebar { background: rgba(255,255,255,.9); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-right-color: rgba(0,0,0,.06); }
.sidebar-nav a { border-radius: 10px; padding: 8px 10px; font-size: .88rem; }
.sidebar-nav a.active { background: var(--brand-red); color: #fff; }
.sidebar-nav a.active .nav-icon { color: #fff; }
.sidebar-nav a.active .count { background: #fff; color: var(--brand-red); }
.sidebar-section-label { color: var(--ink-faint); letter-spacing: .06em; }

/* Frosted top bar + iOS search field */
.topbar-slim { background: rgba(242,242,247,.8); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: .5px solid rgba(0,0,0,.12); }
.search-trigger { background: var(--fill); border-color: transparent; border-radius: 11px; }
.search-trigger:hover { border-color: transparent; background: var(--fill-strong); }

/* Menus, sheets, toasts */
.menu-pop { border-radius: 14px; border-color: rgba(0,0,0,.06); background: rgba(255,255,255,.94); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); box-shadow: var(--shadow-lg); padding: 6px; }
.menu-pop a, .menu-pop button { border-radius: 9px; padding: 9px 11px; font-size: .88rem; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--fill); }
.cmdk { border-radius: 18px; }
.cmdk-backdrop { background: rgba(0,0,0,.25); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.toast, .snack { border-radius: 14px; background: rgba(28,28,30,.92); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.toast.err { background: rgba(192,41,43,.95); }
.flash { border-radius: 14px; border: 0; }
.bulk-bar { border-radius: 14px; background: rgba(28,28,30,.94); }
.empty-state { color: var(--ink-faint); }
.login-card { border-radius: 24px; padding: 34px 28px; }

/* Phone tab bar */
.tabbar { display: none; }
@media (max-width: 900px) {
    body { font-size: 15px; }
    .hamburger { display: none; }
    .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; background: var(--glass); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid rgba(0,0,0,.18); padding: 6px 2px calc(6px + env(safe-area-inset-bottom)); }
    .tabbar a, .tabbar label { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 0; font-size: 10.5px; font-weight: 600; letter-spacing: 0; color: #8e8e93; position: relative; cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; }
    .tabbar a:active, .tabbar label:active { opacity: .6; }
    .tabbar svg { width: 25px; height: 25px; }
    .tabbar .on { color: var(--brand-red); }
    .tabbar b { position: absolute; top: -3px; left: calc(50% + 5px); background: #ff3b30; color: #fff; font-size: 10px; font-weight: 700; border-radius: 99px; padding: 0 5px; min-width: 18px; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--glass); }
    .page-wrap { padding: 14px 14px calc(92px + env(safe-area-inset-bottom)); }
    .snack, .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
    .page-header h1 { font-size: 1.75rem; }
    .topbar-slim { padding: 0 14px; height: 52px; }
    /* 44px touch targets; 16px text stops iPhone zooming into fields */
    input[type=text], input[type=password], input[type=date], input[type=number], input[type=email], input[type=tel], input[type=search], input[type=url], select, textarea { font-size: 16px; min-height: 44px; }
    .sheet td input:not([type=checkbox]), .sheet td select { min-height: 0; }
    .btn { min-height: 40px; padding: 9px 16px; }
    .btn-sm { min-height: 34px; padding: 6px 12px; }
    .card { border-radius: 16px; }
    .tabs { width: 100%; overflow-x: auto; scrollbar-width: none; }
    .tabs a { flex: 1 0 auto; text-align: center; }
    .sidebar { border-radius: 0 20px 20px 0; }
}
@media (max-width: 700px) {
    table.cards-sm tr { border-radius: 16px; border-color: rgba(0,0,0,.05); padding: 8px 16px; }
    table.cards-sm td { border-bottom: .5px solid #ededf0; }
}

/* Phone list for Contacts / Clients (Sheet in list mode, see sheet.js SheetList) */
.grid-wrap.ml { background: none; border: 0; box-shadow: none; overflow: visible; max-height: none; min-height: 0; }
.ml-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 8px; font-size: .84rem; color: var(--ink-soft); }
.ml-total { flex: 1; font-weight: 600; }
.ml-head .ml-sort { width: auto; min-height: 34px; padding: 4px 28px 4px 10px; font-size: .84rem; border: 0; background-color: var(--fill); border-radius: 9px; }
.ml-sel { border: 0; background: none; color: var(--brand-red); font: 600 .95rem var(--font); padding: 6px 4px; cursor: pointer; }
.ml-list { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-sm); }
.ml-list .empty-state { padding: 34px 16px; }
.ml-row { display: flex; align-items: center; gap: 4px; padding-right: 8px; position: relative; }
.ml-row + .ml-row::before { content: ''; position: absolute; top: 0; left: 66px; right: 0; border-top: .5px solid #e2e2e7; }
.ml-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 6px 10px 14px; color: var(--ink); text-decoration: none !important; -webkit-tap-highlight-color: transparent; }
.ml-row:active { background: #f2f2f7; }
.ml-av { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .9rem; letter-spacing: .02em; }
.ml-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ml-txt b { font-weight: 600; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-txt small { font-size: .8rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.ml-txt .stage-dot { width: 7px; height: 7px; margin-right: 4px; }
.ml-meta { flex-shrink: 0; font-size: .74rem; color: var(--ink-faint); text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.ml-meta small { font-size: .7rem; }
.ml-tag { display: inline-block; font-size: .66rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--fill); color: var(--ink-soft); vertical-align: 2px; margin-left: 4px; }
.ml-meta .ml-tag { margin: 0; }
.ml-tag.ok { background: var(--green-soft); color: var(--green); }
.ml-due { color: var(--brand-red); font-weight: 700; }
.ml-act { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; -webkit-tap-highlight-color: transparent; }
.ml-act svg { width: 18px; height: 18px; }
.ml-act.wa { background: #e7f9ee; color: #1fa855; }
.ml-act.call { background: var(--blue-soft); color: var(--blue); }
.ml-act:active { transform: scale(.9); }
.ml-check { display: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); margin-left: 14px; flex-shrink: 0; }
.ml.selecting .ml-check { display: block; }
.ml.selecting .ml-main { padding-left: 4px; pointer-events: none; }
.ml.selecting .ml-act { display: none; }
.ml.selecting .ml-row + .ml-row::before { left: 92px; }
.ml-row.sel .ml-check { background: var(--brand-red); border-color: var(--brand-red); box-shadow: inset 0 0 0 3px #fff; }
.ml-row.sel { background: #fff7f7; }
.ml-more { text-align: center; padding: 14px 0 4px; font-size: .8rem; color: var(--ink-faint); }
.grid-wrap.ml.loading .ml-list { opacity: .5; }
.grid-wrap.ml .grid-loading { display: none; }
@media (max-width: 700px) {
    body:has(.grid-wrap.ml) #filters { position: sticky; top: 52px; z-index: 20; background: var(--paper); margin: 0 -14px; padding: 8px 14px 4px; }
    body:has(.grid-wrap.ml) .page-header { margin-bottom: 6px; }
    body:has(.grid-wrap.ml) .toolbar .search { flex: 1 1 0; max-width: none; }
    body:has(.grid-wrap.ml) .toolbar > select:not(.opt) { order: 5; flex: 1 1 100%; max-width: none; }
    body:has(.grid-wrap.ml) .toolbar > .btn-ghost { display: none; }
    body:has(.grid-wrap.ml) .toolbar.show > .btn-ghost { display: inline-flex; }
    body:has(.grid-wrap.ml) .tabs, body:has(.grid-wrap.ml) .chips { margin-bottom: 8px; }
    .bulk-bar.visible { position: fixed; left: 8px; right: 8px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 46; margin: 0; flex-wrap: wrap; gap: 8px; box-shadow: var(--shadow-lg); }
    .bulk-bar .bulk-group { border-left: 0; padding-left: 0; flex-wrap: wrap; }
    .bulk-bar select, .bulk-bar input { min-height: 36px; font-size: 15px; }
}
