/* ===== Root / Theme ===== */
:root {
  --primary: #137fec;
  --surface: #ffffff;
  --surface-2: #f6f7f8;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 1px 0 0 rgba(0,0,0,0.06);
  --radius: 12px;
}

.dark {
  --surface: #0f1720;
  --surface-2: #101922;
  --text: #e5e7eb;
  --muted: #9aa4b2;
  --border: #1f2937;
  --shadow: 0 1px 0 0 rgba(255,255,255,0.06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body.page {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  background: var(--surface-2);
  color: var(--text);
}

/* ===== Utilities ===== */
.hide-sm { display: none; }
@media (min-width: 640px){ .hide-sm { display: inline-flex; } }
.hide-md { display: none; }
@media (min-width: 768px){ .hide-md { display: initial; } }
.muted { color: var(--muted); }
.xs { font-size: 12px; }
.w-full { width: 100%; }

/* ===== Skip link ===== */
.skiplink {
  position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden;
}
.skiplink:focus {
  left: 12px; top: 12px; width: auto; height: auto; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; z-index: 9999;
}

/* ===== App shell ===== */
.app { position: relative; min-height: 100vh; display: flex; }
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; display: none;
}
[ x-show="sidebarOpen" ] ~ .overlay { display: block; }

/* Sidebar */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 256px;
  background: var(--surface); border-right: 1px solid var(--border);
  transform: translateX(-100%); transition: transform .25s ease, width .25s ease; z-index: 50;
}
.sidebar.is-open { transform: translateX(0); }
@media (min-width: 1024px) { .sidebar { transform: none; } }
.sidebar-collapsed .sidebar { width: 80px; }
.sidebar__inner { display: flex; flex-direction: column; height: 100%; }

.brand { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.brand__icon { width: 32px; height: 32px; color: var(--primary); }
.brand__icon svg { width: 100%; height: 100%; }
.brand__name { font-size: 18px; font-weight: 800; margin: 0; }

.nav { padding: 16px 12px; }
.nav--footer { margin-top: auto; border-top: 1px solid var(--border); }
.nav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none;
}
.nav__item:hover { background: rgba(19,127,236,.10); }
.nav__item--active { background: rgba(19,127,236,.10); color: var(--primary); }
.nav__text { font-size: 14px; font-weight: 600; white-space: nowrap; }
.sidebar-collapsed .nav__text, .sidebar-collapsed .brand__name { opacity: 0; visibility: hidden; width: 0; }

/* Content */
.content { flex: 1 1 auto; min-width: 0; transition: padding-left .25s ease; }
.content--expanded { padding-left: 256px; }
.content--collapsed { padding-left: 80px; }
@media (max-width: 1023.98px) { .content { padding-left: 0 !important; } }

/* Header */
.header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
}
.header__left { display: flex; align-items: center; gap: 8px; }
.header__title { margin: 0 0 0 4px; font-weight: 600; }
.header__right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px; border: 0; cursor: pointer;
  background: #eef2f6; color: var(--text);
}
.dark .icon-btn { background: #0f2434; }
.icon-btn.ghost { background: transparent; }
.icon-btn:hover { background: rgba(19,127,236,.12); }
.material-symbols-outlined { font-variation-settings: 'OPSZ' 24; }

.search { display: inline-flex; align-items: center; background: #eef2f6; border-radius: 10px; height: 40px; overflow: hidden; }
.dark .search { background: #0f2434; }
.search__icon { padding-left: 10px; color: var(--muted); }
.search__input {
  border: 0; outline: 0; padding: 0 12px; height: 100%; min-width: 220px;
  color: var(--text); background: transparent;
}
.avatar {
  width: 40px; height: 40px; border-radius: 9999px; background: center/cover no-repeat var(--surface);
  background-image: var(--avatar);
  border: 1px solid var(--border);
}

/* Main */
.main { padding: 20px 16px 28px; }
.container { max-width: 1400px; margin: 0 auto; }

/* Toolbar */
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px;
}
.toolbar__left, .toolbar__right { display: flex; align-items: center; gap: 8px;}

/* Controls */
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: rgba(19,127,236,.6); box-shadow: 0 0 0 3px rgba(19,127,236,.15); }
.textarea { resize: vertical; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) calc(1em + 2px), calc(100% - 13px) calc(1em + 2px); background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 28px; }

