/* =========================================================
   קל-תיק — Native depth layer
   Loaded AFTER modern-redesign.css. Purely additive/cosmetic:
   no layout changes, no risk to functionality.

   What "makes web apps look web" (and what this file fixes):
   - Flat single-blur box-shadows      -> layered "key + ambient" shadows
     (how Fluent/macOS elevation tokens actually work — light falls off
     in stages, not as one soft blob).
   - Perfectly flat, noise-free fills  -> a hair of grain on big surfaces
     (native materials like Acrylic/Mica always carry subtle noise;
     pure CSS gradients don't, which reads as "plasticky").
   - Abrupt color-only hover/press     -> gloss highlight + a tiny scale
     dip on press, eased with a native-feeling curve.
   - Browser default scrollbars/focus  -> thin overlay scrollbar + a
     consistent rounded focus ring instead of the default blue outline.
   ========================================================= */

:root {
  /* Layered "elevation" shadows — tight dark key shadow + soft ambient
     falloff, roughly matching Fluent's shadow2/shadow8/shadow16 tokens.
     Replaces the single flat blurs modern-redesign.css defines. */
  --shadow-flat:
    0 0.5px 1px rgba(20, 40, 55, 0.10),
    0 1px 2px rgba(20, 40, 55, 0.06);
  --shadow-card:
    0 0.3px 0.9px rgba(20, 40, 55, 0.09),
    0 2px 6px rgba(20, 40, 55, 0.08),
    0 6px 16px rgba(20, 40, 55, 0.05);
  --shadow-float:
    0 0.5px 1.5px rgba(15, 35, 50, 0.14),
    0 4px 12px rgba(15, 35, 50, 0.10),
    0 16px 36px rgba(15, 35, 50, 0.12);

  --grain-svg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ---------- Subtle grain on large surfaces ----------
   Applied via ::after so it never interferes with content/click targets. */
.card, .panel, .panel-card, .data-card, .client-card, .sync-panel-card,
.net-hero-card, .ai-workspace, .top-header, .workbar,
body.net-shell .panel, body.net-shell .panel-card {
  position: relative;
  isolation: isolate;
}

.card::after, .panel::after, .panel-card::after, .data-card::after,
.client-card::after, .sync-panel-card::after, .net-hero-card::after,
.ai-workspace::after, .top-header::after, .workbar::after,
body.net-shell .panel::after, body.net-shell .panel-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--grain-svg);
  opacity: 0.025;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
}

.primary-tabs::after,
body.btl-shell .primary-tabs::after,
body.net-shell .primary-tabs::after,
.app-footer::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--grain-svg);
  opacity: 0.035;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 0;
}
.primary-tabs, .app-footer { position: relative; }
.app-footer { flex: 0 0 auto; width: 100%; }
.primary-tabs > * , .app-footer > * { position: relative; z-index: 1; }

/* ---------- Glossy top-bar (subtle inner highlight = real depth) ---------- */
.primary-tabs,
body.btl-shell .primary-tabs,
body.net-shell .primary-tabs {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 1px 0 rgba(8, 74, 109, 0.4),
    0 4px 14px rgba(13, 92, 130, 0.22) !important;
}

.top-header,
.workbar,
body.btl-shell .top-header.btl-workbar,
body.net-shell .top-header {
  box-shadow: var(--shadow-flat) !important;
}

/* ---------- Native-feeling interactive elements ---------- */
button, .primary-tab, .action-button, .sync-button, .ai-send-button,
.ai-suggest-chip, .ai-quick-card, .tasks-check-box, .tasks-category-header,
#excel-import-btn, #favorite-sync, #global-sync-btn {
  transition:
    transform 120ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease !important;
}

button:active, .primary-tab:active, .action-button:active,
.sync-button:active, .ai-send-button:active, .ai-suggest-chip:active,
.ai-quick-card:active, #excel-import-btn:active, #favorite-sync:active,
#global-sync-btn:active {
  transform: scale(0.97);
}

