/* ==========================================================================
   Sub Services PMS — v6 visual system
   "Liquid Glass" — an Apple iOS / macOS inspired interface.

   Design language
   ---------------
   * Typography  : the native San Francisco stack first, Inter as the web
                   fallback, with iOS's tight optical letter-spacing on
                   headings and tabular numerals so figures line up in tables.
   * Colour      : Apple's system palette (systemBlue/Green/Indigo/Orange/
                   Pink/Purple/Red/Teal) on the iOS "grouped background"
                   grey. Bright and saturated, used as accents rather than
                   large flat fills.
   * Surfaces    : rounded cards (16-26px) floating on the grey ground with
                   layered, very soft shadows — a wide ambient blur plus a
                   tight contact shadow, which is what makes iOS cards read
                   as physical objects rather than outlined boxes.
   * Glass       : translucent surfaces with backdrop blur + saturation for
                   the sidebar, top bar and modals, so content scrolling
                   underneath tints them.
   * Motion      : short spring easing on hover/press — every card lifts and
                   every button compresses, the way iOS controls do.

   Everything lives in this one file, so the whole app can be re-skinned by
   editing the tokens in :root below.
   ========================================================================== */

/* Marker rule used by the stylesheet watchdog in includes/header.php to
   confirm this file actually loaded. If it didn't, the app shows a red
   banner naming the failed URL instead of silently rendering unstyled.
   Do not remove. */
.pms-css-probe { outline-style: dotted; }

/* ==========================================================================
   1. Design tokens
   ========================================================================== */
:root {
  /* ---- Apple system colours ---- */
  --ios-blue:      #007aff;
  --ios-blue-dk:   #0060df;
  --ios-green:     #34c759;
  --ios-green-dk:  #248a3d;
  --ios-indigo:    #5856d6;
  --ios-indigo-dk: #3634a3;
  --ios-orange:    #ff9500;
  --ios-orange-dk: #b25000;
  --ios-pink:      #ff2d55;
  --ios-pink-dk:   #d70015;
  --ios-purple:    #af52de;
  --ios-purple-dk: #8944ab;
  --ios-red:       #ff3b30;
  --ios-red-dk:    #d70015;
  --ios-teal:      #30b0c7;
  --ios-teal-dk:   #0071a4;
  --ios-yellow:    #ffcc00;
  --ios-mint:      #00c7be;

  /* ---- Brand (drives buttons, links, focus rings) ---- */
  --brand:         var(--ios-blue);
  --brand-light:   #4da2ff;
  --brand-dark:    var(--ios-blue-dk);
  --accent-teal:   var(--ios-teal);
  --accent-amber:  var(--ios-orange);
  --accent-rose:   var(--ios-pink);
  --accent-green:  var(--ios-green);
  --accent-purple: var(--ios-purple);

  /* ---- Grounds & surfaces ---- */
  --bg-app:         #f2f2f7;   /* iOS grouped background */
  --surface:        #ffffff;
  --surface-2:      #fbfbfd;
  --surface-sunken: #f5f5f9;
  --glass:          rgba(255, 255, 255, 0.72);
  --glass-strong:   rgba(255, 255, 255, 0.86);
  --border:         rgba(60, 60, 67, 0.12);
  --hairline:       rgba(60, 60, 67, 0.12);   /* iOS separator */
  --hairline-2:     rgba(60, 60, 67, 0.08);

  /* ---- Text ---- */
  --text-main:   #1c1c1e;   /* iOS label */
  --text-2:      #3c3c43;   /* secondary label */
  --text-muted:  #8e8e93;   /* tertiary label */
  --text-invert: #ffffff;

  /* ---- Radii ---- */
  --radius-sm: 12px;
  --radius:    16px;
  --radius-lg: 20px;
  --r-xs:      8px;
  --r-xl:      26px;
  --r-pill:    999px;

  /* ---- Shadows: ambient + contact, the iOS depth recipe ---- */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05), 0 1px 1px rgba(0,0,0,.03);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 8px 24px rgba(0,0,0,.07), 0 2px 6px rgba(0,0,0,.045);
  --shadow-lg: 0 18px 44px rgba(0,0,0,.10), 0 4px 12px rgba(0,0,0,.05);
  --shadow-xl: 0 30px 70px rgba(0,0,0,.14), 0 8px 20px rgba(0,0,0,.06);
  --shadow-brand: 0 8px 20px rgba(0,122,255,.30), 0 2px 6px rgba(0,122,255,.20);

  /* ---- Motion: an iOS-flavoured spring ---- */
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease:   cubic-bezier(.32, .72, 0, 1);
  --t-fast: .18s;
  --t-med:  .28s;

  --sidebar-w: 264px;
  --topbar-h:  64px;
}

/* ==========================================================================
   2. Base
   ========================================================================== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
               "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--text-main);
  background: var(--bg-app);
  background-image:
    radial-gradient(1100px 620px at 8% -8%,   rgba(88, 86, 214, .10), transparent 60%),
    radial-gradient(900px  520px at 100% 0%,  rgba(0, 199, 190, .10), transparent 55%),
    radial-gradient(800px  600px at 60% 108%, rgba(255, 45, 85, .06), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 { font-weight: 700; letter-spacing: -0.022em; color: var(--text-main); }
h4 { font-size: 21px; }
h5 { font-size: 17px; }
h6 { font-size: 15px; }

a { color: var(--brand); text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--brand-dark); }

/* Tabular numerals wherever figures are compared down a column. */
.amount, .stat-value, .finance-hero-value, .finance-card-value,
.table-clean td, .ledger-table td, .statement-table td { font-variant-numeric: tabular-nums; }

.text-muted-2 { color: var(--text-muted) !important; }

::selection { background: rgba(0,122,255,.18); }

/* iOS-style thin scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(60,60,67,.22); border-radius: var(--r-pill); border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(60,60,67,.38); background-clip: content-box; }

/* ==========================================================================
   3. App shell
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; }

/* ---- Sidebar: frosted glass rail ---- */
.app-sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  padding: 14px 12px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border-right: 1px solid var(--hairline);
  transition: transform var(--t-med) var(--ease);
}

.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 8px 10px 16px; }
.brand-mark {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-size: 19px; color: #fff;
  background: linear-gradient(145deg, var(--ios-blue), var(--ios-indigo));
  box-shadow: var(--shadow-brand);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.brand-text small { font-size: 11px; color: var(--text-muted); }

.sidebar-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; padding-bottom: 8px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px; font-weight: 500;
  position: relative;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--spring);
}
.sidebar-nav a:hover { background: rgba(120,120,128,.10); color: var(--text-main); transform: translateX(2px); }
.sidebar-nav a.active {
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(255,255,255,.75));
  color: var(--text-main);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* Colourful rounded-square app-icon chips, iOS home-screen style. */
.nav-icon-chip {
  width: 29px; height: 29px; flex: 0 0 29px;
  display: grid; place-items: center;
  border-radius: 9px;
  color: #fff; font-size: 14px;
  box-shadow: 0 2px 5px rgba(0,0,0,.16), inset 0 1px 0 rgba(255,255,255,.35);
  transition: transform var(--t-fast) var(--spring), box-shadow var(--t-fast) var(--ease);
}
.sidebar-nav a:hover .nav-icon-chip { transform: scale(1.08) rotate(-3deg); }
.sidebar-nav a.active .nav-icon-chip { transform: scale(1.05); box-shadow: 0 4px 10px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.4); }

.sidebar-heading {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted);
  padding: 16px 12px 5px;
}
.nav-pill {
  margin-left: auto;
  min-width: 20px; height: 20px; padding: 0 6px;
  display: inline-grid; place-items: center;
  border-radius: var(--r-pill);
  background: var(--ios-red); color: #fff;
  font-size: 11px; font-weight: 700;
  box-shadow: 0 2px 5px rgba(255,59,48,.4);
}

.sidebar-footer { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--hairline); }
.sidebar-user {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 9px; border-radius: var(--radius-sm);
  color: var(--text-main);
  transition: background var(--t-fast) var(--ease);
}
.sidebar-user:hover, .sidebar-user.active { background: rgba(120,120,128,.10); }
.sidebar-user-info { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.sidebar-user-info strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info small { font-size: 11px; color: var(--text-muted); }

.avatar-circle {
  width: 32px; height: 32px; flex: 0 0 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--ios-indigo), var(--ios-purple));
  color: #fff; font-size: 13px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(88,86,214,.35);
}

.btn-logout {
  width: 34px; height: 34px; flex: 0 0 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--text-muted);
  transition: all var(--t-fast) var(--ease);
}
.btn-logout:hover { background: rgba(255,59,48,.12); color: var(--ios-red); }

/* ---- Main column ---- */
.app-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.app-topbar {
  position: sticky; top: 0; z-index: 1020;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 22px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  border-bottom: 1px solid var(--hairline);
}
.topbar-title {
  font-size: 20px; font-weight: 700; letter-spacing: -.024em;
  margin: 0; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-actions { display: flex; align-items: center; gap: 9px; }

.btn-icon {
  width: 36px; height: 36px;
  display: inline-grid; place-items: center;
  border: 0; border-radius: 11px;
  background: rgba(120,120,128,.12);
  color: var(--text-2); font-size: 16px;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.btn-icon:hover { background: rgba(120,120,128,.2); color: var(--text-main); transform: translateY(-1px); }
.btn-icon:active { transform: scale(.94); }

.badge-dot {
  position: absolute; top: 6px; right: 7px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--ios-red);
  border: 2px solid #fff;
}

.app-content { padding: 24px 22px 64px; flex: 1; }

/* ==========================================================================
   4. Buttons — iOS controls with a compress-on-press feel
   ========================================================================== */
.btn {
  font-family: inherit;
  font-size: 14px; font-weight: 600; letter-spacing: -.01em;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  border: 0;
  transition: transform var(--t-fast) var(--spring), box-shadow var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn:focus, .btn:focus-visible { outline: 0; box-shadow: 0 0 0 4px rgba(0,122,255,.25); }

.btn-3d { position: relative; overflow: hidden; box-shadow: var(--shadow-sm); }
/* Two-layer gloss: a bright top highlight plus a soft inner rim, which is
   what reads as a raised, physical, "3D" button rather than a flat fill. */
.btn-3d::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 52%;
  background: linear-gradient(180deg, rgba(255,255,255,.38), rgba(255,255,255,0));
  pointer-events: none;
}
/* A moving sheen that sweeps across on hover. */
.btn-3d::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.35) 48%, transparent 62%);
  transform: translateX(-120%);
  transition: transform .6s var(--ease);
  pointer-events: none;
}
.btn-3d:hover::after { transform: translateX(120%); }
.btn-3d:hover { transform: translateY(-2px); }
.btn-3d:active { transform: translateY(1px) scale(.97); }

/* Colourful buttons: a vertical gradient, a matching coloured glow, and an
   inset rim light on top. The glow is the accent colour, not grey, so the
   buttons look lit rather than merely shaded. */
.btn-3d.btn-primary {
  background: linear-gradient(180deg, #38a1ff, var(--brand) 55%, var(--brand-dark));
  color: #fff;
  box-shadow: 0 6px 18px -3px rgba(0,122,255,.55), 0 2px 5px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.45);
}
.btn-3d.btn-primary:hover { box-shadow: 0 12px 28px -4px rgba(0,122,255,.68), 0 3px 7px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.5); }

.btn-3d.btn-success {
  background: linear-gradient(180deg, #63e07f, var(--ios-green) 55%, var(--ios-green-dk));
  color: #fff;
  box-shadow: 0 6px 18px -3px rgba(52,199,89,.55), 0 2px 5px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.45);
}
.btn-3d.btn-success:hover { box-shadow: 0 12px 28px -4px rgba(52,199,89,.68), 0 3px 7px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.5); }

