/* ==========================================================================
   Design tokens — the single source of truth for colour, type, space and
   motion. Every other stylesheet reads these; none of them hard-codes a
   colour or a size.

   Stylesheet order (see templates/layouts/base.html):
     tokens.css      this file
     base.css        reset, typography, utilities
     layout.css      app shell: sidebar, top bar, page area
     components.css  buttons, forms, cards, menus, dialogs, …
     pages.css       styles that belong to one page
     print.css       paper

   Sizes are in rem so the whole interface can step up on very large
   displays (see "Large displays" at the bottom).
   ========================================================================== */

/* ---- Fonts --------------------------------------------------------------
   Inter, self-hosted as one variable file per style (weights 100–900).
   `swap` shows the system font immediately and upgrades when Inter loads.

   The `?v=1` is a hand-kept version: URLs written inside CSS don't get the
   automatic fingerprint that templates add, and a versioned URL is what
   lets the browser cache the file for a year. If you ever replace the font
   files, bump the number here AND in the preload link in
   templates/layouts/base.html (the two URLs must match exactly, or the
   font downloads twice). */
@font-face {
  font-family: "Inter";
  src: url("../fonts/InterVariable.woff2?v=1") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/InterVariable-Italic.woff2?v=1") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  /* ---- Typography ---- */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --text-xs: 0.75rem;     /* 12px — badges, meta */
  --text-sm: 0.8125rem;   /* 13px — secondary text, labels */
  --text-base: 0.875rem;  /* 14px — body */
  --text-md: 0.9375rem;   /* 15px — card titles */
  --text-lg: 1.0625rem;   /* 17px — section titles */
  --text-xl: 1.25rem;     /* 20px */
  --text-2xl: 1.5rem;     /* 24px — page titles */
  --text-3xl: 1.875rem;   /* 30px — headline numbers */

  --leading-tight: 1.25;
  --leading-snug: 1.4;
  --leading-normal: 1.55;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* ---- Space (4px grid) ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* ---- Shape ---- */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  /* ---- Control sizes ---- */
  --control-sm: 1.875rem;   /* 30px */
  --control-md: 2.25rem;    /* 36px */
  --control-lg: 2.75rem;    /* 44px */

  /* ---- Layout ---- */
  --sidebar-width: 15.5rem;
  --sidebar-rail: 4rem;
  --topbar-height: 3.5rem;
  --content-max: 80rem;                       /* default page width */
  --content-narrow: 52rem;                    /* forms and reading pages */
  --content-wide: 100rem;                     /* grids and boards */
  --page-gutter: clamp(1rem, 3.2vw, 2rem);    /* side padding, fluid */

  /* ---- Motion ---- */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --duration-fast: 120ms;
  --duration: 180ms;
  --duration-slow: 280ms;

  /* ---- Layers ---- */
  --z-sticky: 20;
  --z-topbar: 30;
  --z-backdrop: 40;
  --z-sidebar: 45;
  --z-dropdown: 50;
  --z-modal: 70;
  --z-toast: 80;
}

/* ==========================================================================
   Light theme (default)
   Warm-neutral canvas, white surfaces, hairline borders, soft shadows.
   ========================================================================== */
