/* ============================================================
   InkFlow CRM — design system
   Dark, premium tattoo-studio aesthetic.
   ============================================================ */

:root {
  /* color — neutral ramp */
  --bg:        #0C0C0F;
  --surface:   #141419;
  --surface-2: #1A1A21;
  --surface-3: #22222B;
  --border:    #26262E;
  --border-2:  #33333E;

  --text:   #EDEDF0;
  --text-2: #A2A2AE;
  --text-3: #71717E;

  /* accent */
  --accent:       #E5484D;
  --accent-hover: #F2555A;
  --accent-soft:  rgba(229, 72, 77, .12);

  /* semantics */
  --success: #30A46C;  --success-soft: rgba(48, 164, 108, .14);
  --warning: #FFB224;  --warning-soft: rgba(255, 178, 36, .14);
  --danger:  #E5484D;  --danger-soft:  rgba(229, 72, 77, .14);
  --info:    #0091FF;  --info-soft:    rgba(0, 145, 255, .14);
  --violet:  #8E7AF0;  --violet-soft:  rgba(142, 122, 240, .14);
  --teal:    #12A594;  --teal-soft:    rgba(18, 165, 148, .14);
  --neutral: #8B8B96;  --neutral-soft: rgba(139, 139, 150, .14);

  /* type */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;

  /* radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  /* shadows (dark theme = subtle, mostly borders do the work) */
  --shadow-md: 0 4px 12px -2px rgba(0,0,0,.4), 0 2px 4px -2px rgba(0,0,0,.3);
  --shadow-lg: 0 16px 40px -8px rgba(0,0,0,.55), 0 4px 12px -4px rgba(0,0,0,.4);

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

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 8px;
}
h2 { font-size: 20px; }
h3 { font-size: 17px; }

p { margin: 0 0 12px; }
a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