.btn-3d.btn-danger {
  background: linear-gradient(180deg, #ff6f64, var(--ios-red) 55%, var(--ios-red-dk));
  color: #fff;
  box-shadow: 0 6px 18px -3px rgba(255,59,48,.55), 0 2px 5px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.45);
}
.btn-3d.btn-danger:hover { box-shadow: 0 12px 28px -4px rgba(255,59,48,.68), 0 3px 7px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.5); }

.btn-3d.btn-warning {
  background: linear-gradient(180deg, #ffbe52, var(--ios-orange) 55%, #e07f00);
  color: #fff;
  box-shadow: 0 6px 18px -3px rgba(255,149,0,.55), 0 2px 5px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.45);
}
.btn-3d.btn-warning:hover { box-shadow: 0 12px 28px -4px rgba(255,149,0,.68), 0 3px 7px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.5); }

.btn-3d.btn-teal {
  background: linear-gradient(180deg, #5adceb, var(--ios-teal) 55%, var(--ios-teal-dk));
  color: #fff;
  box-shadow: 0 6px 18px -3px rgba(48,176,199,.55), 0 2px 5px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.45);
}
.btn-3d.btn-teal:hover { box-shadow: 0 12px 28px -4px rgba(48,176,199,.68), 0 3px 7px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.5); }
.btn-3d.btn-secondary       { background: linear-gradient(180deg, #fff, #f1f1f5); color: var(--text-main); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--hairline); }
.btn-3d.btn-secondary:hover { background: linear-gradient(180deg, #fff, #e9e9ef); }
.btn-3d.btn-outline-secondary       { background: rgba(255,255,255,.9); color: var(--text-2); box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--hairline); }
.btn-3d.btn-outline-secondary:hover { background: #fff; color: var(--text-main); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--hairline); }

.btn-sm { padding: 5px 12px; font-size: 12.5px; border-radius: 10px; }
.btn-lg { padding: 11px 24px; font-size: 15.5px; border-radius: var(--radius); }

.btn-icon-only { padding: 0; width: 34px; height: 34px; display: inline-grid; place-items: center; }
.btn-3d.btn-icon-only.btn-sm { width: 30px; height: 30px; font-size: 13px; }

/* ==========================================================================
   5. Cards & panels
   ========================================================================== */
.card-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--hairline-2);
  overflow: hidden;
  transition: box-shadow var(--t-med) var(--ease);
}
.card-panel-header {
  display: flex; align-items: center; gap: 9px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(255,255,255,.9), var(--surface-2));
  font-size: 14px;
}
.card-panel-header strong { font-weight: 650; letter-spacing: -.015em; }
.card-panel-body { padding: 18px; }

/* ---- Stat cards ---- */
/* Deliberately compact: a dashboard's job is to be taken in at a glance, and
   a screenful of large tiles pushes the actual work below the fold. These are
   sized so a dozen fit above the fold on a laptop and still clear the 44px
   touch-target minimum. */
.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 10px;
}

.stat-card {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--hairline-2);
  box-shadow: var(--shadow-sm);
  height: 100%; min-height: 60px;
  transition: transform var(--t-med) var(--spring), box-shadow var(--t-med) var(--ease);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
a.stat-card, a .stat-card { color: inherit; }

.stat-icon {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  color: #fff; font-size: 17px;
  background: linear-gradient(145deg, var(--brand-light), var(--brand));
  box-shadow: 0 5px 12px -3px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.45);
  transition: transform var(--t-med) var(--spring);
}
.stat-card:hover .stat-icon { transform: scale(1.08) rotate(-4deg); }

.stat-text { min-width: 0; }
.stat-value {
  font-size: 20px; font-weight: 760; line-height: 1.15; letter-spacing: -.03em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* --text-muted is a 3:1 grey — fine for a hint, not for a value's own label.
   Secondary label text clears WCAG AA at this size. */
.stat-label {
  font-size: 11px; color: var(--text-2); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* A money figure needs room to breathe more than a count does. */
.stat-card-wide { grid-column: span 2; }
@media (max-width: 560px) { .stat-card-wide { grid-column: span 1; } }

/* Colourful variant: the whole card picks up a wash of its icon's colour.
   The icon carries an inline gradient, so its first colour is sampled into
   --stat-accent by dashboard.php / workspace.php where available; otherwise
   the brand blue is used. */
.stat-card-colorful {
  --stat-accent: var(--brand);
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg,
      color-mix(in srgb, var(--stat-accent) 14%, #fff),
      color-mix(in srgb, var(--stat-accent) 4%, #fff) 55%,
      #fff);
  border-color: color-mix(in srgb, var(--stat-accent) 24%, transparent);
  box-shadow:
    0 10px 24px -8px color-mix(in srgb, var(--stat-accent) 40%, transparent),
    0 2px 6px rgba(0,0,0,.05),
    inset 0 1px 0 rgba(255,255,255,.7);
}
.stat-card-colorful:hover {
  box-shadow:
    0 20px 40px -10px color-mix(in srgb, var(--stat-accent) 55%, transparent),
    0 5px 12px rgba(0,0,0,.07),
    inset 0 1px 0 rgba(255,255,255,.85);
}
.stat-card-colorful::after {
  content: '';
  position: absolute; top: -55%; right: -22%;
  width: 190px; height: 190px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--stat-accent) 26%, transparent), transparent 68%);
  pointer-events: none;
}
@supports not (background: color-mix(in srgb, red 10%, white)) {
  .stat-card-colorful { background: var(--surface); box-shadow: var(--shadow-md); }
}

/* Keyboard users land here first and can jump straight past the sidebar. */
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 2000;
  padding: 10px 16px; border-radius: 10px;
  background: var(--brand); color: #fff; font-size: 13px; font-weight: 650;
  text-decoration: none; box-shadow: var(--shadow-lg);
  transition: top var(--t-fast) var(--ease);
}
.skip-link:focus { top: 12px; color: #fff; }
#main-content:focus { outline: none; }

/* --------------------------------------------------------------------------
   Dashboard: section labels, status chips and the money strip.

   These replace what used to be two full rows of large tiles plus a 40px-tall
   finance hero. Same numbers, roughly a third of the vertical space, and each
   one is a real link to the filtered list behind it.
   -------------------------------------------------------------------------- */
.dash-hello { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.dash-greeting { font-size: 19px; font-weight: 750; letter-spacing: -.025em; color: var(--text-main); }
.dash-hello .dash-date { font-size: 12.5px; color: var(--text-2); }

.dash-section {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin: 18px 0 8px;
}
.dash-section:first-of-type { margin-top: 0; }
.dash-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-2); margin: 0;
}
.dash-section-link { font-size: 12px; font-weight: 600; }

/* One line per status, instead of a card each. */
.status-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.status-chip {
  --chip-accent: var(--brand);
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 42px; padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--hairline-2);
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  text-decoration: none;
  transition: transform var(--t-med) var(--spring), box-shadow var(--t-med) var(--ease);
}
.status-chip:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--text-2);
  border-color: color-mix(in srgb, var(--chip-accent) 35%, transparent);
}
.status-chip .chip-dot {
  width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%;
  background: var(--chip-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--chip-accent) 18%, transparent);
}
.status-chip b {
  font-size: 16px; font-weight: 780; letter-spacing: -.02em; color: var(--text-main);
}

/* Money gets its own row: bigger numerals, still one line tall. */
.money-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.money-tile {
  --money-accent: var(--brand);
  display: block; padding: 11px 14px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--money-accent) 11%, #fff), #fff 70%);
  border: 1px solid color-mix(in srgb, var(--money-accent) 22%, transparent);
  border-left: 4px solid var(--money-accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: transform var(--t-med) var(--spring), box-shadow var(--t-med) var(--ease);
}
.money-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.money-tile-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-2);
}
.money-tile-value {
  font-size: 21px; font-weight: 780; letter-spacing: -.03em; line-height: 1.2;
  color: var(--text-main); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Denser panel lists — the same rows, less air between them. */
/* Two panels per row on a desktop, one on a laptop-narrow or phone. The clamp
   keeps it from becoming three thin columns that leave a lone panel stranded
   on its own row. */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(300px, 45%, 560px), 1fr));
  gap: 12px;
}
.dash-grid .card-panel-body { padding: 6px 14px 10px; }
.dash-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--hairline-2);
  text-decoration: none; color: inherit;
}
.dash-grid .card-panel-body > .dash-row:last-child { border-bottom: 0; }
.dash-row:hover { color: inherit; }
/* These are spans (a row is an <a>, so it may not contain block elements that
   are themselves links) — they need to be told to stack. */
.dash-row-main { display: block; min-width: 0; flex: 1 1 auto; }
.dash-row-title {
  display: block;
  font-size: 12.8px; font-weight: 620; color: var(--text-main); line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
a.dash-row:hover .dash-row-title { color: var(--brand); }
.dash-row-sub {
  display: block;
  font-size: 11.5px; color: var(--text-2); line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dash-row > i { flex: 0 0 auto; }
.dash-row .badge-status { flex: 0 0 auto; }

/* Keyboard users get the same affordance mouse users get on hover. */
.stat-card:focus-visible,
.status-chip:focus-visible,
.money-tile:focus-visible,
.dash-row:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

@supports not (background: color-mix(in srgb, red 10%, white)) {
  .money-tile { background: var(--surface); }
  .status-chip .chip-dot { box-shadow: none; }
}

/* ==========================================================================
   6. Record cards — projects, clients, sub-clients, tasks, sub-tasks
   All five share one compact, colourful, 3D treatment. Each card sets
   --card-accent inline from its own colour, and the wash, top rail and
   icon all pick it up automatically.
   ========================================================================== */
.project-grid,
.record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 14px;
}

.project-card,
.record-card {
  --card-accent: var(--ios-blue);
  position: relative;
  display: flex; flex-direction: column;
  /* A real tint of the card's own colour, not just white — this is what
     makes the grid read as colourful at a glance. */
  background:
    linear-gradient(160deg,
      color-mix(in srgb, var(--card-accent) 13%, #fff) 0%,
      color-mix(in srgb, var(--card-accent) 5%,  #fff) 42%,
      #fff 100%);
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--card-accent) 22%, transparent);
  /* Coloured depth: the shadow itself is tinted with the accent, so each card
     casts light in its own hue instead of a generic grey drop. */
  box-shadow:
    0 10px 24px -8px color-mix(in srgb, var(--card-accent) 42%, transparent),
    0 2px 6px rgba(0,0,0,.05),
    inset 0 1px 0 rgba(255,255,255,.7);
  overflow: hidden;
  transition: transform var(--t-med) var(--spring), box-shadow var(--t-med) var(--ease),
              border-color var(--t-med) var(--ease);
}
.project-card:hover,
.record-card:hover {
  transform: translateY(-6px) scale(1.02);
  border-color: color-mix(in srgb, var(--card-accent) 45%, transparent);
  box-shadow:
    0 22px 44px -10px color-mix(in srgb, var(--card-accent) 58%, transparent),
    0 6px 14px rgba(0,0,0,.07),
    inset 0 1px 0 rgba(255,255,255,.85);
}
.project-card:active,
.record-card:active { transform: translateY(-2px) scale(1.002); }

/* Browsers without color-mix() still get a clearly coloured card. */
@supports not (background: color-mix(in srgb, red 10%, white)) {
  .project-card, .record-card { background: var(--surface); box-shadow: var(--shadow-md); }
}

/* The whole card is clickable. A stretched-link overlay sits behind the
   card's own controls (which are lifted above it with position:relative +
   z-index) so "open the record" is the default action anywhere on the card,
   while the edit/delete/PDF buttons inside it still work normally. */
.card-link-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}
.project-card, .record-card { cursor: pointer; }

/* LAYERING — this is subtle and was previously wrong, so it's worth stating.
   The card body and footer must NOT carry a z-index of their own. They sit
   later in the DOM than the overlay, so an equal z-index made them paint on
   top of it and silently swallow every click on the card — the card looked
   clickable but did nothing. They keep position:relative (so they sit above
   the decorative colour wash) with z-index left at auto, which puts the
   overlay above their plain content, while genuinely interactive children
   below are lifted to z-index 2 and stay above the overlay. */
.project-card-body,   .record-card-body,
.project-card-footer, .record-card-footer { position: relative; }

.project-card a:not(.card-link-overlay),
.record-card  a:not(.card-link-overlay),
.project-card button, .record-card button,
.project-card select, .record-card select,
.project-card input,  .record-card input,
.project-card label,  .record-card label,
.project-card form,   .record-card form,
.project-card [onclick], .record-card [onclick] {
  position: relative;
  z-index: 2;
}

/* Keyboard focus lands on the overlay link — show it clearly on the card. */
.card-link-overlay:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Soft colour wash bleeding in from the top-right corner. */
.project-card::after,
.record-card::after {
  content: '';
  position: absolute; top: -40%; right: -28%;
  width: 170px; height: 170px; border-radius: 50%;
  background: radial-gradient(circle, var(--card-accent), transparent 70%);
  opacity: .13;
  pointer-events: none;
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--spring);
}
.project-card:hover::after,
.record-card:hover::after { opacity: .22; transform: scale(1.15); }

