/* ============================================================
   Ubuntu 26.04 — Yaru GTK widget styles
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  font-size: var(--fs-m);
  color: var(--window-fg);
  background: var(--jet);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  --window-bg: var(--window-bg);
}
input, textarea { font-family: var(--font); }
::selection { background: var(--selection-bg); color: var(--selection-fg); }

:focus-visible { outline: none; }

/* ---------- scrollbars ---------- */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 8px;
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); background-clip: content-box; border: 3px solid transparent; }
*::-webkit-scrollbar-corner { background: transparent; }
.scrollable { overflow: auto; }

/* ---------- buttons (Yaru GTK) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 34px; padding: 0 14px;
  font-family: var(--font); font-size: var(--fs-m); font-weight: 400;
  color: var(--window-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-s);
  cursor: default;
  transition: background var(--speed-fast) var(--ease-out), box-shadow var(--speed-fast) var(--ease-out), border-color var(--speed-fast);
  white-space: nowrap;
}
.btn:hover { background: var(--btn-bg-hover); }
.btn:active, .btn.pressed { background: var(--btn-bg-active); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.flat { background: transparent; border-color: transparent; }
.btn.flat:hover { background: var(--row-hover); }
.btn.flat:active { background: var(--sidebar-active); }
.btn.suggested {
  background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 500;
}
.btn.suggested:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.suggested:active { background: var(--accent-active); }
.btn.destructive { background: var(--error); border-color: var(--error); color: #fff; font-weight: 500; }
.btn.destructive:hover { background: var(--error-hover); border-color: var(--error-hover); }
.btn.circular { border-radius: var(--radius-pill); width: 34px; padding: 0; }
.btn.small { min-height: 28px; padding: 0 10px; font-size: var(--fs-s); }
.btn .ic { font-size: 16px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--radius-pill);
  color: var(--window-fg); border: none; background: transparent;
  transition: background var(--speed-fast);
  cursor: default;
}
.icon-btn:hover { background: var(--row-hover); }
.icon-btn:active { background: var(--sidebar-active); }
.icon-btn.checked { background: var(--accent-soft); color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- entries ---------- */
.entry {
  display: flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 0 12px;
  background: var(--entry-bg); color: var(--entry-fg);
  border: 1px solid var(--entry-border);
  border-radius: var(--radius-s);
  transition: box-shadow var(--speed-normal), border-color var(--speed-normal);
  position: relative;
}
.entry input {
  flex: 1; min-width: 0; border: none; outline: none; background: transparent;
  color: var(--entry-fg); font-size: var(--fs-m);
}
.entry input::placeholder { color: var(--fg-faint); }
.entry:focus-within { border-color: var(--focus-ring); box-shadow: 0 0 0 2px var(--focus-ring); }
.entry .entry-icon { color: var(--fg-faint); display: flex; }
.entry .entry-icon svg { width: 16px; height: 16px; }

/* ---------- switches ---------- */
.switch {
  position: relative; display: inline-block;
  width: 44px; height: 24px; flex: none;
  background: var(--btn-bg); border: 1px solid var(--btn-border);
  border-radius: 999px;
  transition: background var(--speed-normal), border-color var(--speed-normal);
  cursor: default;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--window-fg);
  transition: transform var(--speed-normal) var(--ease-spring), background var(--speed-normal);
}
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on::after { transform: translateX(20px); background: var(--accent-fg); }

/* ---------- sliders ---------- */
.slider {
  position: relative; height: 20px; display: flex; align-items: center; cursor: default;
  touch-action: none;
}
.slider .track {
  position: relative; width: 100%; height: 4px;
  background: var(--border-strong); border-radius: 999px; overflow: visible;
}
.slider .fill {
  position: absolute; left: 0; top: 0; height: 100%;
  background: var(--accent); border-radius: 999px;
}
.slider .thumb {
  position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 1px solid var(--border-strong);
  transform: translate(-50%, -50%);
  box-shadow: var(--shadow-1);
  transition: transform var(--speed-fast);
}
.slider:hover .thumb { transform: translate(-50%, -50%) scale(1.15); }
.slider:active .thumb { transform: translate(-50%, -50%) scale(1.25); }

/* ---------- menus ---------- */
.menu {
  position: fixed; z-index: 9000;
  min-width: 220px; max-width: 320px;
  background: var(--menu-bg); color: var(--menu-fg);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-3);
  padding: 6px;
  animation: menu-in var(--speed-normal) var(--ease-spring);
  transform-origin: top left;
}
@keyframes menu-in {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
.menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--radius-s);
  font-size: var(--fs-m);
  cursor: default;
}
.menu-item:hover { background: var(--menu-hover); }
.menu-item.disabled { color: var(--fg-faint); pointer-events: none; }
.menu-item .mi-icon { display: flex; width: 18px; height: 18px; color: var(--fg-dim); flex: none; }
.menu-item .mi-icon svg { width: 18px; height: 18px; }
.menu-item .mi-icon.colored { color: var(--accent); }
.menu-item .mi-label { flex: 1; }
.menu-item .mi-check { display: none; color: var(--accent); }
.menu-item.checked .mi-check { display: block; }
.menu-item .mi-arrow { color: var(--fg-faint); font-size: 11px; }
.menu-sep { height: 1px; margin: 6px 10px; background: var(--menu-border); }
.menu-title { padding: 8px 12px 4px; font-weight: 500; color: var(--fg-faint); font-size: var(--fs-xs); }

