/* ---------------------------------------------------------------------------
   shadcn-inspired design system & accessibility layer.
   Preserves SlotUp Pro's forest-emerald & gold branding and custom Gilroy/VT fonts,
   while standardizing surfaces, borders, focus rings, typography, and interactive states.
   --------------------------------------------------------------------------- */

:root {
  /* Core brand & surface tokens (refined dark forest palette) */
  --bg: #090d0b;
  --panel: #101613;
  --panel2: #171f1b;
  --line: #1f2a24;
  --line2: #293730;
  --text: #f0f5f1;
  --body: #d6dfd9;
  --muted: #8e9f95;

  /* Radii & shadows (shadcn scale) */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.36), 0 2px 6px -2px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 16px 36px -6px rgba(0, 0, 0, 0.55), 0 6px 16px -4px rgba(0, 0, 0, 0.35);
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--green2);
}

:root[data-theme="light"] {
  --shadow-sm: 0 1px 2px rgba(16, 24, 20, 0.06);
  --shadow-md: 0 4px 12px -2px rgba(16, 24, 20, 0.08), 0 2px 6px -2px rgba(16, 24, 20, 0.05);
  --shadow-lg: 0 16px 36px -6px rgba(16, 24, 20, 0.16), 0 6px 16px -4px rgba(16, 24, 20, 0.08);
}

/* ---- Global typography & smoothing ---- */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  line-height: 1.45;
  letter-spacing: -0.005em;
}

/* ---- Keyboard focus rings (WCAG 2.4.7 / 2.4.11) ---- */
:focus {
  outline: none;
}
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
[role="checkbox"]:focus-visible,
[tabindex]:focus-visible,
.ag:focus-visible,
.ce:focus-visible,
.mc:focus-visible,
.tm-row:focus-visible {
  outline: none;
  box-shadow: var(--ring) !important;
  z-index: 2;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--green2);
  box-shadow: 0 0 0 3px rgba(var(--gRGB), 0.22);
}

/* ---- Refined scrollbar ---- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line2) transparent;
}
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-thumb {
  background: var(--line2);
  border-radius: 999px;
}

/* ---- Header & top bar ---- */
header {
  min-height: 56px;
  padding: 8px 16px;
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.bname {
  font-size: 19px;
  letter-spacing: -0.02em;
}
.clock b {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.clock small {
  font-size: 11.5px;
}

/* ---- Icon buttons & Undo/Redo group (shadcn outline button style) ---- */
.iconbtn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--line2);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.iconbtn:hover:not(:disabled) {
  background: var(--panel2);
  border-color: color-mix(in srgb, var(--line2) 70%, var(--text));
}
.iconbtn:active:not(:disabled) {
  transform: translateY(0.5px);
}
.iconbtn.primary {
  background: var(--green);
  border-color: color-mix(in srgb, var(--green2) 60%, transparent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.iconbtn.primary:hover:not(:disabled) {
  background: var(--green2);
}
.ur {
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--line2);
  box-shadow: var(--shadow-sm);
}
.ur button {
  width: 36px;
  height: 34px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.ur button:hover:not(:disabled) {
  background: var(--panel2);
}
.ur button:disabled {
  opacity: 0.38;
}

/* ---- Buttons (shadcn primary, secondary, destructive, ghost) ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  background: var(--panel2);
  border: 1px solid var(--line2);
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.2;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, border-color 0.15s ease, filter 0.15s ease, transform 0.1s ease;
}
.btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--panel2) 82%, var(--text));
  border-color: color-mix(in srgb, var(--line2) 75%, var(--text));
}
.btn:active:not(:disabled) {
  transform: translateY(0.5px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn.p {
  background: var(--green);
  border-color: color-mix(in srgb, var(--green2) 55%, transparent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.btn.p:hover:not(:disabled) {
  background: var(--green2);
  border-color: var(--green2);
}
.btn.r {
  background: var(--redSoft);
  color: var(--redTxt);
  border-color: rgba(229, 83, 75, 0.35);
}
.btn.r:hover:not(:disabled) {
  background: rgba(229, 83, 75, 0.24);
  border-color: rgba(229, 83, 75, 0.55);
}
.btn.big {
  min-height: 44px;
  padding: 12px 16px;
  font-size: 15px;
  border-radius: var(--radius-lg);
}

/* ---- Inputs, selects, textareas & field labels ---- */
input,
select,
textarea {
  min-height: 42px;
  padding: 10px 13px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--line2);
  font-size: 14px;
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 78%, transparent);
}
.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--body);
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}
.field input + input,
.field .seg + input {
  margin-top: 10px !important;
}