/* The bright cap along the top edge, with a glossy highlight. */
.project-card-top,
.record-card-top {
  height: 7px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.45), rgba(255,255,255,0)),
    linear-gradient(90deg, var(--card-accent), color-mix(in srgb, var(--card-accent) 55%, #fff));
}

.project-card-body,
.record-card-body { padding: 13px 14px; flex: 1; }

.project-card-icon,
.record-card-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: #fff; font-size: 18px;
  background: linear-gradient(145deg,
      color-mix(in srgb, var(--card-accent) 72%, #fff),
      var(--card-accent));
  box-shadow:
    0 6px 14px -2px color-mix(in srgb, var(--card-accent) 65%, transparent),
    inset 0 1px 0 rgba(255,255,255,.5);
  margin-bottom: 9px;
  transition: transform var(--t-med) var(--spring), box-shadow var(--t-med) var(--ease);
}
.project-card:hover .project-card-icon,
.record-card:hover .record-card-icon {
  box-shadow:
    0 10px 20px -3px color-mix(in srgb, var(--card-accent) 75%, transparent),
    inset 0 1px 0 rgba(255,255,255,.6);
}
.project-card:hover .project-card-icon,
.record-card:hover .record-card-icon { transform: scale(1.09) rotate(-5deg); }

.record-card-meta { font-size: 11.5px; color: var(--text-muted); line-height: 1.65; }

/* Project card interior: title, blurb, and the three inline count figures. */
.project-card-body h3 {
  font-size: 14px; font-weight: 650; letter-spacing: -.015em;
  margin: 8px 0 3px; color: var(--text-main);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.project-card-body a:hover h3 { color: var(--brand); }
.project-card-body p { font-size: 11.5px; color: var(--text-muted); margin: 6px 0 0; line-height: 1.4; }
.project-card-meta { display: flex; gap: 13px; margin-top: 11px; font-size: 10.5px; color: var(--text-muted); }
.project-card-meta div { line-height: 1.15; }
.project-card-meta strong {
  display: block;
  font-size: 15px; font-weight: 700; letter-spacing: -.02em;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.project-card-footer,
.record-card-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 9px 12px;
  border-top: 1px solid color-mix(in srgb, var(--card-accent) 18%, transparent);
  background: color-mix(in srgb, var(--card-accent) 8%, #fff);
  position: relative;   /* no z-index — see the layering note above */
}

/* ---------------------------------------------------------------------
   Record list view — clients, sub-clients, tasks and sub-tasks as wide rows
   with their photo/icon kept as a thumbnail on the left.

   Same markup as the card grid; main.js only swaps classes, so the stretched
   link and every button behave identically in both views.
   --------------------------------------------------------------------- */
.record-list { display: flex; flex-direction: column; gap: 10px; }

.record-list .record-card { flex-direction: row; align-items: stretch; }

/* The colour rail moves from the top edge to the leading edge. */
.record-list .record-card-top {
  height: auto; width: 6px; flex: 0 0 6px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.45), rgba(255,255,255,0)),
    linear-gradient(180deg, var(--card-accent), color-mix(in srgb, var(--card-accent) 55%, #fff));
}

.record-list .record-card-body {
  display: flex; align-items: center; gap: 18px;
  padding: 9px 14px; min-width: 0;
}

/* Thumbnail + name + code stay together at the head of the row. */
.record-list .record-card-head {
  margin-bottom: 0;
  flex: 0 0 clamp(200px, 26%, 300px);
  min-width: 0;
}

/* Task cards lead with a priority icon instead of a photo. */
.record-list .record-card-body > .record-card-icon { flex: 0 0 auto; margin: 0; }
.record-list .record-card-body > .record-card-title { flex: 0 0 clamp(150px, 20%, 260px); margin: 0; }
.record-list .record-card-body > .code-badge { flex: 0 0 auto; margin: 0 !important; }

/* The facts run along the row instead of stacking. */
.record-list .record-card-meta {
  flex: 1 1 auto; min-width: 0;
  margin-top: 0 !important;
  display: flex; flex-wrap: wrap; gap: 3px 16px;
}
.record-list .rc-fact { max-width: 260px; }

.record-list .record-card-footer {
  border-top: 0;
  border-left: 1px solid color-mix(in srgb, var(--card-accent) 18%, transparent);
  flex: 0 0 auto; flex-wrap: nowrap; gap: 10px; padding: 9px 14px;
}
.record-list .record-card-footer .btn { white-space: nowrap; }

/* One fact — an icon and its value. Stacks in the grid, inline in a row. */
.rc-fact {
  display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rc-fact > i, .rc-fact > .priority-dot { margin-right: 5px; }
.rc-fact-amount { font-weight: 650; color: var(--text-main); }

/* Narrow screens get the card layout back — a wide row cannot fit. */
@media (max-width: 820px) {
  .record-list .record-card { flex-direction: column; }
  .record-list .record-card-top { width: auto; height: 7px; flex: 0 0 7px; }
  .record-list .record-card-body { display: block; padding: 13px 14px; }
  .record-list .record-card-head { margin-bottom: 9px; }
  .record-list .record-card-meta { display: block; margin-top: 10px !important; }
  .record-list .record-card-footer {
    border-left: 0;
    border-top: 1px solid color-mix(in srgb, var(--card-accent) 18%, transparent);
  }
}

@supports not (background: color-mix(in srgb, red 10%, white)) {
  .record-list .record-card-footer { border-left-color: rgba(120,120,128,.18); }
}

/* ---------------------------------------------------------------------
   Project list view — the same colourful card, laid out as a wide row.

   Nothing is re-rendered when you switch: main.js only swaps the container
   and card classes, so the accent colour, the stretched link and the action
   buttons all keep working exactly as they do in the grid.
   --------------------------------------------------------------------- */
.project-list { display: flex; flex-direction: column; gap: 10px; }

.project-list .project-card { flex-direction: row; align-items: stretch; }

/* The colour rail moves from the top edge to the leading edge. */
.project-list .project-card-top {
  height: auto; width: 6px; flex: 0 0 6px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.45), rgba(255,255,255,0)),
    linear-gradient(180deg, var(--card-accent), color-mix(in srgb, var(--card-accent) 55%, #fff));
}

.project-list .project-card-body {
  display: grid; align-items: center; gap: 2px 16px;
  grid-template-columns: 40px minmax(170px, 2fr) auto minmax(90px, 140px) auto;
  grid-template-areas: "icon title meta progress status";
  padding: 9px 14px;
}
/* `display: contents` lets the icon and the status badge become grid items in
   their own right, without changing the markup the grid view needs. The
   !important is not decoration: Bootstrap's own .d-flex utility carries one,
   so nothing weaker can win here. */
.project-list .project-card-body > .d-flex { display: contents !important; }
.project-list .project-card-icon { grid-area: icon; }
.project-list .project-card-body .badge-status { grid-area: status; justify-self: end; }
.project-list .project-card-body > a { grid-area: title; align-self: end; }
.project-list .project-card-body > .code-badge { grid-area: title; align-self: start; margin: 0; }
.project-list .project-card-body > p { display: none; }          /* the blurb needs a card, not a row */
.project-list .project-card-meta { grid-area: meta; margin-top: 0; gap: 18px; }
.project-list .project-card-progress { grid-area: progress; display: block; }

.project-list .project-card-body h3 { margin: 0; }

.project-list .project-card-footer {
  border-top: 0;
  border-left: 1px solid color-mix(in srgb, var(--card-accent) 18%, transparent);
  flex: 0 0 auto; flex-wrap: nowrap; gap: 8px; padding: 9px 14px;
}
.project-list .project-card-footer > .d-flex { flex-wrap: nowrap; }
.project-list .project-card-footer .btn { white-space: nowrap; }

/* Thin progress bar — only shown in list view, where there is room for it. */
.project-card-progress {
  display: none;
  height: 6px; border-radius: 99px; overflow: hidden;
  background: color-mix(in srgb, var(--card-accent) 16%, #fff);
}
.project-card-progress span {
  display: block; height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--card-accent), color-mix(in srgb, var(--card-accent) 55%, #fff));
  transition: width var(--t-slow) var(--ease);
}

/* Narrow screens get the card layout back — a four-column row cannot fit. */
@media (max-width: 820px) {
  .project-list .project-card { flex-direction: column; }
  .project-list .project-card-top { width: auto; height: 7px; flex: 0 0 7px; }
  .project-list .project-card-body {
    display: block;
    grid-template-columns: none; grid-template-areas: none;
    padding: 13px 14px;
  }
  .project-list .project-card-body > .d-flex { display: flex !important; }
  .project-list .project-card-body > p { display: block; }
  .project-list .project-card-meta { margin-top: 11px; }
  .project-list .project-card-footer { border-left: 0; border-top: 1px solid color-mix(in srgb, var(--card-accent) 18%, transparent); }
}

@supports not (background: color-mix(in srgb, red 10%, white)) {
  .project-card-progress { background: rgba(120,120,128,.16); }
  .project-card-progress span { background: var(--card-accent); }
  .project-list .project-card-footer { border-left-color: rgba(120,120,128,.18); }
}

/* A record card that leads with a photo (clients / sub-clients). */
.record-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.record-card-title {
  font-size: 14px; font-weight: 650; letter-spacing: -.015em;
  color: var(--text-main); display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
a.record-card-title:hover { color: var(--brand); }
.record-card-sub { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.record-card-stats { display: flex; gap: 14px; margin-top: 10px; }
.record-card-stat { line-height: 1.15; }
.record-card-stat b { font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.record-card-stat span { display: block; font-size: 10.5px; color: var(--text-muted); }

/* ==========================================================================
   7. Forms — iOS inset fields
   ========================================================================== */
.form-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.form-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); margin: 22px 0 10px;
}

.form-control, .form-select {
  font-family: inherit;
  font-size: 14px;
  color: var(--text-main);
  background: var(--surface-sunken);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.03);
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.form-control:hover, .form-select:hover { background: #f0f0f5; }
.form-control:focus, .form-select:focus {
  background: #fff;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(0,122,255,.16);
  outline: 0;
}
.form-control::placeholder { color: var(--text-muted); }
.form-control-sm, .form-select-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 10px; }
textarea.form-control { line-height: 1.55; }

input[type="file"].form-control { padding: 7px 11px; }
input[type="file"].form-control::file-selector-button {
  font-family: inherit; font-size: 12.5px; font-weight: 600;
  border: 0; border-radius: 8px;
  padding: 5px 11px; margin-right: 11px;
  background: linear-gradient(180deg, #fff, #eeeef3);
  color: var(--brand);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
input[type="file"].form-control::file-selector-button:hover { background: linear-gradient(180deg, #fff, #e4e4ea); }

/* ==========================================================================
   7b. A4 form sheet — the full-page client registration form
   A registration form is a document, so it is presented as one: a real
   210mm-wide sheet with numbered sections and generous spacing, rather than
   crammed into a narrow modal. Prints cleanly as a paper form too.
   ========================================================================== */
.sheet-toolbar {
  max-width: 210mm;
  margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap;
}

.form-sheet {
  max-width: 210mm;             /* A4 width */
  margin: 0 auto 40px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--hairline-2);
  padding: 34px 40px 30px;
  position: relative;
  overflow: hidden;
}
/* A coloured band across the very top, like a letterhead rule. */
.form-sheet::before {
  content: '';
  position: absolute; inset: 0 0 auto 0; height: 6px;
  background: linear-gradient(90deg, var(--ios-blue), var(--ios-indigo) 40%, var(--ios-purple) 70%, var(--ios-pink));
}

.sheet-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px; flex-wrap: wrap;
  padding-bottom: 18px; margin-bottom: 8px;
  border-bottom: 2px solid var(--text-main);
}
.sheet-org { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); }
.sheet-title { font-size: 26px; font-weight: 750; letter-spacing: -.03em; margin: 3px 0 5px; }
.sheet-sub { font-size: 12.5px; color: var(--text-muted); }
.sheet-meta { min-width: 190px; font-size: 12px; }
.sheet-meta-row {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 3px 0; border-bottom: 1px dotted var(--hairline);
}
.sheet-meta-row span { color: var(--text-muted); }
.sheet-meta-row strong { font-weight: 650; }

.sheet-section { padding: 22px 0 4px; border-bottom: 1px solid var(--hairline-2); }
.sheet-section:last-of-type { border-bottom: 0; }
.sheet-section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 700; letter-spacing: -.01em;
  text-transform: uppercase;
  margin: 0 0 16px;
}
.sheet-num {
  width: 26px; height: 26px; flex: 0 0 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--ios-blue), var(--ios-indigo));
  color: #fff; font-size: 12.5px; font-weight: 700;
  box-shadow: 0 4px 10px -2px rgba(0,122,255,.55);
}
.sheet-optional {
  font-size: 10.5px; font-weight: 600; text-transform: none;
  letter-spacing: 0; color: var(--text-muted);
  background: rgba(120,120,128,.14);
  padding: 2px 9px; border-radius: var(--r-pill);
}
.sheet-hint { font-size: 12.5px; color: var(--text-muted); margin: -6px 0 14px; max-width: 62ch; }

/* A simple 6-column grid — wide enough that fields breathe. */
.field-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px 20px; }
.field-full   { grid-column: span 6; }
.field-half   { grid-column: span 3; }
.field-third  { grid-column: span 2; }
.field .form-control, .field .form-select { width: 100%; }
.req { color: var(--ios-red); }

/* Staff assignment as tick-able cards rather than a tiny multi-select. */
.assign-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.assign-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.assign-chip:hover { background: #eeeef4; }
.assign-chip input { accent-color: var(--brand); width: 16px; height: 16px; flex: 0 0 16px; }
.assign-chip:has(input:checked) {
  background: rgba(0,122,255,.09);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0,122,255,.12);
}
.assign-avatar {
  width: 28px; height: 28px; flex: 0 0 28px;
  display: grid; place-items: center; border-radius: 50%;
  background: linear-gradient(145deg, var(--ios-indigo), var(--ios-purple));
  color: #fff; font-size: 12px; font-weight: 700;
}
.assign-name { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.assign-name strong { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.assign-name small { font-size: 10.5px; color: var(--text-muted); }

/* Inside the A4 sheet the three image slots always sit on one row, so the
   photograph and both card sides read as a single set. */
.form-sheet .image-slot-grid { grid-template-columns: repeat(3, 1fr); justify-content: stretch; }
@media (max-width: 767.98px) {
  .form-sheet .image-slot-grid { grid-template-columns: 1fr; }
}

.sheet-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding-top: 22px; margin-top: 6px;
  border-top: 1px solid var(--hairline);
}

/* Signature strip — only appears on a printed copy. */
.sheet-signatures { display: flex; gap: 34px; margin-top: 34px; }
.sheet-signatures .sig { flex: 1; font-size: 11px; color: var(--text-muted); }
.sheet-signatures .sig span { display: block; border-bottom: 1px solid var(--text-main); height: 34px; margin-bottom: 5px; }

@media (max-width: 767.98px) {
  .form-sheet { padding: 22px 18px 20px; border-radius: var(--radius); }
  .field-half, .field-third { grid-column: span 6; }
  .sheet-title { font-size: 21px; }
}

@media print {
  .form-sheet { box-shadow: none; border: 0; border-radius: 0; padding: 0; max-width: none; }
  .form-sheet::before { display: none; }
  .sheet-section { break-inside: avoid; }
  .assign-chip { background: none; border-color: #ccc; }
}

/* ==========================================================================
   8. Image slots — profile photo + identity card front/back
   ========================================================================== */
/* Columns are capped rather than 1fr: on a wide form the slots stay a
   sensible, comparable size instead of stretching into huge drop zones. */
.image-slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 250px));
  justify-content: start;
  gap: 14px;
}
.image-slot {
  display: flex; flex-direction: column;
  background: var(--surface-sunken);
  border-radius: var(--radius);
  padding: 13px;
  border: 1px solid var(--hairline-2);
}
.image-slot-preview {
  position: relative;
  width: 100%;
  display: grid; place-items: center;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(135deg, rgba(0,122,255,.05), rgba(175,82,222,.05)),
    repeating-conic-gradient(#f7f7fa 0% 25%, #efeff4 0% 50%) 50% / 14px 14px;
  border: 1.5px dashed rgba(60,60,67,.2);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
/* Fixed heights, width derived from the ratio — so the portrait photo slot
   and the two landscape card slots line their file pickers up on one row. */
.image-slot-portrait  { height: 150px; width: auto; aspect-ratio: 413 / 531; margin-inline: auto; }
.image-slot-landscape { height: 150px; width: auto; aspect-ratio: 1.586; margin-inline: auto; }   /* ISO/IEC 7810 ID-1 */
.image-slot-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-slot-preview.image-slot-filled { border-style: solid; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(0,122,255,.12); }
.image-slot-placeholder { font-size: 30px; color: rgba(60,60,67,.28); }

/* Read-only ID card thumbnails on the view screens. */
.id-card-row { display: flex; flex-wrap: wrap; gap: 14px; }
.id-card-thumb {
  position: relative;
  width: 236px; max-width: 100%;
  aspect-ratio: 1.586;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 3px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-sunken);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-sm);
  color: var(--text-muted);
  transition: transform var(--t-med) var(--spring), box-shadow var(--t-med) var(--ease);
}
.id-card-thumb-portrait { width: 150px; aspect-ratio: 413 / 531; }
a.id-card-thumb:hover { transform: translateY(-3px) scale(1.02); box-shadow: var(--shadow-lg); }
.id-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.id-card-thumb > i { font-size: 32px; opacity: .4; }
.id-card-thumb-label {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 6px 10px;
  font-size: 11px; font-weight: 600; color: #fff;
  background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.62));
}
.id-card-thumb-empty { border-style: dashed; box-shadow: none; }
.id-card-thumb-empty .id-card-thumb-label { position: static; color: var(--text-muted); background: none; padding: 0; }