/* Glossy top highlight for solid brand buttons — a hairline of "light"
   catching the top edge, the way real OS buttons render. */
.sync-button, .ai-send-button, #excel-import-btn, #favorite-sync,
#global-sync-btn, .action-button {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    var(--shadow-flat) !important;
}

.primary-tab.active {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 1px 3px rgba(0, 0, 0, 0.18) !important;
}

/* Cards get real elevation instead of a flat blur */
.card, .panel, .panel-card, .data-card, .client-card, .sync-panel-card,
.net-hero-card, .ai-workspace, .field-pin-board, .pin-inbox,
body.net-shell .panel, body.net-shell .panel-card {
  box-shadow: var(--shadow-card) !important;
}

.ai-composer, .ai-jump-latest {
  box-shadow: var(--shadow-float) !important;
}

/* Floating overlays (drawers, popovers) get a real frosted-glass blur —
   this genuinely blurs whatever's rendered behind it on the page, unlike
   a flat semi-transparent fill. Targets ::part(dialog): the actual visible
   panel is fluent-drawer's shadow-DOM <dialog>, which paints opaque over
   anything set directly on the host. */
.ai-side-drawer::part(dialog) {
  box-shadow: var(--shadow-float) !important;
  background: rgba(255, 255, 255, 0.86) !important;
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
}

.ai-drawer-backdrop {
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* ---------- Focus ring: consistent, rounded, native-style ----------
   Replaces the browser's default rectangular blue outline with a
   rounded accent ring that respects each element's own radius. */
a:focus-visible, button:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--border-focus, #1a739c) !important;
  outline-offset: 2px;
  border-radius: inherit;
}

/* ---------- Thin, overlay-style scrollbars (native Win11 feel) ---------- */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(30, 60, 80, 0.28) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background-color: rgba(30, 60, 80, 0.28);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background-color: rgba(30, 60, 80, 0.45);
}

/* ---------- Checkbox depth ---------- */
.tasks-check-box {
  box-shadow: inset 0 1px 2px rgba(20, 40, 55, 0.08) !important;
}
.tasks-check-box.is-done {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    0 1px 3px rgba(30, 148, 112, 0.35) !important;
}

/* ---------- Squircle corners ----------
   This is an Electron app, not a public website: every user runs the exact
   same bundled Chromium (Electron 38 ships Chromium 139+), so there is no
   cross-browser fallback to worry about — if it renders here, it renders
   for 100% of users. corner-shape only has any visible effect where a
   border-radius already exists, so this is safe to apply broadly; flush/
   segmented controls that intentionally use border-radius: 0 (e.g.
   .client-subnav button) are untouched. */
button, input, textarea, select,
.card, .panel, .panel-card, .data-card, .client-card, .sync-panel-card,
.net-hero-card, .ai-workspace, .ai-composer, .ai-send-button,
.ai-suggest-chip, .ai-quick-card, .ai-pill, .ai-side-drawer, .kpi,
.primary-tab, .tasks-check-box, .tasks-desk, .field-pin-board, .pin-inbox,
[class*="btn"], [class*="button"], [class*="card"], [class*="panel"],
[class*="pill"], [class*="chip"] {
  corner-shape: squircle;
}

/* ---------- Fix the classic "colored corner bleed" bug ----------
   When a rounded element's background doesn't clip exactly to the same
   curve as its border, a thin sliver of mismatched color can peek out
   right at the corner arc (often looks yellow/off-color depending on
   what's layered underneath). background-clip only changes where the
   fill paints relative to the border — unlike overflow:hidden, it can't
   clip dropdowns/tooltips/badges, so it's safe to apply broadly. */
.card, .panel, .panel-card, .data-card, .client-card, .sync-panel-card,
.net-hero-card, .ai-workspace, .ai-composer, button, .primary-tab,
.tasks-check-box, [class*="btn"], [class*="button"] {
  background-clip: padding-box;
}
