[hidden] { display: none !important; }
:root {
  --bg: #eef0ea;
  --surface: #ffffff;
  --ink: #1b1d18;
  --muted: #5f645a;
  --line: #d8dccf;
  --rail: #1b1d18;
  --rail-ink: #c9cdbf;
  --lime: #ccff00;      /* TPE brand */
  --lime-ink: #1b1d18;
  --lime-soft: #eef7c4;
  --grass: #24603a;
  --grass-line: rgba(255, 255, 255, .55);
  --warn: #b4410c;
  --ok: #2f7d32;
  --font: "Barlow", "Noto Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Barlow Condensed", "Noto Sans Arabic", "Arial Narrow", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121410;
    --surface: #1b1e18;
    --ink: #eceee6;
    --muted: #9aa093;
    --line: #2c3027;
    --lime-soft: #2f3a10;
    --grass: #1d4d2f;
    --warn: #f08a5d;
    --ok: #7bc47f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  padding-top: env(safe-area-inset-top, 0px);
}
button, input, select, textarea { font: inherit; }
button {
  cursor: pointer;
  border: 1px solid var(--lime);
  background: var(--lime);
  color: var(--lime-ink);
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
}
button:disabled { opacity: .55; cursor: default; }
button.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
button.ghost { background: transparent; color: inherit; border-color: transparent; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: .01em; line-height: 1.1; }

.badge {
  display: inline-grid; place-items: center;
  background: var(--lime); color: var(--lime-ink);
  font-family: var(--display); font-weight: 700; letter-spacing: .06em;
  border-radius: 6px; padding: 2px 8px;
}

/* Login */
.login { min-height: 100%; display: grid; place-items: center; background: var(--rail); padding: 24px; }
.login-box { width: min(380px, 100%); background: var(--surface); border-radius: 12px; padding: 28px; display: grid; gap: 10px; }
.login-box h1 { margin: 6px 0 0; font-size: 2rem; }
.login-box p { margin: 0 0 8px; color: var(--muted); }
.login-box input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.error { color: var(--warn); min-height: 1.2em; }

/* Shell */
.app { display: grid; grid-template-columns: 232px 1fr; height: 100%; }
.rail { background: var(--rail); color: #fff; display: flex; flex-direction: column; padding: 20px 12px; gap: 18px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 1.3rem; font-weight: 700; padding: 0 8px; }
#nav { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; flex: 1; align-content: start; }
#nav .sep { height: 1px; background: #33362e; margin: 10px 8px; }
#nav button {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: transparent; border: 0; border-radius: 8px; color: var(--rail-ink);
  font-weight: 500; padding: 9px 10px; text-align: left;
}
#nav button .ico { width: 18px; text-align: center; opacity: .8; }
#nav button .lbl { flex: 1; }
#nav button:hover { background: #262920; color: #fff; }
#nav button[aria-current="true"] { background: #262920; color: #fff; box-shadow: inset 3px 0 0 var(--lime); }
.count { font-family: var(--display); font-size: 1.05rem; color: var(--lime); font-variant-numeric: tabular-nums; }
.rail-out { color: var(--rail-ink); text-align: left; padding: 8px 10px; }