/* Legacy single-photo uploader (kept so any older markup still renders). */
.photo-upload-preview {
  width: 104px; height: 134px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-sunken);
  border: 1.5px dashed rgba(60,60,67,.2);
}
.photo-upload-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-upload-placeholder { font-size: 28px; color: rgba(60,60,67,.28); }

/* The photo on a client's profile header doubles as the shortcut to the
   Edit form's photo + ID-card uploader, so changing a photo doesn't require
   hunting for the Edit button first. */
.photo-edit-wrap {
  position: relative;
  display: inline-block;
  padding: 0; border: 0; background: none;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  line-height: 0;
}
.photo-edit-overlay {
  position: absolute; inset: auto 0 0 0;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 6px 4px;
  font-size: 10px; font-weight: 700; line-height: 1.2; color: #fff;
  background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.72));
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 0;
  transform: translateY(100%);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--spring);
}
.photo-edit-wrap:hover .photo-edit-overlay,
.photo-edit-wrap:focus-visible .photo-edit-overlay { opacity: 1; transform: none; }
.photo-edit-wrap:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Client / task photo avatars */
.client-photo {
  display: inline-block;
  object-fit: cover;
  border-radius: 10px;
  background: var(--surface-sunken);
  box-shadow: var(--shadow-xs), 0 0 0 1px var(--hairline);
  vertical-align: middle;
}
.client-photo-sm { width: 30px; height: 38px; border-radius: 7px; }
.client-photo-md { width: 54px; height: 69px; }
.client-photo-lg { width: 84px; height: 108px; border-radius: var(--radius-sm); box-shadow: var(--shadow-md), 0 0 0 1px var(--hairline); }
.client-photo-fallback {
  display: inline-grid; place-items: center;
  background: linear-gradient(145deg, var(--ios-indigo), var(--ios-purple));
  color: #fff; font-weight: 700;
}
.client-photo-fallback.client-photo-sm { font-size: 13px; }
.client-photo-fallback.client-photo-md { font-size: 21px; }
.client-photo-fallback.client-photo-lg { font-size: 32px; }

/* ==========================================================================
   9. Tabs — iOS segmented control
   ========================================================================== */
.tab-pills {
  display: inline-flex;
  width: fit-content;   /* beats Bootstrap's .nav{display:flex} stretching it full-width */
  max-width: 100%;
  padding: 4px;
  border-radius: 13px;
  background: rgba(120,120,128,.12);
  border: 0;
  flex-wrap: wrap;
  gap: 2px !important;
}
.tab-pills .nav-link {
  border: 0; background: transparent;
  border-radius: 10px;
  padding: 6px 14px;
  font-size: 13px; font-weight: 600; letter-spacing: -.01em;
  color: var(--text-2);
  transition: all var(--t-fast) var(--ease);
}
.tab-pills .nav-link:hover { color: var(--text-main); background: rgba(255,255,255,.55); }
.tab-pills .nav-link.active { background: #fff; color: var(--text-main); box-shadow: var(--shadow-sm); }

/* ==========================================================================
   10. Tables
   ========================================================================== */
.table-clean, .ledger-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}
.table-clean thead th, .ledger-table thead th {
  text-align: left;
  padding: 11px 14px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
.table-clean tbody td, .ledger-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--hairline-2);
  vertical-align: middle;
}
.table-clean tbody tr:last-child td, .ledger-table tbody tr:last-child td { border-bottom: 0; }
.table-clean tbody tr { transition: background var(--t-fast) var(--ease); }
.table-clean tbody tr:hover { background: rgba(0,122,255,.035); }

.tree-row td { background: var(--surface-2); }
.tree-indent { display: inline-block; width: 20px; }

.divider-dashed { border: 0; border-top: 1px dashed var(--hairline); margin: 18px 0; }

/* ==========================================================================
   11. Badges, chips & status
   ========================================================================== */