/* ---- Segmented controls (shadcn TabsList style) ---- */
.seg {
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--line);
}
.seg button {
  padding: 8px 12px;
  border-radius: calc(var(--radius-lg) - 4px);
  background: transparent;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.seg button:hover:not(.on) {
  color: var(--text);
  background: color-mix(in srgb, var(--panel2) 60%, transparent);
}
.seg button.on {
  background: var(--green);
  border-color: color-mix(in srgb, var(--green2) 50%, transparent);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.seg#acRow {
  background: transparent;
  border: 0;
  padding: 2px 0;
  gap: 8px;
}

/* ---- View headers & section dividers ---- */
.vhead {
  padding: 12px 16px 8px;
  border-bottom: 1px solid transparent;
}
.vhead h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.sec {
  padding: 10px 16px 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ---- Week strip ---- */
.week {
  padding: 6px 16px 10px;
  gap: 6px;
}
.wday {
  min-width: 54px;
  padding: 8px 6px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--line);
  font-weight: 600;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
.wday:hover:not(.on) {
  border-color: var(--line2);
  background: var(--panel2);
}
.wday.on {
  box-shadow: 0 4px 12px rgba(var(--gRGB2), 0.32);
}

/* ---- Agenda rows & day headers ---- */
.ag-day {
  padding: 14px 16px 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.ag-day h3 {
  font-size: 15px;
  letter-spacing: -0.01em;
}
.ag-day button {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--panel);
  border: 1px solid var(--line2);
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.ag-day button:hover {
  background: var(--panel2);
  color: var(--text);
}
.ag {
  margin: 2px 12px;
  padding: 10px 10px 10px 4px;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.ag:hover {
  background: var(--panel);
  border-color: var(--line);
}
.ag.cur {
  background: var(--greenSoft);
  border-color: rgba(var(--gRGB), 0.32);
}
.ag-tm b {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.ag-tm small {
  font-variant-numeric: tabular-nums;
}
.ag .cb,
.row .cb {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border-width: 1.75px;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.ag .cb:hover,
.row .cb:hover {
  transform: scale(1.06);
}
.startb {
  padding: 7px 13px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.startb:hover {
  background: rgba(var(--gRGB), 0.28);
}

/* ---- Chips / Badges (shadcn Badge style) ---- */
.chip {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ---- Banners ---- */
.banner {
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
}
.banner button {
  border-radius: var(--radius-sm);
  padding: 6px 11px;
  font-weight: 600;
  transition: opacity 0.15s ease;
}
.banner button:hover {
  opacity: 0.9;
}

/* ---- Month calendar & event cards ---- */
.mc {
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.mc:hover:not(.s) {
  border-color: var(--line2);
  background: var(--panel2);
}
.ce,
.row,
.gmini,
.gbox {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.ce[data-tid]:hover,
.row:hover {
  border-color: var(--line2);
}

/* ---- Team cards, tabs, and rows ---- */
.tm-card {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px 14px 8px;
}
.tm-tabs button {
  border-radius: var(--radius-md);
  padding: 7px 13px;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tm-tabs button:hover:not(.on) {
  color: var(--text);
  border-color: var(--line2);
}
.tm-row {
  border-radius: var(--radius-sm);
  padding: 10px 4px;
  transition: background-color 0.12s ease;
}
.tm-row.mine:hover,
.tm-row[data-aopen]:hover,
.tm-row.ml:hover {
  background: color-mix(in srgb, var(--panel2) 65%, transparent);
}
.prow button {
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.prow button:hover {
  background: color-mix(in srgb, var(--panel2) 80%, var(--text));
}

/* ---- Modal Sheet / Dialog (shadcn Dialog & Drawer style) ---- */
.scrim {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.16s ease-out;
}
.sheet {
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border: 1px solid var(--line2);
  box-shadow: var(--shadow-lg);
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  animation: sheetUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (min-width: 700px) {
  .sheet {
    border-radius: var(--radius-xl);
    max-width: 480px;
    padding: 22px 24px;
  }
}
.sheet h3 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 10px;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes sheetUp {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---- Login card (shadcn Card style, top-anchored so switching tabs never jumps) ---- */
.loginov {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: max(6vh, 28px) 20px 32px;
  scrollbar-gutter: stable;
  background: radial-gradient(ellipse at top, color-mix(in srgb, var(--green) 14%, var(--bg)), var(--bg) 65%);
}
.lcard {
  width: min(410px, 100%);
  min-height: 470px;
  padding: 28px 26px;
  border-radius: var(--radius-xl);
  background: var(--panel);
  border: 1px solid var(--line2);
  box-shadow: var(--shadow-lg);
  gap: 18px;
}
.lbrand {
  font-size: 26px;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.lcard .seg {
  background: var(--bg);
}
.lcard .seg button {
  padding: 9px 10px;
  font-size: 13px;
}
.lcard #lAuth,
.lcard #lTeam,
.lcard #lSolo {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.lcard .field {
  margin: 0;
}
.lcard .field label {
  margin-bottom: 9px;
}
.lcard .lmsg {
  min-height: 18px;
  margin: -6px 0;
  line-height: 1.4;
}

/* ---- Bottom navigation bar ---- */
nav.tabs {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
nav.tabs button {
  font-size: 12px;
  font-weight: 600;
  transition: color 0.15s ease;
}
nav.tabs button:hover:not(.on) {
  color: var(--text);
}

/* ---- Toast (shadcn Sonner style) ---- */
.toast {
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  box-shadow: var(--shadow-lg);
  font-weight: 600;
}

/* ---- Reduced motion respect (WCAG 2.3.3) ---- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