.main { display: flex; flex-direction: column; min-width: 0; height: 100%; overflow: hidden; }
.bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 20px 28px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.bar h1 { margin: 0; font-size: 2rem; }
.meta { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.tools { display: flex; gap: 8px; }
.tools input { width: 240px; max-width: 46vw; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
#refresh { padding: 8px 12px; }
.status { padding: 0 28px; color: var(--muted); font-size: .9rem; }
.status:not(:empty) { padding-top: 10px; }
.status.err { color: var(--warn); }
.filters { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 12px 28px 0; }
.filters:empty { display: none; }
.fgroup { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.fgroup > span { font-size: .85rem; color: var(--muted); margin-right: 4px; }
.view { flex: 1; overflow: auto; padding: 16px 28px 40px; }

/* Pills (filters + option pickers) */
.pill { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; font-weight: 500; font-size: .9rem; }
.pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip { display: inline-block; background: var(--lime-soft); color: var(--ink); border-radius: 6px; padding: 1px 8px; margin: 1px 4px 1px 0; font-size: .85rem; font-weight: 500; white-space: nowrap; }
.chip.pos { font-family: var(--display); font-weight: 700; letter-spacing: .03em; background: var(--ink); color: var(--surface); }
.chip.st-open { background: var(--lime); color: var(--lime-ink); }
.chip.st-warn { background: #fde4d4; color: #7a2c06; }
.chip.muted { background: transparent; border: 1px solid var(--line); color: var(--muted); }

/* Dashboard */
.home { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; min-width: 0; }
.panel h2 { margin: 0 0 4px; font-size: 1.35rem; }
.panel > .meta { margin-bottom: 12px; }
.pitch-panel { grid-row: span 2; }
.pitch { width: 100%; height: auto; display: block; border-radius: 10px; }
.pitch .spot { cursor: pointer; }
.pitch .spot:hover circle, .pitch .spot:focus circle { stroke: #fff; stroke-width: 3; }
.pitch .spot:focus { outline: none; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list button.row { all: unset; box-sizing: border-box; cursor: pointer; display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 2px; }
.list button.row:hover .t { text-decoration: underline; }
.list button.row:focus-visible { outline: 2px solid var(--lime); }
.list .t { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .s { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.empty { color: var(--muted); padding: 8px 0; }

/* Request cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { all: unset; box-sizing: border-box; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; grid-template-columns: 1fr 86px; gap: 4px 12px; }
.card:hover { border-color: var(--ink); }
.card:focus-visible { outline: 2px solid var(--lime); }
.card h3 { margin: 0; font-size: 1.3rem; grid-column: 1; }
.card .where { color: var(--muted); font-size: .9rem; grid-column: 1; }
.card .mini { grid-column: 2; grid-row: 1 / span 3; }
.card .terms { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .9rem; margin-top: 6px; }
.card .terms b { font-family: var(--display); font-size: 1.05rem; }
.card .foot { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; font-size: .9rem; }
.match-n { font-weight: 600; }
.match-n.has { color: var(--ok); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; min-width: 760px; }
thead th { text-align: left; font-weight: 600; font-size: .85rem; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--bg); }
td.name { font-weight: 600; white-space: nowrap; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.soon { color: var(--warn); font-weight: 600; }

/* Drawer */
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(520px, 100%);
  background: var(--surface); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .2s ease; z-index: 20;
  display: flex; flex-direction: column; overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 18px 22px 8px; }
.drawer h2 { margin: 0; font-size: 1.6rem; }
.tabs { display: flex; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--line); }
.tabs:empty { display: none; }
.tabs button { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted); padding: 8px 10px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
#dPanel { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px 22px; }
.drawer-foot { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 12px 22px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: var(--surface); }
.open-notion { font-weight: 600; font-size: .9rem; }
.scrim { position: fixed; inset: 0; background: rgba(10, 12, 8, .4); z-index: 10; }

/* Form */
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label { font-size: .85rem; font-weight: 600; color: var(--muted); }
.form input[type=text], .form input[type=number], .form input[type=date], .form textarea, .form select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink);
}
.form textarea { resize: vertical; }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opts, .rel { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.opts .pill[aria-pressed="true"] { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); font-weight: 600; }
.opt-new { width: 130px !important; padding: 3px 10px !important; border-radius: 999px !important; font-size: .9rem; }
.rel .x { background: none; border: 0; padding: 0 0 0 4px; font-weight: 700; color: var(--muted); }
.rel select { width: auto; max-width: 100%; }
.check { display: flex; gap: 8px; align-items: center; }
.ro { color: var(--muted); }
details.more summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: 4px 0; }
details.more .form { margin-top: 12px; }

/* Matches */
.match { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; margin-bottom: 8px; }
.match .who { font-weight: 600; }
.match .who small { color: var(--muted); font-weight: 400; }
.match .why { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; font-size: .82rem; }
.why .y { color: var(--ok); }
.why .n { color: var(--warn); }
.why .q { color: var(--muted); }
.why span { border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.match .act { display: flex; gap: 6px; }
.match .act button { padding: 4px 10px; font-size: .88rem; }
.proposed { color: var(--ok); font-weight: 600; font-size: .88rem; }

/* Mobile */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .rail { order: 2; flex-direction: row; padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px)); gap: 0; overflow-x: auto; overflow-y: hidden; }
  .brand, .rail-out, #nav .sep, #nav .count { display: none; }
  #nav { display: flex; gap: 0; flex: 1; }
  #nav li { flex: 1; }
  #nav li.extra { display: none; }
  #nav button { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: .75rem; justify-content: center; }
  #nav button .ico { font-size: 1.15rem; width: auto; }
  #nav button[aria-current="true"] { box-shadow: inset 0 3px 0 var(--lime); }
  .bar { padding: 14px 16px 10px; }
  .bar h1 { font-size: 1.6rem; }
  .tools { width: 100%; }
  .tools input { flex: 1; max-width: none; width: auto; }
  .filters { padding: 10px 16px 0; overflow-x: auto; flex-wrap: nowrap; }
  .fgroup { flex-wrap: nowrap; }
  .view { padding: 12px 16px 24px; }
  .home { grid-template-columns: 1fr; }
  .pitch-panel { grid-row: auto; }
  .status { padding: 0 16px; }
}
@media (prefers-reduced-motion: reduce) { .drawer { transition: none; } }

/* Contact lists */
.groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.group-card { all: unset; box-sizing: border-box; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: grid; gap: 2px; align-content: start; }
.group-card:hover { border-color: var(--ink); }
.group-card:focus-visible { outline: 2px solid var(--lime); }
.group-card .n { font-family: var(--display); font-weight: 700; font-size: 2.4rem; line-height: 1; }
.group-card .g { font-family: var(--display); font-weight: 700; font-size: 1.25rem; }
.group-card .r { color: var(--muted); font-size: .88rem; }
.pill b { font-weight: 700; margin-left: 2px; }

/* Discoveries */
.chip.urgent { background: #c81e1e; color: #fff; font-weight: 700; }
.card.disc { grid-template-columns: 1fr; }
.card.disc.top { border: 2px solid #c81e1e; box-shadow: 0 0 0 4px rgba(200, 30, 30, .12); }
.card.disc .terms .full { flex-basis: 100%; color: var(--muted); }
.card .act { display: flex; gap: 6px; }
.card .act button { padding: 4px 10px; font-size: .88rem; }
.followup { border-color: #c81e1e; }
.view-tools { display: flex; justify-content: flex-end; margin-bottom: 12px; }

/* Contact actions */
.with-act { display: flex; gap: 8px; align-items: center; }
.with-act input { flex: 1; min-width: 0; }
.act-link { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: .85rem; font-weight: 600; text-decoration: none; background: var(--surface); }
.act-link:hover { border-color: var(--ink); }
.act-link.wa { background: #25d366; border-color: #25d366; color: #0b2e17; }
.card .contacts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.form input.filled { border-color: var(--ok); background: var(--lime-soft); }
.form input[type=url], .form input[type=tel] { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }

/* Clubs that fit, on a player profile */
.fits { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; background: var(--bg); }
.fits h3 { margin: 0 0 8px; font-size: 1.1rem; }
.fit-club { all: unset; box-sizing: border-box; cursor: pointer; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; width: 100%; padding: 6px 0; border-top: 1px solid var(--line); }
.fit-club:first-of-type { border-top: 0; }
.fit-club span { color: var(--muted); font-size: .88rem; }
.fit-club:hover b { text-decoration: underline; }

/* GBE */
.gbe { display: inline-grid; place-items: center; min-width: 38px; padding: 1px 6px; border-radius: 6px; font-family: var(--display); font-weight: 700; font-size: .95rem; }
.gbe.ok { background: #1f8a3b; color: #fff; }
.gbe.mid { background: #f2c230; color: #1b1d18; }
.gbe.bad { background: #c81e1e; color: #fff; }
.gbe.none { color: var(--muted); }
.gbe-box { border: 1px solid var(--line); border-left: 6px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; background: var(--bg); display: grid; gap: 10px; }
.gbe-box.ok { border-left-color: #1f8a3b; } .gbe-box.mid { border-left-color: #f2c230; } .gbe-box.bad { border-left-color: #c81e1e; }
.gbe-head { display: grid; gap: 2px; } .gbe-head b { font-family: var(--display); font-size: 1.35rem; }
.gbe-parts { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.gbe-parts li { display: flex; justify-content: space-between; gap: 10px; font-size: .92rem; border-bottom: 1px dashed var(--line); padding-bottom: 3px; }
.gbe-parts li.tot { border: 0; font-weight: 700; }
.gbe-box button { justify-self: start; }
.settings { display: grid; gap: 16px; max-width: 900px; }
.settings textarea, .settings input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font-family: ui-monospace, Menlo, monospace; font-size: .88rem; }