.badge-status, .badge-pending, .badge-progress, .badge-submitted,
.badge-completed, .badge-rejected, .badge-reopened {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 650;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-status    { background: rgba(120,120,128,.14); color: var(--text-2); }
.badge-pending   { background: rgba(255,149,0,.14);  color: var(--ios-orange-dk); border-color: rgba(255,149,0,.22); }
.badge-progress  { background: rgba(0,122,255,.13);  color: var(--ios-blue-dk);   border-color: rgba(0,122,255,.22); }
.badge-submitted { background: rgba(88,86,214,.13);  color: var(--ios-indigo-dk); border-color: rgba(88,86,214,.22); }
.badge-completed { background: rgba(52,199,89,.15);  color: var(--ios-green-dk);  border-color: rgba(52,199,89,.24); }
.badge-rejected  { background: rgba(255,59,48,.13);  color: var(--ios-red-dk);    border-color: rgba(255,59,48,.22); }
.badge-reopened  { background: rgba(175,82,222,.13); color: var(--ios-purple-dk); border-color: rgba(175,82,222,.22); }

.code-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: rgba(120,120,128,.12);
  color: var(--text-muted);
  font-size: 10.5px; font-weight: 650;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

.priority-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.priority-low    { background: var(--ios-teal); }
.priority-normal { background: var(--ios-blue); }
.priority-high   { background: var(--ios-orange); box-shadow: 0 0 0 3px rgba(255,149,0,.18); }
.priority-urgent { background: var(--ios-red); box-shadow: 0 0 0 3px rgba(255,59,48,.2); animation: pulseDot 1.9s ease-in-out infinite; }
@keyframes pulseDot { 0%,100% { box-shadow: 0 0 0 3px rgba(255,59,48,.2); } 50% { box-shadow: 0 0 0 6px rgba(255,59,48,.06); } }

/* ==========================================================================
   12. Alerts & empty states
   ========================================================================== */
.alert-soft {
  border: 0;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-sm);
  animation: slideDown .35s var(--spring);
}
.alert-soft.alert-success { background: rgba(52,199,89,.14); color: var(--ios-green-dk); }
.alert-soft.alert-danger  { background: rgba(255,59,48,.13); color: var(--ios-red-dk); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.empty-state {
  text-align: center;
  padding: 44px 22px;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--hairline);
}
.empty-state i { font-size: 40px; opacity: .35; display: block; margin-bottom: 10px; }
.empty-state p { font-size: 13.5px; margin: 0; }

/* ==========================================================================
   13. Finance / accounts
   ========================================================================== */
.finance-hero {
  position: relative;
  overflow: hidden;
  padding: 22px 26px;
  border-radius: var(--r-xl);
  color: #fff;
  background: linear-gradient(135deg, var(--ios-indigo), var(--ios-blue) 55%, var(--ios-teal));
  box-shadow: 0 16px 38px rgba(88,86,214,.32), 0 4px 12px rgba(0,0,0,.08);
  margin-bottom: 14px;
}
.finance-hero::after {
  content: '';
  position: absolute; top: -60%; right: -8%;
  width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.22), transparent 68%);
  pointer-events: none;
}
.finance-hero-label { position: relative; z-index: 1; font-size: 12px; font-weight: 600; opacity: .9; letter-spacing: .02em; text-transform: uppercase; }
.finance-hero-value { position: relative; z-index: 1; font-size: 40px; font-weight: 800; letter-spacing: -.035em; line-height: 1.1; margin: 4px 0 2px; }
.finance-hero-sub   { position: relative; z-index: 1; font-size: 12.5px; opacity: .85; }

/* The explicit "total − paid = outstanding" line under the hero figure. */
.finance-formula {
  position: relative; z-index: 1;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px;
  margin-top: 14px; padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.25);
  font-variant-numeric: tabular-nums;
}
.finance-formula span   { font-size: 15px; font-weight: 600; opacity: .92; }
.finance-formula em     { font-style: normal; font-size: 15px; opacity: .65; }
.finance-formula strong { font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.finance-formula small  { flex-basis: 100%; font-size: 10.5px; opacity: .7; letter-spacing: .04em; text-transform: uppercase; }

.finance-summary-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 6px; }
.finance-card {
  padding: 15px 17px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--hairline-2);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-med) var(--spring), box-shadow var(--t-med) var(--ease);
}
.finance-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.finance-card-label { font-size: 11.5px; color: var(--text-muted); font-weight: 500; }
.finance-card-value { font-size: 24px; font-weight: 750; letter-spacing: -.03em; margin-top: 2px; }
.finance-card-paid  { border-left: 4px solid var(--ios-green); }
.finance-card-paid  .finance-card-value { color: var(--ios-green-dk); }
.finance-card-due   { border-left: 4px solid var(--ios-red); }
.finance-card-due   .finance-card-value { color: var(--ios-red-dk); }
.finance-card-clear { border-left: 4px solid var(--ios-teal); }
.finance-card-clear .finance-card-value { color: var(--ios-teal-dk); }
.finance-card-action { display: flex; flex-direction: column; justify-content: center; background: var(--surface-2); }

.payment-progress { height: 7px; border-radius: var(--r-pill); background: rgba(120,120,128,.16); overflow: hidden; min-width: 90px; }
.payment-progress-bar { height: 100%; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--ios-blue), var(--ios-teal)); transition: width .6s var(--ease); }
.payment-progress-bar.is-complete { background: linear-gradient(90deg, var(--ios-green), var(--ios-mint)); }

/* Total / Paid / Outstanding strip shown at the top of the payment form, so
   the total is always read before an amount is entered. */
.pay-summary {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--hairline);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--hairline);
}
.pay-summary-cell { background: var(--surface-sunken); padding: 10px 12px; text-align: center; }
.pay-summary-cell span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.pay-summary-cell strong { display: block; font-size: 16px; font-weight: 750; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Full payment vs installment — two large, obvious choices. */
.paytype-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.paytype-opt {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.paytype-opt:hover { background: #eeeef4; }
.paytype-opt input { accent-color: var(--brand); margin-top: 2px; flex: 0 0 auto; }
.paytype-opt span { display: flex; flex-direction: column; line-height: 1.3; }
.paytype-opt strong { font-size: 13px; font-weight: 650; }
.paytype-opt small { font-size: 11px; color: var(--text-muted); }
.paytype-opt:has(input:checked) {
  background: rgba(0,122,255,.09);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0,122,255,.12);
}

.receipt-waiver {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255,149,0,.07);
  border: 1px dashed rgba(255,149,0,.35);
  font-size: 12.5px;
}

@media (max-width: 575.98px) {
  .paytype-choice { grid-template-columns: 1fr; }
  .pay-summary { grid-template-columns: 1fr; }
}

.service-row { transition: background var(--t-fast) var(--ease); }
.service-row:hover { background: rgba(0,122,255,.05) !important; }
/* A service whose total hasn't been entered yet — nudge the eye toward the
   "Set Total" button, since entering the total is the first step of the flow. */
.service-row-untotalled { background: rgba(255,149,0,.07); }
.service-row-untotalled:hover { background: rgba(255,149,0,.12) !important; }
.service-row-untotalled td:first-child { box-shadow: inset 3px 0 0 var(--ios-orange); }
.service-row-chevron { transition: transform var(--t-med) var(--spring); display: inline-block; color: var(--text-muted); }
.service-row-chevron.open { transform: rotate(90deg); color: var(--brand); }
.service-row-detail-inner { padding: 14px 18px; background: var(--surface-sunken); border-radius: var(--radius-sm); margin: 4px 8px 12px; }

/* ==========================================================================
   13b. Notes
   A note is a small document about a client or a case. Each one leads with
   what it's about, then its text, then whatever media is attached — shown as
   a 2-up card grid or a single-column list.
   ========================================================================== */
.notes-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 14px;
}
.notes-count { font-size: 13px; color: var(--text-2); }
.notes-count strong { font-size: 16px; font-weight: 750; }

/* Segmented list/grid switch. */
.view-toggle {
  display: inline-flex; padding: 3px; gap: 2px;
  background: rgba(120,120,128,.12); border-radius: 11px;
}
.view-toggle-btn {
  border: 0; background: transparent;
  min-width: 32px; height: 30px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 8px;
  color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.view-toggle-btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.view-toggle-btn i { font-size: 14px; }
/* The words are what make the switch findable; below 576px there is no room,
   and the title/aria label still carry the meaning. */
.view-toggle-label { font-size: 12px; }
@media (max-width: 576px) {
  .view-toggle-label { display: none; }
  .view-toggle-btn { padding: 0; width: 32px; }
}
.view-toggle-btn:hover { background: rgba(255,255,255,.6); color: var(--text-main); }
.view-toggle-btn.active { background: #fff; color: var(--brand); box-shadow: var(--shadow-sm); }

/* Notes in grid view are 1.5in x 1.5in tiles — 144px at the CSS reference
   96dpi. The column width is FIXED rather than 1fr on purpose: a fractional
   track stretches the last row's tiles across the leftover space, and a note
   that is 1.5in wide in one row and 4in wide in the next is not a tile any
   more. The tile is a summary; the whole note opens in a viewer when clicked. */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 144px);
  justify-content: start;
  gap: 12px; align-items: start;
}
.notes-list { display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 380px) {
  .notes-grid { grid-template-columns: repeat(auto-fill, 132px); gap: 10px; }
}