/* Buttons */
.btn {
  height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border);
  background: #eef2f6; color: var(--text); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.dark .btn { background: #0f2434; border-color: #183247; }
.btn:hover { filter: brightness(1.05); }
.btn--primary { background: var(--primary); color: #fff; border-color: transparent; }
.btn--ghost { background: var(--surface); }
.btn--flat { background: #eef2f6; border-color: var(--border); width: 100%; }
.dark .btn--flat { background: #0f2434; }
.btn--danger { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.dark .btn--danger { background: rgba(190,18,60,0.2); color: #fecaca; border-color: rgba(190,18,60,0.35); }

.btn .material-symbols-outlined.sm { font-size: 18px; line-height: 0; }

/* Grid helpers */
.grid { display: grid; }
.grid.two { grid-template-columns: 1fr; }
.grid.gap { gap: 12px; }
@media (min-width: 640px){ .grid.two { grid-template-columns: 1fr 1fr; } }

/* Board */
.board {
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 768px){ .board { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1280px){ .board { grid-template-columns: repeat(4, 1fr); } }

.lane {
  display: flex; flex-direction: column; max-height: 78vh;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.02);
}
.lane__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.lane__title { margin: 0; font-weight: 700; }
.lane__meta { font-size: 12px; color: var(--muted); }

.lane__body {
  flex: 1 1 auto; overflow-y: auto; padding: 12px; display: grid; gap: 12px;
}
.lane__body.is-drop-target { outline: 2px dashed rgba(19,127,236,.5); outline-offset: -6px; border-radius: 12px; }

.lane__foot { padding: 10px; border-top: 1px solid var(--border); }

/* Task card */
.task {
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.05); transition: box-shadow .15s ease, transform .1s ease;
  backdrop-filter: blur(2px);
}
.task:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); transform: translateY(-1px); }
.task__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.task__title { margin: 0; font-weight: 600; line-height: 1.25; }
.task__desc { margin: 6px 0 0; font-size: 14px; color: var(--text); opacity: .9; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task__meta { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; font-size: 12px; font-weight: 600; border-radius: 9999px;
  background: #e5e7eb; color: #374151;
}
.dark .badge { background: #1f2937; color: #e5e7eb; }
.badge--slate { background: #e5e7eb; color: #374151; }
.badge--pri { background: #fee2e2; color: #b91c1c; }
.badge--sec { background: #fef3c7; color: #92400e; }
.badge--low { background: #dcfce7; color: #166534; }

/* ===== Modal (panel) ===== */
.modal-scrim {
  position: fixed; inset: 0; z-index: 100; display: none;
  align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,.4);
}
[x-show="openCreate"] { display: flex; } /* Alpine will toggle visibility */

.modal {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.20), 0 2px 10px rgba(0,0,0,.08);
}
.modal--panel { width: min(640px, 100%); padding: 16px; }

.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.modal__title { margin: 0; font-size: 18px; font-weight: 800; }
.modal__foot {
  margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.modal__foot .actions { display: inline-flex; gap: 8px; }

/* Form */
.form.grid.gap { gap: 12px; }
.field { display: grid; gap: 6px; }
.field__label { font-size: 12px; font-weight: 600; color: var(--muted); }





/* Header right cluster — tidy spacing & sizing */
.header__right{
  display:flex;
  align-items:center;
  gap:12px;                /* space between bell, theme, avatar */
}

/* Compact, consistent icon buttons */
.icon-btn{
  inline-size:40px;
  block-size:40px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:10px;
  background:var(--surface-2, #eef2f6);
  color:var(--text-2, #4b5563);
  border:1px solid var(--border, #e5e7eb);
  transition:background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn:hover{ background:var(--surface-3, #e7edf3); }
.icon-btn:focus-visible{ outline:2px solid #137fec; outline-offset:2px; }

/* Material icon size inside the icon button */
.icon-btn .material-symbols-outlined{
  font-size:22px;
  line-height:1;
}

/* Avatar: same visual weight as buttons */
.avatar{
  inline-size:36px;
  block-size:36px;
  border-radius:9999px;
  background-image:var(--avatar);
  background-size:cover;
  background-position:center;
  border:2px solid var(--surface-1, #fff);
  box-shadow:0 0 0 1px var(--border, #e5e7eb);
}

/* Search height to match 40px buttons */
.search{
  display:inline-flex;
  align-items:center;
  gap:8px;
  inline-size:min(320px, 40vw);
  block-size:40px;
  padding-inline:12px;
  border-radius:12px;
  background:var(--surface-2, #eef2f6);
  border:1px solid var(--border, #e5e7eb);
}
.search__icon{ font-size:18px; color:var(--text-3, #6b7280); }
.search__input{
  flex:1;
  min-width:0;
  border:0;
  outline:0;
  font:inherit;
  background:transparent;
  color:var(--text-1, #111827);
}
.search__input::placeholder{ color:var(--text-3, #6b7280); }

/* Dark theme tweaks (optional) */
:root.dark .icon-btn{ background:#111827; color:#cbd5e1; border-color:#1f2937; }
:root.dark .icon-btn:hover{ background:#0f172a; }
:root.dark .avatar{ border-color:#0b1220; box-shadow:0 0 0 1px #1f2937; }
:root.dark .search{ background:#0f172a; border-color:#1f2937; }
:root.dark .search__input{ color:#e5e7eb; }
:root.dark .search__input::placeholder{ color:#94a3b8; }










/* ===== Settings / Profile page additions ===== */

/* Generic card */
.card{
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:12px;
  margin-bottom: 15px;
}
.card__title{ margin:0; font-weight:800; }

/* Small chips/toggles used in toolbars */
.chip{
  display:inline-flex; align-items:center; gap:8px;
  padding:6px 10px; border-radius:9999px;
  background:var(--surface-2); border:1px solid var(--border);
  font-weight:600; color:var(--text);
}
.switch{
  appearance:none; inline-size:36px; block-size:20px; border-radius:9999px;
  background:#d1d5db; position:relative; border:0; cursor:pointer;
  transition:background .15s ease;
}
.switch::after{
  content:""; position:absolute; inset-block:2px; inset-inline-start:2px;
  inline-size:16px; block-size:16px; border-radius:50%; background:#fff;
  transition:transform .15s ease;
  box-shadow:0 1px 2px rgba(0,0,0,.15);
}
.switch:checked{ background:#60a5fa; }
.switch:checked::after{ transform: translateX(16px); }

/* Logo block in header card */
[data-client-logo]{
  inline-size:56px; block-size:56px; object-fit:contain;
  border-radius:10px; border:1px solid var(--border);
  background:var(--surface-2);
}
[data-client-name]{ font-weight:800; }

/* Inputs inside cards: add tight vertical rhythm */
.card .field + .field{ margin-top:8px; }
.card .grid.two .field + .field{ margin-top:0; }

/* Help text under selects/inputs */
.field .help, .field small{
  color:var(--muted); font-size:12px;
}

/* Email config block */
h4{ font-weight:800; }
.select:has(option[value="true"]:checked),
.select:has(option[value="false"]:checked){ font-variant-numeric: tabular-nums; }

/* Danger + Primary button spacing in footers */
.modal__foot .actions .btn + .btn{ margin-left:8px; }

/* Masked-password look when API returns ******** */
.input[type="password"]::placeholder{
  font-family: 'dots', monospace;
}

/* Inline form groups (stack on small viewports) */
@media (max-width: 639.98px){
  .card .grid.two{ grid-template-columns: 1fr; }
}

/* Table / small list (if you show anything inside Profile later) */
.table{ width:100%; border-collapse:separate; border-spacing:0; }
.table th, .table td{ padding:10px 12px; border-bottom:1px solid var(--border); }
.table thead th{
  background:var(--surface-2); color:var(--muted);
  text-transform:uppercase; letter-spacing:.02em; font-size:12px; font-weight:700;
}

/* Notification badge (ensure it appears over icon buttons) */
.icon-btn{ position:relative; } /* anchor for absolute badge */
.notify-badge{
  position:absolute; top:2px; right:2px; transform: translate(25%, -25%);
  min-width:16px; height:16px; padding:0 4px; border-radius:9999px;
  background:#ef4444; color:#fff; font:700 10px/16px Inter, system-ui, sans-serif;
  text-align:center; pointer-events:none; display:none; z-index:2;
}
.icon-btn .notify-badge[aria-show="true"]{ display:inline-block; }

/* Loader in cards (reuses modal spinner palette) */
.table-loading, .section-loading{
  display:flex; align-items:center; gap:10px; color:var(--muted); padding:6px 2px;
}
.spinner{
  inline-size:18px; block-size:18px; border-radius:50%;
  border:2px solid currentColor; border-right-color: transparent;
  animation: spin-rotate .8s linear infinite;
}

/* Reuse existing keyframes from your loader section if present */
@keyframes spin-rotate{ 100% { transform: rotate(360deg); } }

/* File input visually hidden but accessible (for logo upload) */
input[type="file"][style*="display:none"] + .btn,
#logo-file[style*="display:none"] + .btn{ /* just ensures spacing is nice */ }

/* Helper dots used in small stats */
.dot{
  inline-size:8px; block-size:8px; border-radius:50%;
  background:#94a3b8; display:inline-block;
}
.dot--green{ background:#16a34a; }
.dot--slate{ background:#64748b; }

/* Tiny pills (you already have .badge; these are slimmer if needed) */
.pill{
  display:inline-flex; align-items:center; gap:6px;
  padding:4px 10px; font-size:12px; font-weight:700;
  border-radius:9999px; border:1px solid var(--border); background:var(--surface-2);
}

/* Make buttons feel consistent in cards (esp. Upload/Remove logo) */
.card .btn{ height:36px; }

/* Dark tweaks */
.dark .card{ box-shadow:none; }
.dark [data-client-logo]{ background:#0b1320; border-color:#1f2937; }








/* ===== Loaders (global) =============================================== */

/* Inline row loader (use inside modals/sections) */
.loading-row{
  display:flex; align-items:center; gap:10px; color:var(--muted);
}

/* Generic section/table loader */
.section-loading, .table-loading{
  display:flex; align-items:center; gap:10px;
  color:var(--muted); padding:6px 2px;
}

/* SVG spinner (use <svg class="spin size-6"> … ) */
.size-4 { inline-size:16px; block-size:16px; }
.size-5 { inline-size:20px; block-size:20px; }
.size-6 { inline-size:24px; block-size:24px; }
.size-8 { inline-size:32px; block-size:32px; }

.spin{
  display:inline-block;
  animation: spin-rotate 1s linear infinite;
}
.spin .dim{
  opacity:.25;
  stroke: currentColor;
}
.spin .bold{
  stroke: currentColor;
  stroke-linecap: round;
  animation: spin-dash 1.4s ease-in-out infinite;
}

/* Pure CSS ring (no SVG). Use: <span class="spinner spinner--md"></span> */
.spinner{
  display:inline-block;
  border-radius:50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin-rotate .8s linear infinite;
}
.spinner--sm{ inline-size:16px; block-size:16px; }
.spinner--md{ inline-size:20px; block-size:20px; }
.spinner--lg{ inline-size:28px; block-size:28px; }

/* Button busy state (add aria-busy="true") */
.btn[aria-busy="true"]{
  position: relative; pointer-events: none; opacity: .85;
}
.btn[aria-busy="true"]::after{
  content:"";
  inline-size:14px; block-size:14px;
  border-radius:50%;
  border:2px solid currentColor; border-right-color: transparent;
  position:absolute; inset-inline-end:10px; inset-block:0; margin-block:auto;
  animation: spin-rotate .8s linear infinite;
}

/* Keyframes */
@keyframes spin-rotate{ 100% { transform: rotate(360deg); } }
@keyframes spin-dash{
  0%   { stroke-dasharray: 1, 200; stroke-dashoffset: 0; }
  50%  { stroke-dasharray: 90, 200; stroke-dashoffset: -35; }
  100% { stroke-dasharray: 90, 200; stroke-dashoffset: -124; }
}

/* Accessibility: reduced motion */
@media (prefers-reduced-motion: reduce){
  .spin, .spinner, .btn[aria-busy="true"]::after{ animation: none; }
}