:root,
[data-theme="light"] {
  color-scheme: light;

  /* Surfaces, back to front */
  --bg-canvas: #f6f6f3;
  --bg-sunken: #eeeeea;
  --bg-surface: #ffffff;
  --bg-raised: #ffffff;
  --bg-sidebar: #fbfbf9;
  --bg-hover: rgba(27, 31, 38, 0.05);
  --bg-active: rgba(27, 31, 38, 0.085);
  --bg-backdrop: rgba(18, 22, 28, 0.45);

  /* Lines */
  --border-subtle: #e9e9e4;
  --border: #dcdcd6;
  --border-strong: #878e99;
  --border-input: #c5c8cd;

  /* Text */
  --text: #1b1f26;
  --text-secondary: #4c5461;
  --text-muted: #626a77;
  --text-placeholder: #8a919c;
  --text-on-primary: #ffffff;
  --text-on-accent: #ffffff;
  --text-on-danger: #ffffff;
  --text-on-solid: #ffffff;       /* initials on a tone's solid colour */

  /* Primary — the "Rather Be" ocean teal. Every interactive affordance. */
  --primary: #17779c;
  --primary-hover: #126583;
  --primary-active: #0f546e;
  --primary-text: #12627f;
  --primary-soft: #e3f0f5;
  --primary-border: #b3d7e4;

  /* Accent — the "Properties" coral. Brand moments and attention only. */
  --accent: #cc3d57;
  --accent-text: #b4344c;
  --accent-soft: #fbe7eb;
  --accent-border: #f2bcc6;

  /* Meaning */
  --success: #1f8a53;
  --success-text: #17683f;
  --success-soft: #e4f3ea;
  --success-border: #b4dcc5;

  --warning: #b7791f;
  --warning-text: #8a5a12;
  --warning-soft: #fbf1dd;
  --warning-border: #ecd39c;

  --danger: #c93245;
  --danger-hover: #b02a3b;
  --danger-text: #a82535;
  --danger-soft: #fbe8ea;
  --danger-border: #f0bcc3;

  --info: #2f6fd0;
  --info-text: #2457a6;
  --info-soft: #e6eefb;
  --info-border: #bcd1f2;

  /* Tones — categorical colours for owners and phases. Each has a text
     colour, a soft background, a border, and a solid for avatars. */
  --slate-fg: #535c68;   --slate-bg: #eef0f2;   --slate-border: #d5d9de;   --slate-solid: #6b7480;
  --coral-fg: #b4344c;   --coral-bg: #fbe9ec;   --coral-border: #f3c3cc;   --coral-solid: #d94a63;
  --violet-fg: #6b4ba3;  --violet-bg: #f1ecfa;  --violet-border: #d9cdf0;  --violet-solid: #7b5ea7;
  --green-fg: #1a7046;   --green-bg: #e5f3eb;   --green-border: #bde0cb;   --green-solid: #2e9960;
  --blue-fg: #17709a;    --blue-bg: #e4f1f7;    --blue-border: #badbea;    --blue-solid: #1a8ac0;
  --amber-fg: #8a5a12;   --amber-bg: #fbf1dd;   --amber-border: #ecd39c;   --amber-solid: #b7791f;

  /* Booking channels (launch form) */
  --channel-airbnb: #e0475a;
  --channel-bdc: #1f4fa3;
  --channel-direct: #0f8f80;
  --channel-marriott: #9e2a2f;
  --channel-vrbo: #3a5fe0;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(18, 22, 28, 0.05);
  --shadow-sm: 0 1px 2px rgba(18, 22, 28, 0.06), 0 2px 6px -1px rgba(18, 22, 28, 0.06);
  --shadow-md: 0 6px 16px -4px rgba(18, 22, 28, 0.12), 0 2px 5px -2px rgba(18, 22, 28, 0.06);
  --shadow-lg: 0 20px 44px -10px rgba(18, 22, 28, 0.22), 0 6px 14px -6px rgba(18, 22, 28, 0.10);

  --focus-ring: 0 0 0 3px rgba(23, 119, 156, 0.30);
  --focus-ring-danger: 0 0 0 3px rgba(201, 50, 69, 0.28);

  /* Select chevron (inlined so it can follow the theme) */
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23626a77' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Dark theme
   A neutral, slightly cool charcoal with clear steps between layers:
   sidebar < canvas < surface < raised. No tinted washes — depth comes from
   the surface steps and hairline borders, colour comes from content.
   ========================================================================== */
[data-theme="dark"] {
  color-scheme: dark;

  --bg-canvas: #0e1116;
  --bg-sunken: #0a0d11;
  --bg-surface: #151920;
  --bg-raised: #1b2029;
  --bg-sidebar: #0b0e12;
  --bg-hover: rgba(255, 255, 255, 0.055);
  --bg-active: rgba(255, 255, 255, 0.09);
  --bg-backdrop: rgba(3, 5, 8, 0.66);

  --border-subtle: #1f252e;
  --border: #29303b;
  --border-strong: #5a6676;
  --border-input: #36404d;

  --text: #e7eaef;
  --text-secondary: #aab3c0;
  --text-muted: #8791a0;
  --text-placeholder: #6b7684;
  --text-on-primary: #06202b;
  --text-on-accent: #2a0a12;
  --text-on-danger: #2a0a12;
  --text-on-solid: #ffffff;

  --primary: #3ba4cc;
  --primary-hover: #55b4d9;
  --primary-active: #6cc0e2;
  --primary-text: #6cc3e6;
  --primary-soft: rgba(59, 164, 204, 0.15);
  --primary-border: rgba(59, 164, 204, 0.38);

  --accent: #f07c92;
  --accent-text: #f598aa;
  --accent-soft: rgba(240, 124, 146, 0.15);
  --accent-border: rgba(240, 124, 146, 0.38);

  --success: #3fb779;
  --success-text: #6fd3a0;
  --success-soft: rgba(63, 183, 121, 0.15);
  --success-border: rgba(63, 183, 121, 0.38);

  --warning: #e0a53b;
  --warning-text: #edbe6b;
  --warning-soft: rgba(224, 165, 59, 0.15);
  --warning-border: rgba(224, 165, 59, 0.38);

  --danger: #e5566a;
  --danger-hover: #ee7384;
  --danger-text: #f58c98;
  --danger-soft: rgba(239, 98, 114, 0.15);
  --danger-border: rgba(239, 98, 114, 0.40);

  --info: #6aa1f0;
  --info-text: #94bbf5;
  --info-soft: rgba(106, 161, 240, 0.15);
  --info-border: rgba(106, 161, 240, 0.38);

  --slate-fg: #b4bcc8;   --slate-bg: rgba(148, 160, 176, 0.16);  --slate-border: rgba(148, 160, 176, 0.32);  --slate-solid: #6f7a88;
  --coral-fg: #f598aa;   --coral-bg: rgba(240, 124, 146, 0.16);  --coral-border: rgba(240, 124, 146, 0.36);  --coral-solid: #e0607a;
  --violet-fg: #b9a2e6;  --violet-bg: rgba(155, 125, 214, 0.18); --violet-border: rgba(155, 125, 214, 0.38); --violet-solid: #8e72c4;
  --green-fg: #6fd3a0;   --green-bg: rgba(63, 183, 121, 0.16);   --green-border: rgba(63, 183, 121, 0.36);   --green-solid: #37a56c;
  --blue-fg: #72c0e6;    --blue-bg: rgba(59, 164, 204, 0.16);    --blue-border: rgba(59, 164, 204, 0.36);    --blue-solid: #2e94c4;
  --amber-fg: #edbe6b;   --amber-bg: rgba(224, 165, 59, 0.16);   --amber-border: rgba(224, 165, 59, 0.36);   --amber-solid: #a87722;

  --channel-airbnb: #ff7a85;
  --channel-bdc: #6f9bea;
  --channel-direct: #3fcdb8;
  --channel-marriott: #e2666b;
  --channel-vrbo: #7f97ff;

  /* On dark, shadows barely read; borders do the separating. */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.36), 0 2px 6px -1px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, 0.55), 0 2px 6px -2px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 24px 56px -12px rgba(0, 0, 0, 0.70), 0 8px 18px -8px rgba(0, 0, 0, 0.50);

  --focus-ring: 0 0 0 3px rgba(59, 164, 204, 0.40);
  --focus-ring-danger: 0 0 0 3px rgba(229, 86, 106, 0.40);

  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238791a0' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
}