.note-card {
  --card-accent: var(--ios-orange);
  position: relative;
  display: flex; flex-direction: column;
  background: linear-gradient(160deg,
      color-mix(in srgb, var(--card-accent) 10%, #fff) 0%,
      color-mix(in srgb, var(--card-accent) 3%,  #fff) 45%, #fff 100%);
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--card-accent) 22%, transparent);
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--card-accent) 40%, transparent),
              0 2px 5px rgba(0,0,0,.05), inset 0 1px 0 rgba(255,255,255,.7);
  overflow: hidden;
  transition: transform var(--t-med) var(--spring), box-shadow var(--t-med) var(--ease);
}
.note-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px -10px color-mix(in srgb, var(--card-accent) 55%, transparent),
              0 5px 12px rgba(0,0,0,.07), inset 0 1px 0 rgba(255,255,255,.85);
}
@supports not (background: color-mix(in srgb, red 10%, white)) {
  .note-card { background: var(--surface); box-shadow: var(--shadow-md); }
}
.note-card-top { height: 6px; background: linear-gradient(90deg, var(--card-accent), color-mix(in srgb, var(--card-accent) 55%, #fff)); }
.note-card-body { padding: 15px 17px; flex: 1; }

.note-pin {
  position: absolute; top: 14px; right: 14px;
  width: 26px; height: 26px; display: grid; place-items: center;
  border-radius: 50%; background: var(--card-accent); color: #fff; font-size: 12px;
  box-shadow: 0 3px 8px -1px color-mix(in srgb, var(--card-accent) 60%, transparent);
}

/* The "what is this about" line — deliberately the first thing in the card. */
.note-context {
  font-size: 11.5px; color: var(--text-2);
  padding: 5px 10px; margin-bottom: 10px;
  background: color-mix(in srgb, var(--card-accent) 12%, #fff);
  border-radius: var(--r-pill);
  display: inline-flex; align-items: center; gap: 2px; flex-wrap: wrap;
  max-width: 100%;
}
@supports not (background: color-mix(in srgb, red 10%, white)) {
  .note-context { background: var(--surface-sunken); }
}

.note-title { font-size: 15.5px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 6px; padding-right: 26px; }
.note-body { font-size: 13.5px; line-height: 1.6; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }

/* ---- The 1.5in tile ----------------------------------------------------
   Everything in here is a summary. The note's text is clamped, its media is
   reduced to a strip of counts, and the whole square is one big button that
   opens the note in the viewer below. */
.note-view-grid {
  aspect-ratio: 1 / 1;
  cursor: pointer;
}
.note-view-grid:hover { transform: translateY(-4px) scale(1.02); }
.note-view-grid:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.note-view-grid .note-card-body {
  padding: 9px 10px; overflow: hidden; min-height: 0;
  display: flex; flex-direction: column;
}
.note-view-grid .note-context {
  font-size: 9.5px; padding: 2px 7px; margin-bottom: 5px;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block; flex: 0 0 auto;
}
.note-view-grid .note-title {
  font-size: 12px; margin-bottom: 3px; padding-right: 16px; line-height: 1.28;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  flex: 0 0 auto;
}
.note-view-grid .note-body {
  font-size: 10.8px; line-height: 1.4;
  /* An exact multiple of the line height, so the third line is never sliced
     through the middle by the tile's own overflow. */
  flex: 0 1 auto; max-height: calc(1.4em * 3);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.note-view-grid .note-detail { display: none; }   /* lives in the viewer, not the tile */
.note-view-grid .note-thumb-share { display: none; }
.note-view-grid .note-card-footer { padding: 4px 9px; }
.note-view-grid .note-meta { font-size: 9.5px; gap: 4px; }
.note-view-grid .note-byline { display: none; }   /* no room at 1.5in */
/* !important because Bootstrap's own .d-flex utility carries one, and the
   actions span uses it — without this the buttons stay and blow the tile out. */
.note-view-grid .note-actions { display: none !important; }
.note-view-grid .note-pin { top: 8px; right: 8px; width: 18px; height: 18px; font-size: 9px; }
/* Keep the context pill clear of the pin badge on pinned tiles. */
.note-view-grid .note-pin + .note-card-body .note-context { margin-right: 22px; }
/* A tile is one control, so nothing inside it should steal the click. */
.note-view-grid .note-card-body * { pointer-events: none; }

/* List view is the roomy one — nothing is hidden, media plays in place. */
.note-view-list .note-chips { display: none; }
.note-view-list .note-detail { display: block; }

/* What a tile shows instead of the media itself. */
/* Pushed to the foot of the tile so every card's counts line up. */
.note-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; flex: 0 0 auto; }
.note-view-grid .note-chips { margin-top: auto; padding-top: 5px; overflow: hidden; max-height: 21px; }
.note-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 6px; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--card-accent) 15%, #fff);
  border: 1px solid color-mix(in srgb, var(--card-accent) 24%, transparent);
  font-size: 9.5px; font-weight: 700; color: var(--text-2); white-space: nowrap;
}
@supports not (background: color-mix(in srgb, red 10%, white)) {
  .note-chip { background: var(--surface-sunken); border-color: var(--hairline); }
}

/* ---- The viewer a tile opens into ---- */
.note-viewer .modal-content {
  --card-accent: var(--ios-orange);
  border: 0; border-radius: var(--radius-lg); overflow: hidden;
}
.note-viewer .modal-header {
  align-items: flex-start; gap: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--card-accent) 20%, transparent);
  background: linear-gradient(160deg, color-mix(in srgb, var(--card-accent) 16%, #fff), #fff 75%);
}
.note-viewer-title {
  font-size: 19px; font-weight: 750; letter-spacing: -.025em; margin: 4px 0 0;
  word-break: break-word;
}
.note-viewer .modal-body { max-height: min(70vh, 640px); overflow-y: auto; }
.note-viewer .note-body { font-size: 14px; }
.note-viewer .note-media-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.note-viewer .note-video { max-height: 420px; }
.note-viewer .modal-footer {
  justify-content: space-between;
  border-top: 1px solid color-mix(in srgb, var(--card-accent) 18%, transparent);
  background: color-mix(in srgb, var(--card-accent) 7%, #fff);
}
@supports not (background: color-mix(in srgb, red 10%, white)) {
  .note-viewer .modal-header { background: var(--surface); border-bottom: 1px solid var(--hairline); }
  .note-viewer .modal-footer { background: var(--surface-2); border-top: 1px solid var(--hairline); }
}
.note-viewer-empty { color: var(--text-muted); font-size: 13px; }

.note-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 12px; }
.note-thumb {
  position: relative; display: block;
  aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  background: var(--surface-sunken); border: 1px solid var(--hairline);
  transition: transform var(--t-fast) var(--spring), box-shadow var(--t-fast) var(--ease);
}
.note-thumb:hover { transform: scale(1.05); box-shadow: var(--shadow-md); z-index: 2; }
.note-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.note-thumb-broken::after {
  content: '\\F470'; font-family: 'bootstrap-icons';
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--text-muted); font-size: 22px;
}
.note-link-badge {
  position: absolute; bottom: 3px; right: 3px;
  width: 18px; height: 18px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; font-size: 10px;
}

/* A voice note is one short line, not a panel — most notes have several. */
.note-audio {
  display: flex; align-items: center; gap: 8px;
  margin-top: 7px; padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken); border: 1px solid var(--hairline-2);
}
.note-audio > i { font-size: 15px; color: var(--ios-purple); flex: 0 0 auto; }
.note-audio-main { min-width: 0; flex: 1 1 auto; }
.note-audio audio { width: 100%; height: 26px; display: block; }
.note-audio .note-file-name { font-size: 10.5px; margin-bottom: 1px; }
.note-file-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.note-video { width: 100%; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: #000; max-height: 240px; display: block; }

/* Every attachment gets the same row: what it is, its name, its actions. */
.note-file {
  margin-top: 8px; border-radius: var(--radius-sm);
  border: 1px solid var(--hairline-2); background: var(--surface-sunken);
  overflow: hidden;
}
.note-file-bar { display: flex; align-items: center; gap: 8px; padding: 6px 9px; min-width: 0; }
.note-file-bar .note-file-name { flex: 1 1 auto; }
.note-file-icon { font-size: 17px; color: var(--brand); flex: 0 0 auto; }
.note-file-btns { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.note-file-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: var(--r-pill);
  border: 1px solid var(--hairline); background: #fff;
  font-size: 11px; font-weight: 650; color: var(--text-2); cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.note-file-btn:hover { color: var(--brand); border-color: var(--brand); box-shadow: var(--shadow-sm); }
.note-file-btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.note-file-btn-icon { padding: 3px 7px; }
.note-link-chip { display: inline-flex; align-items: center; gap: 4px; }

/* Share sits on the photo itself, since a thumbnail has no room for a row. */
.note-thumb-share {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 10px;
  opacity: 0; transition: opacity var(--t-fast) var(--ease);
}
.note-thumb:hover .note-thumb-share,
.note-thumb:focus-within .note-thumb-share { opacity: 1; }

/* ---- A file opened inside the note window ---- */
.note-viewer-preview { display: flex; flex-direction: column; gap: 10px; }
.note-preview-bar { display: flex; align-items: center; gap: 10px; min-width: 0; }
.note-preview-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--hairline); background: #fff;
  font-size: 12.5px; font-weight: 650; color: var(--text-2); cursor: pointer;
  flex: 0 0 auto;
}
.note-preview-back:hover { color: var(--brand); border-color: var(--brand); }
.note-preview-name {
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.note-preview-stage {
  display: grid; place-items: center;
  background: var(--surface-sunken); border-radius: var(--radius-sm);
  padding: 10px; min-height: 220px;
}
.note-preview-img   { max-width: 100%; max-height: 60vh; border-radius: 8px; display: block; }
.note-preview-video { width: 100%; max-height: 60vh; border-radius: 8px; background: #000; }
.note-preview-audio { width: 100%; }
.note-preview-pdf   { width: 100%; height: 60vh; border: 0; border-radius: 8px; background: #fff; }
.note-preview-none  { text-align: center; color: var(--text-2); font-size: 13px; padding: 30px 10px; }
.note-preview-none i { font-size: 34px; color: var(--text-muted); display: block; margin-bottom: 8px; }
.note-preview-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Confirmation for a copied share link. */
.pms-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px);
  z-index: 2000; padding: 10px 18px; border-radius: var(--r-pill);
  background: rgba(28,28,30,.94); color: #fff; font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none;
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}
.pms-toast.show { opacity: 1; transform: translate(-50%, 0); }

.note-files, .note-links { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.note-file-chip {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%; padding: 6px 11px;
  border-radius: var(--r-pill);
  background: var(--surface-sunken); border: 1px solid var(--hairline);
  font-size: 12px; color: var(--text-2);
  transition: all var(--t-fast) var(--ease);
}
.note-file-chip:hover { background: #fff; color: var(--brand); box-shadow: var(--shadow-sm); }
.note-file-chip .text-truncate { max-width: 190px; }
.note-ext-tag {
  font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 1px 6px; border-radius: var(--r-pill);
  background: rgba(0,122,255,.14); color: var(--ios-blue-dk);
}

.note-card-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 14px;
  border-top: 1px solid color-mix(in srgb, var(--card-accent) 18%, transparent);
  background: color-mix(in srgb, var(--card-accent) 7%, #fff);
}
@supports not (background: color-mix(in srgb, red 10%, white)) {
  .note-card-footer { background: var(--surface-2); border-top: 1px solid var(--hairline); }
}
.note-meta { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* List view: wider, roomier, media laid out horizontally. */
.note-view-list .note-card-body { padding: 16px 20px; }
.note-view-list .note-title { font-size: 16.5px; }
.note-view-list .note-media-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }

.note-scope-banner {
  padding: 9px 13px; margin-bottom: 15px;
  border-radius: var(--radius-sm);
  background: rgba(0,122,255,.08);
  border: 1px dashed rgba(0,122,255,.32);
  font-size: 12.5px; color: var(--text-2);
}

.note-color-row { display: flex; gap: 7px; flex-wrap: wrap; }
.note-color-opt { cursor: pointer; }
.note-color-opt input { position: absolute; opacity: 0; pointer-events: none; }
.note-color-opt span {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 50%;
  background: var(--surface-sunken);
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px var(--hairline);
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  transition: transform var(--t-fast) var(--spring), border-color var(--t-fast) var(--ease);
}
.note-color-opt:hover span { transform: scale(1.1); }
.note-color-opt input:checked + span { border-color: var(--text-main); transform: scale(1.12); }

/* ==========================================================================
   14. Attachments & media cards
   ========================================================================== */
.attachment-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }

.media-card {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--hairline-2);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform var(--t-med) var(--spring), box-shadow var(--t-med) var(--ease);
}
.media-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.media-card-preview {
  position: relative;
  aspect-ratio: 16 / 10;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #f4f4f8, #e9e9f0);
  overflow: hidden;
}
.media-card-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-card-bigicon { font-size: 42px; }
.media-card-preview.type-pdf      .media-card-bigicon { color: var(--ios-red); }
.media-card-preview.type-document .media-card-bigicon { color: var(--ios-blue); }
.media-card-preview.type-audio    .media-card-bigicon { color: var(--ios-purple); }
.media-card-preview.type-other    .media-card-bigicon { color: var(--text-muted); }
.media-card-badge {
  position: absolute; top: 9px; left: 9px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: rgba(0,0,0,.55);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: #fff; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.media-card-expand {
  position: absolute; top: 9px; right: 9px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(255,255,255,.85);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--text-main); font-size: 13px;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--spring);
}
.media-card:hover .media-card-expand { opacity: 1; }
.media-card-expand:hover { transform: scale(1.12); }
/* The full-bleed click target that opens the viewer sits under the corner
   button, so both work and the whole thumbnail is clickable. */
.media-card-openhint { z-index: 1; }
.media-card-expand   { z-index: 2; }
.media-card-preview:hover .media-card-openhint[style*="zoom-in"] { background: rgba(0,0,0,.04); }
.media-card-body { padding: 12px 14px; flex: 1; }
.media-card-name { font-size: 13px; font-weight: 600; word-break: break-word; line-height: 1.35; }
.media-card-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.media-card-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px;
  border-top: 1px solid var(--hairline);
  background: var(--surface-2);
}
.media-card-openhint { font-size: 11px; color: var(--text-muted); }
.media-card-audio-player { width: 100%; }

.attachment-tile {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  font-size: 13px;
  transition: background var(--t-fast) var(--ease);
}
.attachment-tile:hover { background: #ededf2; }

/* ==========================================================================
   15. Upload progress & file chips
   ========================================================================== */
.upload-progress-wrap { display: flex; flex-direction: column; gap: 9px; margin-top: 11px; }
.upload-progress-item { font-size: 12px; }
.upload-progress-track { height: 6px; border-radius: var(--r-pill); background: rgba(120,120,128,.16); overflow: hidden; margin-top: 4px; }
.upload-progress-bar { height: 100%; width: 0; border-radius: var(--r-pill); background: linear-gradient(90deg, var(--ios-blue), var(--ios-teal)); transition: width .25s var(--ease); }
.upload-progress-item.done   .upload-progress-bar { background: linear-gradient(90deg, var(--ios-green), var(--ios-mint)); }
.upload-progress-item.failed .upload-progress-bar { background: linear-gradient(90deg, var(--ios-red), #ff7a70); }

.filechip-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.filechip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 6px 5px 11px;
  border-radius: var(--r-pill);
  background: rgba(0,122,255,.10);
  color: var(--ios-blue-dk);
  font-size: 12px; font-weight: 500;
  max-width: 100%;
  animation: chipIn .25s var(--spring);
}
@keyframes chipIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: none; } }
.filechip-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filechip-size { opacity: .65; font-size: 11px; }
.filechip-remove {
  width: 19px; height: 19px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: rgba(0,122,255,.2);
  color: var(--ios-blue-dk);
  font-size: 11px; cursor: pointer; line-height: 1;
  transition: all var(--t-fast) var(--ease);
}
.filechip-remove:hover { background: var(--ios-red); color: #fff; transform: rotate(90deg); }

/* ==========================================================================
   16. Chat
   ========================================================================== */
.chat-panel {
  display: flex; flex-direction: column;
  height: 560px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--hairline-2);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.chat-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 11px; background: var(--surface-2); }