/* ---------- popovers ---------- */
.popover {
  position: fixed; z-index: 8900;
  background: var(--popover-bg); color: var(--popover-fg);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-3);
  animation: menu-in var(--speed-normal) var(--ease-spring);
  transform-origin: top center;
  overflow: hidden;
}

/* ---------- modal dialogs (compiled Yaru: radius 18px, pad 24px) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 9500;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  animation: fade-in var(--speed-normal) var(--ease-out);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  min-width: 360px; max-width: 480px;
  background: var(--dialog-bg); color: var(--dialog-fg);
  border-radius: var(--radius-modal);
  padding: var(--pad-xxl);
  box-shadow: var(--shadow-3), 0 12px 8px 12px rgba(0,0,0,0.03);
  animation: modal-in var(--speed-normal) var(--ease-spring);
  display: flex; flex-direction: column; gap: var(--pad-l);
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.94) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal .modal-title { font-size: var(--fs-l); font-weight: 550; }
.modal .modal-body { font-size: var(--fs-m); color: var(--fg-dim); line-height: 1.5; }
.modal .modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.modal .modal-field { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-s); color: var(--fg-dim); }
.modal .entry { width: 100%; }

/* sheet dialogs (GNOME 50 action sheets) */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 9500;
  background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in var(--speed-normal);
}
.sheet {
  background: var(--dialog-bg); color: var(--dialog-fg);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-width: 520px; max-height: 70vh;
  padding: var(--pad-l) var(--pad-xl) var(--pad-xl);
  box-shadow: var(--shadow-3);
  animation: sheet-in var(--speed-normal) var(--ease-spring);
  display: flex; flex-direction: column;
}
@keyframes sheet-in {
  from { transform: translateY(60px); opacity: .4; }
  to { transform: translateY(0); opacity: 1; }
}
.sheet .sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 0 auto 12px; }

/* ---------- toasts ---------- */
.toast-layer {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 9600; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--osd-bg); color: var(--osd-fg);
  border-radius: var(--radius-m);
  padding: 10px 16px;
  font-size: var(--fs-m);
  box-shadow: var(--shadow-2);
  display: flex; align-items: center; gap: 10px;
  animation: toast-in var(--speed-normal) var(--ease-spring);
  pointer-events: auto;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.out { animation: toast-out var(--speed-normal) forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(.95); } }
.toast .ic { color: var(--accent); }
.toast .ic svg { width: 18px; height: 18px; }

/* ---------- tooltips ---------- */
.tooltip {
  position: fixed; z-index: 9700;
  background: var(--osd-bg); color: var(--osd-fg);
  border-radius: 6px; padding: 6px 10px;
  font-size: var(--fs-xs); font-weight: 500;
  pointer-events: none;
  box-shadow: var(--shadow-1);
  animation: tooltip-in var(--speed-fast) var(--ease-out);
  white-space: nowrap;
}
@keyframes tooltip-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* ---------- OSD (volume/brightness popup) ---------- */
.osd {
  position: fixed; z-index: 9400;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: var(--osd-bg); color: var(--osd-fg);
  border-radius: var(--radius-xl);
  padding: var(--pad-l) var(--pad-xl);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-weight: 500;
  box-shadow: var(--shadow-3);
  animation: osd-in var(--speed-normal) var(--ease-spring);
  min-width: 180px;
}
@keyframes osd-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.9); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
.osd .osd-icon { color: var(--osd-fg); }
.osd .osd-icon svg { width: 28px; height: 28px; }
.osd .osd-level { width: 140px; height: 4px; background: rgba(255,255,255,.25); border-radius: 2px; overflow: hidden; }
.osd .osd-level i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }

/* ---------- progress ---------- */
.progress { position: relative; height: 6px; background: var(--row-hover); border-radius: 3px; overflow: hidden; }
.progress > i { position: absolute; inset: 0; background: var(--accent); border-radius: 3px; transform-origin: left; transition: transform var(--speed-normal); }
.progress.indeterminate > i { animation: progress-ind 1.2s var(--ease-in-out) infinite; }
@keyframes progress-ind { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }

/* ---------- spinner ---------- */
.spinner {
  width: 24px; height: 24px; border-radius: 50%;
  border: 3px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- lists / rows ---------- */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-s);
  cursor: default;
}
.row:hover { background: var(--row-hover); }
.row.selected { background: var(--row-selected); color: var(--window-fg); }
.row .row-title { flex: 1; min-width: 0; }
.row .row-sub { font-size: var(--fs-xs); color: var(--fg-dim); }