/* ---- Tone classes ---------------------------------------------------------
   Put `tone-<name>` on an element to give it (and its children) that
   colour family. Components then read the four --tone-* variables. */
.tone-slate  { --tone-fg: var(--slate-fg);  --tone-bg: var(--slate-bg);  --tone-border: var(--slate-border);  --tone-solid: var(--slate-solid); }
.tone-coral  { --tone-fg: var(--coral-fg);  --tone-bg: var(--coral-bg);  --tone-border: var(--coral-border);  --tone-solid: var(--coral-solid); }
.tone-violet { --tone-fg: var(--violet-fg); --tone-bg: var(--violet-bg); --tone-border: var(--violet-border); --tone-solid: var(--violet-solid); }
.tone-green  { --tone-fg: var(--green-fg);  --tone-bg: var(--green-bg);  --tone-border: var(--green-border);  --tone-solid: var(--green-solid); }
.tone-blue   { --tone-fg: var(--blue-fg);   --tone-bg: var(--blue-bg);   --tone-border: var(--blue-border);   --tone-solid: var(--blue-solid); }
.tone-amber  { --tone-fg: var(--amber-fg);  --tone-bg: var(--amber-bg);  --tone-border: var(--amber-border);  --tone-solid: var(--amber-solid); }

/* ==========================================================================
   Breakpoints (min-width, mobile first)

     640px   sm    large phones, landscape
     768px   md    tablets
    1024px   lg    laptops — the sidebar becomes a permanent column
    1280px   xl    desktops
    1536px   2xl   large desktops
    1920px   3xl   full HD and up
    2560px   4xl   1440p / QHD
    3200px   5xl   4K at 100% scaling

   Custom properties can't be used inside media queries, so these values are
   repeated literally wherever they're needed. Keep them in sync.
   ========================================================================== */

/* ---- Large displays ---------------------------------------------------------
   Wider screens get more content width, not stretched content. From QHD up
   the root size also steps slightly, so text and controls stay a readable
   physical size instead of shrinking into the corner of a huge monitor. */
@media (min-width: 1536px) {
  :root { --content-max: 88rem; --content-wide: 108rem; }
}
@media (min-width: 1920px) {
  :root { --content-max: 96rem; --content-wide: 116rem; }
}
@media (min-width: 2560px) {
  html { font-size: 106.25%; }   /* 17px */
  :root { --content-max: 104rem; --content-wide: 132rem; }
}
@media (min-width: 3200px) {
  html { font-size: 118.75%; }   /* 19px */
  :root { --content-max: 108rem; --content-wide: 148rem; }
}