::selection { background: rgba(229,72,77,.35); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #fff; padding: 8px 16px; z-index: 200;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

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

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

.content {
  padding: 24px 32px 96px;
  max-width: 1440px;
  width: 100%;
}

/* ============================================================ sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 90;
}

.sidebar-brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent);
  display: grid; place-items: center;
  color: #fff;
  flex-shrink: 0;
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-text {
  font-family: var(--font-display);
  font-weight: 700; font-size: 15px; line-height: 1.15;
  display: flex; flex-direction: column;
}
.brand-text small {
  font-size: 10px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.14em;
}
/* Long studio names: scale down so the brand stays tidy in the sidebar */
.brand-text.brand-long { font-size: 12.5px; line-height: 1.25; }
.brand-text.brand-long small { font-size: 9px; letter-spacing: 0.12em; }
.sidebar-brand.brand-long-row { padding-top: 10px; padding-bottom: 10px; }

.sidebar-close { display: none; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex; flex-direction: column; gap: 2px;
}

.nav-section {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.1em;
  padding: 16px 12px 6px;
}
.nav-section:first-child { padding-top: 4px; }

.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-weight: 500;
  font-size: 14px;
  min-height: 44px;
  transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active {
  background: var(--accent-soft);
  color: #FF8A8E;
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-link svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px;
  border-radius: 999px;
  display: grid; place-items: center;
  padding: 0 6px;
}

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.sidebar-user-meta { flex: 1; min-width: 0; line-height: 1.3; }
.sidebar-user-meta strong { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-meta span { font-size: 12px; color: var(--text-3); }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 80;
  opacity: 0;
  transition: opacity .2s ease;
}

/* ============================================================ topbar */
.topbar {
  position: sticky; top: 0;
  z-index: 50;
  display: flex; align-items: center; gap: 16px;
  height: var(--topbar-h);
  padding: 0 32px;
  background: #101014; /* opaque — no alpha, no shimmer */
  border-bottom: 1px solid var(--border);
}
.topbar-title {
  font-size: 18px; font-weight: 700; margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.hamburger { display: none; }

/* ============================================================ breadcrumb */
.breadcrumb { margin: 0 0 20px; }
.breadcrumb ol {
  list-style: none; margin: 0; padding: 0;
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  font-size: 13px;
}
.breadcrumb a { color: var(--text-3); }
.breadcrumb a:hover { color: var(--text); text-decoration: none; }
.breadcrumb span[aria-current] { color: var(--text-2); font-weight: 500; }
.bc-sep svg { width: 14px; height: 14px; color: var(--text-3); display: block; }

/* ============================================================ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body);
  font-size: 14px; font-weight: 600;
  padding: 0 18px;
  height: 42px;
  min-width: 44px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
  user-select: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: var(--surface-2); color: var(--text);
  border-color: var(--border-2);
}
.btn-ghost:hover { background: var(--surface-3); }

.btn-danger { background: var(--danger-soft); color: #FF8A8E; border-color: rgba(229,72,77,.35); }
.btn-danger:hover { background: rgba(229,72,77,.22); }

.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; }

.btn[disabled] { opacity: .5; cursor: not-allowed; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  border: none; background: transparent;
  color: var(--text-2); cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn svg { width: 20px; height: 20px; }

/* ============================================================ forms */
label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }

.input, select.input, textarea.input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  min-height: 44px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input::placeholder { color: var(--text-3); }
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23A2A2AE' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}

.field { margin-bottom: 16px; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.field .error-text { font-size: 12px; color: #FF8A8E; margin-top: 4px; }
.input.invalid { border-color: var(--danger); }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 20px; }
.form-grid .span-2 { grid-column: span 2; }

/* ============================================================ cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
}
.card + .card { margin-top: 20px; }
.card-title {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 16px;
}
.card-title h2, .card-title h3 { margin: 0; }
.card-title .sub { font-size: 13px; color: var(--text-3); font-weight: 400; margin-top: 2px; }

/* stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stats-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stat-card { min-width: 0; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-label { font-size: 13px; font-weight: 500; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.stat-label svg { width: 16px; height: 16px; color: var(--text-3); }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.stat-delta { font-size: 12px; font-weight: 600; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: #FF8A8E; }
.stat-delta.flat { color: var(--text-3); }

/* ============================================================ badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-info    { background: var(--info-soft);    color: #66B9FF; }
.badge-violet  { background: var(--violet-soft);  color: #B4A6F6; }
.badge-warning { background: var(--warning-soft); color: #FFC95C; }
.badge-teal    { background: var(--teal-soft);    color: #4CC8B9; }
.badge-success { background: var(--success-soft); color: #5BC58F; }
.badge-danger  { background: var(--danger-soft);  color: #FF8A8E; }
.badge-neutral { background: var(--neutral-soft); color: #ABABB6; }

.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* source chips */
.source-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 3px 10px 3px 5px;
  border-radius: 999px;
  white-space: nowrap;
}
.source-chip i {
  font-style: normal; font-size: 10px; font-weight: 800;
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
}
.src-meta i      { background: #0866FF; }
.src-instagram i { background: linear-gradient(45deg,#F58529,#DD2A7B,#8134AF); }
.src-website i   { background: #12A594; }
.src-google i    { background: #34A853; }
.src-walkin i    { background: #8B8B96; }
.src-referral i  { background: #FFB224; color: #1a1a1a; }
.src-tiktok i    { background: #FE2C55; }
.src-other i     { background: #55555F; }

/* avatar */
.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--av, #6E56CF);
  color: #fff;
  font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }

/* ============================================================ tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 640px;
}
table.data th {
  text-align: left;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
table.data td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s ease; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .cell-main { font-weight: 600; color: var(--text); }
table.data .cell-sub { font-size: 12px; color: var(--text-3); display: block; }
td.num, th.num { text-align: right; }

/* row link — whole row clickable */
tr.row-link { cursor: pointer; }

/* ============================================================ toolbar / filters */
.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.toolbar .grow { flex: 1; }
.toolbar .input { width: auto; min-width: 200px; }
.search-box { position: relative; }
.search-box svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-3); pointer-events: none;
}
.search-box .input { padding-left: 38px; }

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 2px;
}
.seg a, .seg button {
  border: none; background: transparent;
  color: var(--text-2);
  font-size: 13px; font-weight: 600;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  min-height: 34px;
  display: inline-flex; align-items: center;
  transition: background .15s ease, color .15s ease;
}
.seg a:hover, .seg button:hover { color: var(--text); text-decoration: none; }
.seg .on { background: var(--surface-3); color: var(--text); }

/* ============================================================ kanban */
.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 300px;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  align-items: start;
  -webkit-overflow-scrolling: touch;
}
.kanban-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 260px);
  min-height: 160px;
}
.kanban-col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 700;
}
.kanban-count {
  margin-left: auto;
  font-size: 12px; color: var(--text-3); font-weight: 600;
  background: var(--surface-2);
  padding: 1px 8px; border-radius: 999px;
}
.kanban-cards {
  padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 60px;
}
.kanban-col.drag-over .kanban-cards {
  background: var(--accent-soft);
  border-radius: 0 0 var(--r-md) var(--r-md);
}
.kcard {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 12px;
  cursor: grab;
  display: block;
  color: var(--text);
  transition: border-color .15s ease, transform .12s ease;
}
.kcard:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.kcard.dragging { opacity: .45; cursor: grabbing; }
.kcard-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.kcard-idea {
  font-size: 12px; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}
.kcard-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kcard-time { font-size: 11px; color: var(--text-3); margin-left: auto; }

/* ============================================================ calendar */
.cal-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.cal-title { font-family: var(--font-display); font-size: 19px; font-weight: 700; min-width: 180px; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--border);
  gap: 1px;
}
.cal-dow {
  background: var(--surface-2);
  padding: 8px 10px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3);
  text-align: center;
}
.cal-cell {
  background: var(--surface);
  min-height: 112px;
  padding: 8px;
  font-size: 12px;
  position: relative;
}
.cal-cell.dim { background: #101014; color: var(--text-3); }
.cal-daynum {
  font-weight: 600; font-size: 12px; color: var(--text-2);
  width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  margin-bottom: 4px;
}
.cal-cell.today .cal-daynum { background: var(--accent); color: #fff; }
.cal-evt {
  display: block;
  font-size: 11px; font-weight: 600;
  padding: 3px 7px;
  border-radius: 5px;
  margin-bottom: 3px;
  color: #fff;
  background: var(--evt, #6E56CF);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-left: 3px solid rgba(255,255,255,.35);
}
.cal-evt:hover { text-decoration: none; filter: brightness(1.15); }
.cal-more { font-size: 11px; color: var(--text-3); }

/* ============================================================ timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: '';
  position: absolute; left: 15px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border);
}
.timeline li { position: relative; padding: 0 0 20px 44px; }
.timeline li:last-child { padding-bottom: 0; }
.tl-dot {
  position: absolute; left: 6px; top: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface-3);
  border: 2px solid var(--border-2);
  display: grid; place-items: center;
}
.tl-dot svg { width: 10px; height: 10px; color: var(--text-2); }
.tl-dot.accent { background: var(--accent-soft); border-color: var(--accent); }
.tl-dot.accent svg { color: var(--accent-hover); }
.tl-head { font-size: 13px; color: var(--text-2); margin-bottom: 2px; }
.tl-head strong { color: var(--text); }
.tl-body { font-size: 14px; }
.tl-time { font-size: 12px; color: var(--text-3); }

/* ============================================================ modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 100;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 16px;
  overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  animation: modalIn .18s cubic-bezier(0,0,.2,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; }
.modal-body { padding: 24px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ============================================================ flash */
.flash {
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-size: 14px; font-weight: 500;
  margin-bottom: 16px;
  border: 1px solid;
}
.flash-success { background: var(--success-soft); color: #5BC58F; border-color: rgba(48,164,108,.3); }
.flash-error   { background: var(--danger-soft);  color: #FF8A8E; border-color: rgba(229,72,77,.3); }
.flash-info    { background: var(--info-soft);    color: #66B9FF; border-color: rgba(0,145,255,.3); }

/* ============================================================ misc */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; align-items: start; }
.grid-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
/* scrollable tables inside grid columns must not force the track wider */
.grid-2 > *, .grid-2-even > *, .grid-2 .card, .grid-2-even .card { min-width: 0; }

.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
}
.empty svg { width: 40px; height: 40px; margin-bottom: 12px; color: var(--text-3); }
.empty strong { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }
.empty p { font-size: 13px; max-width: 360px; margin: 0 auto; }

.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.list-plain li:last-child { border-bottom: none; }

.progress {
  height: 6px; border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--text-3); font-weight: 500; }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }

code.inline {
  background: var(--surface-3);
  border: 1px solid var(--border-2);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 12.5px;
  word-break: break-all;
}

.copy-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy-row code { flex: 1; }

/* ============================================================ callback toasts */
.cb-toasts {
  position: fixed;
  right: 20px; bottom: 80px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 130;
  width: min(360px, calc(100vw - 32px));
}
.cb-toast {
  background: var(--surface);
  border: 1px solid rgba(255,178,36,.55);
  border-left: 4px solid var(--warning);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 14px 16px;
  animation: cbIn .25s cubic-bezier(0,0,.2,1);
}
.cb-toast.overdue { border-color: rgba(229,72,77,.6); border-left-color: var(--accent); }
@keyframes cbIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.cb-toast-head {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 14px;
  margin-bottom: 4px;
}
.cb-toast-head .cb-when { margin-left: auto; font-size: 12px; font-weight: 600; color: #FFC95C; white-space: nowrap; }
.cb-toast.overdue .cb-when { color: #FF8A8E; }
.cb-toast-note { font-size: 12px; color: var(--text-2); margin-bottom: 10px; }
.cb-toast-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { .cb-toast { animation: none; } }

/* scroll-to-top */
.scroll-top {
  position: fixed;
  right: 20px; bottom: 20px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  display: grid; place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
  z-index: 60;
  box-shadow: var(--shadow-md);
}
.scroll-top.show { opacity: 1; pointer-events: auto; }
.scroll-top:hover { background: var(--surface-3); }
.scroll-top svg { width: 18px; height: 18px; }

/* charts */
.chart-svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.chart-legend .li { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* login */
.login-page {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(800px 400px at 80% -10%, rgba(229,72,77,.14), transparent),
    radial-gradient(600px 300px at 10% 110%, rgba(110,86,207,.12), transparent),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-brand h1 { font-size: 20px; margin: 0; }
.login-brand small { color: var(--text-3); font-size: 12px; display: block; }

/* ============================================================ topbar search */
.topbar-search { margin-left: auto; width: 260px; }
.topbar-search .input { width: 100%; min-height: 38px; padding-top: 7px; padding-bottom: 7px; }
.topbar-search + .topbar-actions { margin-left: 0; }

/* ============================================================ tasks */
.task-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: none; }
.task-check {
  appearance: none;
  width: 22px; height: 22px; margin-top: 2px;
  border: 2px solid var(--border-2);
  border-radius: 7px;
  background: var(--surface-2);
  cursor: pointer;
  flex-shrink: 0;
  display: grid; place-items: center;
  transition: background .15s ease, border-color .15s ease;
}
.task-check:checked { background: var(--success); border-color: var(--success); }
.task-check:checked::after {
  content: '';
  width: 10px; height: 6px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
}
.task-row.done .task-title { text-decoration: line-through; color: var(--text-3); }
.task-title { font-weight: 600; font-size: 14px; }
.task-meta { font-size: 12px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.task-overdue { color: #FF8A8E; font-weight: 600; }

/* quick actions */
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }

/* ============================================================ photo gallery */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.photo-item {
  position: relative;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--border-2);
  aspect-ratio: 1;
  background: var(--surface-2);
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s ease; }
.photo-item:hover img { transform: scale(1.04); }
.photo-item .photo-del {
  position: absolute; top: 6px; right: 6px;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,.65);
  color: #fff; cursor: pointer;
  display: grid; place-items: center;
  opacity: 0;
  transition: opacity .15s ease;
}
.photo-item:hover .photo-del, .photo-item .photo-del:focus-visible { opacity: 1; }
.photo-item .photo-del svg { width: 14px; height: 14px; }
.photo-item .photo-cap {
  position: absolute; inset: auto 0 0 0;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  color: #fff; font-size: 11px;
  padding: 14px 8px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ============================================================ week calendar */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}
.week-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  min-height: 180px;
  padding: 10px;
}
.week-day.today { border-color: var(--accent); }
.week-day-head { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.week-day.today .week-day-head { color: #FF8A8E; }
.week-evt {
  display: block;
  background: var(--surface-2);
  border-left: 3px solid var(--evt, #6E56CF);
  border-radius: 6px;
  padding: 6px 8px;
  margin-bottom: 6px;
  font-size: 12px;
}
.week-evt strong { display: block; font-size: 12px; }
.week-evt span { color: var(--text-3); font-size: 11px; }

/* ============================================================ signature pad */
.sig-pad {
  width: 100%; height: 180px;
  background: #FDFDFD;
  border: 2px dashed var(--border-2);
  border-radius: var(--r-md);
  touch-action: none;
  cursor: crosshair;
  display: block;
}
.sig-pad.signed { border-style: solid; border-color: var(--success); }

/* ============================================================ invoice doc */
.invoice-doc { max-width: 800px; }
.inv-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.inv-meta {
  display: grid; grid-template-columns: 1fr auto; gap: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.inv-meta > div { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.inv-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); }
.inv-totals { max-width: 320px; margin-left: auto; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.inv-totals > div { display: flex; justify-content: space-between; gap: 24px; }
.inv-totals .inv-grand {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700;
  border-top: 1px solid var(--border-2);
  padding-top: 8px; margin-top: 2px;
}
.item-row { display: grid; grid-template-columns: 1fr 70px 110px 36px; gap: 8px; margin-bottom: 8px; align-items: center; }

/* notification bell */
.bell-wrap { position: relative; }
.bell-dot {
  position: absolute; top: 6px; right: 6px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  border: 2px solid #101014;
}
.bell-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 340px; max-width: calc(100vw - 24px);
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  z-index: 120;
  display: none;
  max-height: 70vh;
  overflow-y: auto;
}
.bell-menu.open { display: block; }
.bell-menu .bm-head { padding: 12px 16px; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--border); }
.bm-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text); }
.bm-item:last-child { border-bottom: none; }
.bm-item:hover { background: var(--surface-2); text-decoration: none; }
.bm-item .bm-ico { flex-shrink: 0; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.bm-item .bm-ico svg { width: 15px; height: 15px; }
.bm-item span.sub { display: block; color: var(--text-3); font-size: 12px; }
.bm-empty { padding: 24px 16px; text-align: center; color: var(--text-3); font-size: 13px; }

/* consent print view */
.consent-doc { max-width: 760px; }
.consent-doc h2 { margin-top: 24px; }
.consent-doc .sig-img { background: #fff; border-radius: 8px; padding: 8px; max-width: min(380px, 100%); display: block; }
.check-list { list-style: none; margin: 0; padding: 0; }
.check-list li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.check-list li:last-child { border-bottom: none; }
.check-yes { color: #5BC58F; font-weight: 700; }
.check-no  { color: #FF8A8E; font-weight: 700; }

@media print {
  .sidebar, .topbar, .breadcrumb, .scroll-top, .no-print, .sidebar-overlay { display: none !important; }
  .main-col { margin-left: 0; }
  body { background: #fff; color: #111; }
  .card { border-color: #ccc; background: #fff; color: #111; }
  .consent-doc .kv dt { color: #555; }
  .consent-doc .kv dd, .consent-doc h2, .consent-doc h3, .consent-doc p, .check-list li { color: #111; }
}

/* ============================================================ public booking page */
.book-page {
  min-height: 100vh;
  padding: 48px 16px 64px;
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(229,72,77,.16), transparent),
    radial-gradient(700px 340px at 5% 110%, rgba(110,86,207,.12), transparent),
    var(--bg);
}
.book-card { max-width: 640px; margin: 0 auto; }
.book-hero { text-align: center; margin-bottom: 28px; }
.book-hero .brand-mark { width: 54px; height: 54px; border-radius: 14px; margin: 0 auto 14px; }
.book-hero .brand-mark svg { width: 28px; height: 28px; }
.book-hero h1 { font-size: 28px; margin-bottom: 6px; }
.book-hero p { color: var(--text-2); max-width: 46ch; margin: 0 auto; }
.hp-field { position: absolute; left: -9999px; opacity: 0; height: 0; overflow: hidden; }

/* ============================================================ responsive */
@media (max-width: 1100px) {
  .stats-grid, .stats-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-2-even { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .main-col { margin-left: 0; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(0,0,.2,1);
    width: min(300px, 84vw);
    box-shadow: none;
  }
  body.menu-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  body.menu-open .sidebar-overlay { display: block; opacity: 1; }

  .sidebar-close {
    display: inline-flex;
    background: transparent; border: none;
    color: var(--text-2);
    width: 40px; height: 40px;
    align-items: center; justify-content: center;
    border-radius: var(--r-sm);
    cursor: pointer;
  }
  .sidebar-close:hover { background: var(--surface-2); color: var(--text); }
  .sidebar-close svg { width: 20px; height: 20px; }

  .hamburger { display: inline-flex; }

  .topbar { padding: 0 16px; }
  .topbar-search { display: none; }
  .content { padding: 16px 16px 96px; }

  .week-grid { grid-template-columns: 1fr 1fr; }
  .week-day { min-height: 0; }

  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }

  .toolbar .input { min-width: 0; flex: 1; }

  .cal-cell { min-height: 76px; padding: 4px; }
  .cal-evt { font-size: 10px; padding: 2px 4px; }
}

@media (max-width: 560px) {
  .stats-grid, .stats-grid.cols-3 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }
  .card { padding: 16px; }
  .kanban { grid-auto-columns: 280px; }
  .modal-backdrop { padding: 16px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