/* ---------- cards ---------- */
.card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: var(--radius-l); padding: 16px;
}

/* ---------- headerbar (app chrome) ---------- */
.hb {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  height: var(--titlebar-height);
  background: var(--headerbar-bg); color: var(--headerbar-fg);
  border-bottom: 1px solid var(--headerbar-border);
  flex: none;
}
.hb .hb-title {
  font-size: var(--fs-l); font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hb .hb-sub { font-size: var(--fs-s); color: var(--fg-dim); margin-left: 4px; }
.hb .spacer { flex: 1; }
.hb .btn { background: transparent; border-color: transparent; color: var(--headerbar-fg); }
.hb .btn:hover { background: var(--row-hover); }
.hb .btn.suggested { background: var(--accent); color: var(--accent-fg); }

/* ---------- statusbar ---------- */
.statusbar {
  display: flex; align-items: center; gap: 16px;
  padding: 4px 14px; height: 30px;
  background: var(--headerbar-bg); color: var(--fg-dim);
  border-top: 1px solid var(--headerbar-border);
  font-size: var(--fs-xs); flex: none;
}

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; padding: 6px 12px 0; background: var(--window-bg); }
.tab {
  padding: 8px 14px; border-radius: var(--radius-s) var(--radius-s) 0 0;
  color: var(--fg-dim); font-size: var(--fs-m);
  border-bottom: 2px solid transparent;
  cursor: default;
}
.tab:hover { background: var(--row-hover); color: var(--window-fg); }
.tab.active { color: var(--window-fg); border-bottom-color: var(--accent); }

/* ---------- sidebar ---------- */
.sidebar {
  background: var(--sidebar-bg); color: var(--sidebar-fg);
  border-right: 1px solid var(--headerbar-border);
  width: 200px; flex: none;
  display: flex; flex-direction: column;
}
.side-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 0 6px;
  border-radius: var(--radius-s);
  font-size: var(--fs-m);
  cursor: default;
  color: var(--sidebar-fg);
}
.side-item:hover { background: var(--sidebar-active); }
.side-item.active { background: var(--sidebar-active); color: var(--window-fg); }
.side-item .si-icon { display: flex; width: 20px; height: 20px; color: var(--fg-dim); }
.side-item .si-icon svg { width: 20px; height: 20px; }
.side-item.active .si-icon { color: var(--accent); }

/* ---------- empty states ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 48px 24px; text-align: center;
  color: var(--fg-dim);
}
.empty .empty-icon { color: var(--fg-faint); }
.empty .empty-icon svg { width: 64px; height: 64px; }
.empty .empty-title { font-size: var(--fs-l); color: var(--window-fg); font-weight: 500; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: var(--accent); color: var(--accent-fg);
  font-size: var(--fs-xs); font-weight: 700;
}

/* ---------- checkboxes / radios ---------- */
.check, .radio {
  width: 18px; height: 18px; flex: none;
  border: 2px solid var(--border-strong);
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent;
  transition: all var(--speed-fast);
  background: var(--entry-bg);
}
.radio { border-radius: 50%; }
.check.on, .radio.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.check svg, .radio svg { width: 12px; height: 12px; }

/* ---------- segmented ---------- */
.segmented { display: inline-flex; background: var(--btn-bg); border: 1px solid var(--btn-border); border-radius: var(--radius-s); padding: 2px; gap: 2px; }
.segmented .seg {
  padding: 5px 14px; border-radius: 6px; font-size: var(--fs-s); color: var(--fg-dim);
  cursor: default;
}
.segmented .seg:hover { color: var(--window-fg); }
.segmented .seg.active { background: var(--window-bg); color: var(--window-fg); box-shadow: var(--shadow-1); }

/* ---------- misc ---------- */
.mono { font-family: var(--font-mono); }
.dim { color: var(--fg-dim); }
.faint { color: var(--fg-faint); }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex { display: flex; } .flex-col { display: flex; flex-direction: column; }
.grow { flex: 1; min-height: 0; min-width: 0; }
.gap-s { gap: 6px; } .gap-m { gap: 10px; } .gap-l { gap: 14px; }
.center { align-items: center; }
.hidden { display: none !important; }

/* accessibility variants */
:root.reduce-motion *, :root.reduce-motion *::before, :root.reduce-motion *::after {
  animation-duration: 0.001s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001s !important;
}
:root.large-text { font-size: 115%; }
:root.hc .btn, :root.hc .entry, :root.hc .switch, :root.hc .card, :root.hc .win-frame { border-width: 2px; }
:root.hc #panel, :root.hc #dock { filter: contrast(1.25); }
kbd {
  font-family: var(--font-mono); font-size: var(--fs-xs);
  background: var(--btn-bg); border: 1px solid var(--btn-border);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px;
}
table { border-collapse: collapse; width: 100%; }
th { text-align: left; font-weight: 500; color: var(--fg-dim); font-size: var(--fs-xs); padding: 6px 10px; }
td { padding: 6px 10px; border-top: 1px solid var(--card-border); font-size: var(--fs-s); }