.chat-bubble {
  max-width: 74%;
  padding: 9px 14px;
  border-radius: 19px;
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: var(--shadow-xs);
  animation: bubbleIn .3s var(--spring);
  word-break: break-word;
}
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
/* iMessage geometry: own messages right + blue, others left + grey. */
.chat-bubble.me       { align-self: flex-end;   background: linear-gradient(180deg, #2b9bff, var(--ios-blue)); color: #fff; border-bottom-right-radius: 6px; }
.chat-bubble.them     { align-self: flex-start; background: #e9e9ee; color: var(--text-main); border-bottom-left-radius: 6px; }
.chat-bubble.external { align-self: flex-start; background: linear-gradient(180deg, #ffb340, var(--ios-orange)); color: #fff; border-bottom-left-radius: 6px; }
.chat-meta { font-size: 10.5px; opacity: .72; margin-top: 4px; }

.chat-input-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 13px;
  border-top: 1px solid var(--hairline);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
.chat-attach-preview { padding: 0 13px; }

.btn-record {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: rgba(120,120,128,.14);
  color: var(--text-2); font-size: 15px;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.btn-record:hover { background: rgba(120,120,128,.22); }
.btn-record.recording { background: var(--ios-red); color: #fff; animation: recPulse 1.4s ease-in-out infinite; }
@keyframes recPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,59,48,.5); } 50% { box-shadow: 0 0 0 9px rgba(255,59,48,0); } }
.recording-timer { font-size: 12px; font-weight: 600; color: var(--ios-red); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   17. Modals — iOS sheets
   ========================================================================== */
.modal-content {
  border: 0;
  border-radius: var(--r-xl);
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  backdrop-filter: blur(34px) saturate(180%);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.modal-header { border-bottom: 1px solid var(--hairline); padding: 16px 20px; }
.modal-header .modal-title { font-size: 16.5px; font-weight: 700; letter-spacing: -.02em; }
.modal-footer { border-top: 1px solid var(--hairline); padding: 13px 20px; gap: 8px; }
.modal-body { padding: 20px; }

/* ==========================================================================
   18. Login
   ========================================================================== */
.login-wrap {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 620px at 12% 0%,   rgba(88,86,214,.34), transparent 58%),
    radial-gradient(760px 560px at 92% 8%,   rgba(0,199,190,.30), transparent 55%),
    radial-gradient(820px 620px at 50% 104%, rgba(255,45,85,.24), transparent 58%),
    linear-gradient(160deg, #0f1024, #1b1b3a 55%, #10233a);
}
.login-card {
  width: 100%; max-width: 400px;
  padding: 34px 32px;
  border-radius: var(--r-xl);
  background: rgba(255,255,255,.9);
  -webkit-backdrop-filter: blur(34px) saturate(180%);
  backdrop-filter: blur(34px) saturate(180%);
  border: 1px solid rgba(255,255,255,.55);
  box-shadow: var(--shadow-xl);
  animation: cardRise .55s var(--spring);
}
@keyframes cardRise { from { opacity: 0; transform: translateY(22px) scale(.97); } to { opacity: 1; transform: none; } }
.login-logo {
  width: 60px; height: 60px;
  display: grid; place-items: center;
  margin: 0 auto 16px;
  border-radius: 17px;
  font-size: 27px; color: #fff;
  background: linear-gradient(145deg, var(--ios-blue), var(--ios-indigo));
  box-shadow: 0 12px 26px rgba(0,122,255,.4), inset 0 1px 0 rgba(255,255,255,.4);
}

/* ==========================================================================
   19. Misc components
   ========================================================================== */
.assignment-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--hairline-2);
  box-shadow: var(--shadow-md);
}
.assignment-card dt { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-top: 13px; }
.assignment-card dd { font-size: 14px; margin: 3px 0 0; color: var(--text-main); }

.fast-step-num {
  width: 24px; height: 24px; flex: 0 0 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--ios-blue), var(--ios-indigo));
  color: #fff; font-size: 12px; font-weight: 700;
  box-shadow: 0 3px 8px rgba(0,122,255,.35);
}

.tracking-box {
  padding: 15px;
  border-radius: var(--radius);
  background: rgba(0,122,255,.06);
  border: 1px dashed rgba(0,122,255,.3);
  word-break: break-all;
}

/* ---- Public tracking page ---- */
.track-shell { min-height: 100vh; padding: 32px 18px 64px; background: var(--bg-app); }
.track-header { max-width: 760px; margin: 0 auto 20px; text-align: center; }
.track-card {
  max-width: 760px; margin: 0 auto 16px;
  padding: 24px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--hairline-2);
  box-shadow: var(--shadow-lg);
}
.track-status-track { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.track-step {
  flex: 1; min-width: 118px;
  padding: 13px 11px;
  border-radius: var(--radius);
  background: var(--surface-sunken);
  text-align: center;
  font-size: 12px;
  border: 1px solid var(--hairline-2);
  transition: all var(--t-med) var(--ease);
}
.track-step .dot {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  margin: 0 auto 7px;
  background: rgba(120,120,128,.2);
  color: var(--text-muted); font-size: 12px;
}
.track-step.done { background: rgba(52,199,89,.10); border-color: rgba(52,199,89,.3); }
.track-step.done .dot { background: var(--ios-green); color: #fff; box-shadow: 0 3px 9px rgba(52,199,89,.4); }
.track-step.current { background: rgba(0,122,255,.10); border-color: rgba(0,122,255,.35); box-shadow: var(--shadow-sm); }
.track-step.current .dot { background: var(--ios-blue); color: #fff; box-shadow: 0 3px 9px rgba(0,122,255,.42); }
.track-step .label { font-weight: 600; color: var(--text-2); }

/* ---- Printable statement ---- */
.statement-toolbar { max-width: 860px; margin: 0 auto 14px; display: flex; justify-content: flex-end; gap: 8px; }
.statement-sheet {
  max-width: 860px; margin: 0 auto;
  padding: 38px 42px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.statement-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; border-bottom: 2px solid var(--text-main); padding-bottom: 14px; margin-bottom: 18px; }
.statement-meta { font-size: 12px; color: var(--text-2); text-align: right; }
.statement-body { font-size: 13px; }
.statement-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 12.5px; }
.statement-table th, .statement-table td { padding: 8px 10px; border: 1px solid var(--hairline); text-align: left; }
.statement-table th { background: var(--surface-sunken); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.statement-totals { margin-top: 16px; display: flex; justify-content: flex-end; }
.statement-totals table td { padding: 6px 14px; font-size: 13px; }
.statement-footer { margin-top: 34px; padding-top: 14px; border-top: 1px solid var(--hairline); font-size: 11px; color: var(--text-muted); }

.print-only { display: none; }

/* ==========================================================================
   20. Responsive
   ========================================================================== */
@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-100%); box-shadow: var(--shadow-xl); }
  .app-sidebar.open { transform: none; }
  .app-main { margin-left: 0; }
  .app-content { padding: 18px 15px 56px; }
  .app-topbar { padding: 0 15px; }
  .topbar-title { font-size: 17px; }
  .project-grid, .record-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 11px; }
  .attachment-grid { grid-template-columns: 1fr; }
  .finance-hero-value { font-size: 32px; }
  .statement-sheet { padding: 22px 18px; }
  .chat-bubble { max-width: 88%; }
}

@media (max-width: 575.98px) {
  .project-grid, .record-grid { grid-template-columns: 1fr 1fr; }
  .image-slot-grid { grid-template-columns: 1fr; }
  .finance-summary-row { grid-template-columns: 1fr; }
  .id-card-thumb { width: 100%; }
}

/* Respect the OS "reduce motion" setting — an iOS accessibility staple. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ==========================================================================
   21. Print
   ========================================================================== */
@media print {
  body { background: #fff; }
  .app-sidebar, .app-topbar, .no-print, .statement-toolbar { display: none !important; }
  .app-main { margin-left: 0; }
  .app-content { padding: 0; }
  .print-only { display: block; }
  .statement-sheet { box-shadow: none; border-radius: 0; padding: 0; max-width: none; }
  .card-panel, .finance-card, .stat-card { box-shadow: none; border: 1px solid #ddd; }
}

/* ==========================================================================
   Accounts vault — credentials.php

   The renewal date is the reason this screen exists, so it gets its own
   column on the right and a colour rail down the left that says at a glance
   how urgent each row is.
   ========================================================================== */
.cred-intro {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.cred-intro p { max-width: 620px; font-size: 12.5px; }

.cred-list { display: flex; flex-direction: column; gap: 10px; }

.cred-row {
  --cred-accent: var(--ios-teal);
  display: flex; align-items: flex-start; gap: 14px;
  padding: 12px 14px 12px 18px;
  background: var(--surface);
  border: 1px solid var(--hairline-2);
  border-left: 5px solid var(--cred-accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.cred-expired { --cred-accent: var(--ios-red); background: linear-gradient(90deg, rgba(255,59,48,.06), var(--surface) 40%); }
.cred-today,
.cred-soon    { --cred-accent: var(--ios-orange); background: linear-gradient(90deg, rgba(255,149,0,.06), var(--surface) 40%); }
.cred-watch   { --cred-accent: #ffcc00; }
.cred-ok      { --cred-accent: var(--ios-green); }
.cred-none    { --cred-accent: #9aa4bf; }

.cred-icon {
  width: 38px; height: 38px; flex: 0 0 38px;
  display: grid; place-items: center; border-radius: 11px;
  background: color-mix(in srgb, var(--cred-accent) 16%, #fff);
  color: var(--cred-accent); font-size: 17px;
}
@supports not (background: color-mix(in srgb, red 10%, white)) {
  .cred-icon { background: var(--surface-sunken); }
}

.cred-main { flex: 1 1 auto; min-width: 0; }
.cred-title {
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  font-size: 14.5px; font-weight: 700; letter-spacing: -.015em; color: var(--text-main);
}
.cred-type {
  font-size: 10.5px; font-weight: 650; color: var(--text-2);
  padding: 1px 8px; border-radius: var(--r-pill); background: var(--surface-sunken);
}

.cred-fields {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 4px 18px; margin: 8px 0 0;
}
.cred-fields > div { min-width: 0; }
.cred-fields dt { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-2); }
.cred-fields dd {
  margin: 0; font-size: 12.5px; color: var(--text-main);
  display: flex; align-items: center; gap: 5px; min-width: 0;
}
.cred-fields dd > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cred-fields a { word-break: break-all; }

/* A password is monospaced so 1/l and 0/O can be told apart when read aloud. */
.cred-secret { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; letter-spacing: .02em; }
.cred-secret.revealed { color: var(--ios-red-dk); font-weight: 600; }
.cred-unreadable { font-size: 12px; color: var(--ios-red-dk); }

.cred-mini {
  flex: 0 0 auto;
  width: 24px; height: 24px; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--hairline); border-radius: 7px;
  background: #fff; color: var(--text-2); font-size: 11px; cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.cred-mini:hover { color: var(--brand); border-color: var(--brand); }
.cred-mini:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.cred-note { font-size: 12px; color: var(--text-2); margin-top: 7px; line-height: 1.5; }

.cred-expiry {
  flex: 0 0 auto; text-align: right; min-width: 132px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
}
.cred-expiry-date { font-size: 13.5px; font-weight: 750; letter-spacing: -.02em; color: var(--text-main); }
.cred-expiry-state { font-size: 11px; font-weight: 650; color: var(--cred-accent); }
.cred-expired .cred-expiry-state,
.cred-soon .cred-expiry-state,
.cred-today .cred-expiry-state { color: var(--cred-accent); }
.cred-actions { display: flex; gap: 5px; margin-top: 4px; }

@media (max-width: 720px) {
  .cred-row { flex-wrap: wrap; }
  .cred-expiry { width: 100%; text-align: left; align-items: flex-start; border-top: 1px solid var(--hairline-2); padding-top: 8px; }
}

/* ---- Printing --------------------------------------------------------
   Print is a first-class output here: people pin this list on a wall or put
   it in a drawer. Everything that is only useful on screen goes away, and
   rows are kept from splitting across pages.
   -------------------------------------------------------------------- */
.print-only { display: none; }

@media print {
  .app-sidebar, .app-topbar, .no-print, .modal, .modal-backdrop,
  .skip-link, .pms-toast { display: none !important; }
  .app-main, .app-content { margin: 0 !important; padding: 0 !important; }
  body { background: #fff !important; }

  .print-only { display: block; }
  .print-head h2 { font-size: 16pt; margin: 0 0 2px; }
  .print-head p  { font-size: 9pt; color: #555; margin: 0 0 12px; }

  .stat-strip { display: none !important; }
  .cred-row {
    break-inside: avoid; page-break-inside: avoid;
    box-shadow: none !important; background: #fff !important;
    border: 1px solid #ccc !important; border-left-width: 4px !important;
    margin-bottom: 6px;
  }
  .cred-secret .cred-dots { font-family: inherit; }   /* dots, not the password */
  a[href]::after { content: ''; }                      /* no URL footnotes */
}

/* ==========================================================================
   Contact list — contacts.php
   ========================================================================== */

/* Categories as chips: the filter and the overview in one row. */
.cat-strip { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.cat-chip {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 34px; padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--hairline); background: var(--surface);
  font-size: 12.5px; font-weight: 600; color: var(--text-2); text-decoration: none;
  transition: all var(--t-fast) var(--ease);
}
.cat-chip:hover { color: var(--text-main); box-shadow: var(--shadow-sm); }
.cat-chip.active { border-color: var(--brand); color: var(--brand); box-shadow: var(--shadow-sm); }
.cat-chip:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.cat-chip b {
  font-size: 11px; font-weight: 750; color: var(--text-2);
  background: var(--surface-sunken); border-radius: var(--r-pill); padding: 1px 7px;
}
.cat-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: var(--cat, var(--brand)); }

.cat-manage { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cat-manage li {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  background: var(--surface-sunken); border: 1px solid var(--hairline-2);
  font-size: 12.5px;
}
.cat-manage li form { margin: 0; }

/* Cards by default; the same markup runs as rows in list view. */
.contact-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px; align-items: start;
}
.contact-list { display: flex; flex-direction: column; gap: 10px; }

.contact-card {
  --card-accent: var(--ios-blue);
  display: flex; flex-direction: column;
  padding: 13px 15px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--card-accent) 9%, #fff), #fff 55%);
  border: 1px solid color-mix(in srgb, var(--card-accent) 20%, transparent);
  border-left: 4px solid var(--card-accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
@supports not (background: color-mix(in srgb, red 10%, white)) {
  .contact-card { background: var(--surface); border-color: var(--hairline); }
}

.contact-head { display: flex; align-items: flex-start; gap: 10px; }
.contact-avatar {
  width: 44px; height: 44px; flex: 0 0 44px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--card-accent); color: #fff;
  font-size: 17px; font-weight: 750;
}
/* The 1x1 photograph. Square, not round — it is a passport photo, and a
   circular mask would crop the very head-and-shoulders framing that makes it
   a passport photo. */
.contact-photo {
  width: 44px; height: 44px; flex: 0 0 44px;
  display: block; border-radius: 9px; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--card-accent) 35%, transparent);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast) var(--spring), box-shadow var(--t-fast) var(--ease);
}
.contact-photo:hover { transform: scale(1.08); box-shadow: var(--shadow-md); }
.contact-photo:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.contact-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
@supports not (border-color: color-mix(in srgb, red 10%, white)) {
  .contact-photo { border-color: var(--hairline); }
}
@media print {
  .contact-photo { width: 40px; height: 40px; box-shadow: none; }
}
.contact-name {
  font-size: 14.5px; font-weight: 700; letter-spacing: -.015em; margin: 0;
  color: var(--text-main); word-break: break-word;
}
.contact-star { color: var(--ios-orange); font-size: 11px; }
.contact-sub { font-size: 11.5px; color: var(--text-2); }
.contact-cat {
  flex: 0 0 auto; font-size: 10px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--card-accent);
  background: color-mix(in srgb, var(--card-accent) 12%, #fff);
  border-radius: var(--r-pill); padding: 3px 9px;
}
@supports not (background: color-mix(in srgb, red 10%, white)) {
  .contact-cat { background: var(--surface-sunken); }
}

.contact-lines { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.contact-line {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12.5px; color: var(--text-main); min-width: 0;
}
.contact-line > i { color: var(--card-accent); font-size: 12px; margin-top: 2px; flex: 0 0 14px; }
.contact-line a { word-break: break-word; }
.contact-line-block { color: var(--text-2); line-height: 1.5; }

.contact-cards { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.contact-card-img {
  position: relative; display: block;
  width: 148px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--hairline); background: var(--surface-sunken);
  transition: transform var(--t-fast) var(--spring), box-shadow var(--t-fast) var(--ease);
}
.contact-card-img:hover { transform: scale(1.03); box-shadow: var(--shadow-md); }
.contact-card-img:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.contact-card-img img { width: 100%; display: block; aspect-ratio: 85 / 55; object-fit: cover; }
.contact-card-side {
  position: absolute; left: 5px; bottom: 5px;
  padding: 1px 7px; border-radius: var(--r-pill);
  background: rgba(0,0,0,.6); color: #fff; font-size: 9.5px; font-weight: 700;
}

.contact-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 11px; padding-top: 9px;
  border-top: 1px solid color-mix(in srgb, var(--card-accent) 16%, transparent);
}
@supports not (border-top-color: color-mix(in srgb, red 10%, white)) {
  .contact-foot { border-top-color: var(--hairline-2); }
}
.contact-tools { display: flex; gap: 5px; }
.contact-tools form { margin: 0; }

/* List view: the same card laid out wide, with the cards on the right. */
@media (min-width: 861px) {
  .contact-list .contact-card {
    display: grid; align-items: start; gap: 4px 18px;
    grid-template-columns: minmax(200px, 1.1fr) minmax(240px, 1.6fr) auto;
    grid-template-areas: "head lines cards" "foot lines cards";
  }
  .contact-list .contact-head   { grid-area: head; }
  .contact-list .contact-lines  { grid-area: lines; margin-top: 0; }
  .contact-list .contact-cards  { grid-area: cards; margin-top: 0; flex-direction: column; }
  .contact-list .contact-card-img { width: 132px; }
  .contact-list .contact-foot   { grid-area: foot; border-top: 0; padding-top: 0; margin-top: 8px; justify-content: flex-start; gap: 10px; }
  .contact-list .contact-cat    { display: none; }   /* the category is the filter you are already in */
}

@media print {
  .cat-strip { display: none !important; }
  .contact-grid { display: block !important; }
  .contact-card {
    break-inside: avoid; page-break-inside: avoid;
    background: #fff !important; box-shadow: none !important;
    border: 1px solid #ccc !important; margin-bottom: 8px;
  }
  .contact-card-img { width: 120px !important; }
}

/* ==========================================================================
   One contact's profile — contact_view.php
   ========================================================================== */
.contact-card { position: relative; }   /* anchors the stretched link */
/* Everything you might actually want to click sits above the card overlay. */
.contact-card .contact-photo,
.contact-card .contact-name a,
.contact-card .contact-line a,
.contact-card .contact-card-img,
.contact-card .contact-tools { position: relative; z-index: 2; }
.contact-name a { color: inherit; text-decoration: none; }
.contact-card:hover .contact-name a { color: var(--card-accent); }

.contact-profile {
  --card-accent: var(--ios-blue);
  padding: 18px 20px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--card-accent) 10%, #fff), #fff 55%);
  border: 1px solid color-mix(in srgb, var(--card-accent) 20%, transparent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
@supports not (background: color-mix(in srgb, red 10%, white)) {
  .contact-profile { background: var(--surface); border-color: var(--hairline); }
}

.cp-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.cp-photo {
  width: 96px; height: 96px; flex: 0 0 96px;
  display: block; border-radius: 14px; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--card-accent) 35%, transparent);
  box-shadow: var(--shadow-md);
}
.cp-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cp-photo-empty {
  display: grid; place-items: center;
  background: var(--card-accent); color: #fff; font-size: 38px; font-weight: 750;
}
.cp-name { font-size: 22px; font-weight: 750; letter-spacing: -.025em; margin: 0 0 2px; }
.cp-sub { font-size: 13px; color: var(--text-2); }

.cp-quick { display: flex; flex-wrap: wrap; gap: 7px; }
.cp-quick-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border-radius: var(--r-pill);
  border: 1px solid var(--hairline); background: #fff;
  font-size: 12.5px; font-weight: 650; color: var(--text-2); text-decoration: none;
  transition: all var(--t-fast) var(--ease);
}
.cp-quick-btn:hover { color: var(--brand); border-color: var(--brand); box-shadow: var(--shadow-sm); }
.cp-quick-btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.cp-fields {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px 22px; margin: 18px 0 0;
  padding-top: 16px; border-top: 1px solid color-mix(in srgb, var(--card-accent) 16%, transparent);
}
@supports not (border-top-color: color-mix(in srgb, red 10%, white)) {
  .cp-fields { border-top-color: var(--hairline-2); }
}
.cp-fields dt {
  display: flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-2); margin-bottom: 2px;
}
.cp-fields dt i { color: var(--card-accent); font-size: 11px; }
.cp-fields dd { margin: 0; font-size: 13px; color: var(--text-main); line-height: 1.55; word-break: break-word; }

.cp-section {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-2); margin: 20px 0 8px;
}
.contact-card-lg { width: 240px; }

/* ---- Attachments on a contact ---- */
.cf-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 9px 11px; margin-bottom: 10px;
  background: var(--surface-sunken); border: 1px solid var(--hairline-2);
  border-radius: var(--radius-sm);
}
.cf-selectall { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 650; cursor: pointer; margin: 0; }
.cf-count { font-size: 12px; color: var(--text-2); }
.cf-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.cf-hint {
  font-size: 11.5px; color: var(--text-2); line-height: 1.5;
  background: rgba(0,122,255,.06); border: 1px dashed rgba(0,122,255,.3);
  border-radius: var(--radius-sm); padding: 8px 11px; margin-bottom: 10px;
}

.cf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 9px; }
.cf-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; margin: 0;
  background: var(--surface); border: 1px solid var(--hairline-2);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.cf-item:hover { border-color: var(--hairline); box-shadow: var(--shadow-sm); }
.cf-item.cf-selected { border-color: var(--brand); background: rgba(0,122,255,.05); }
.cf-check { flex: 0 0 auto; }
.cf-body { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1 1 auto; }
.cf-thumb {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: grid; place-items: center; overflow: hidden;
  border-radius: 8px; background: var(--surface-sunken);
  color: var(--brand); font-size: 18px;
}
.cf-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cf-meta { min-width: 0; }
.cf-name { display: block; font-size: 12.5px; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-sub  { display: block; font-size: 11px; color: var(--text-2); }
.cf-tools { display: flex; gap: 4px; flex: 0 0 auto; }
.cf-tools form { margin: 0; }

@media print {
  .cf-bar, .cf-hint, .cf-tools { display: none !important; }
  .cf-item { break-inside: avoid; }
  .contact-profile { box-shadow: none !important; background: #fff !important; border: 1px solid #ccc !important; }
}
