:root {
  --bg: #f6f7f8; --surface: #ffffff; --surface2: #eef1f2; --line: #dde2e5;
  --text: #14201f; --muted: #5d6b6a; --accent: #0f766e; --accent-ink: #ffffff;
  --accent-soft: #d9f0ed; --warn: #9a5b00; --warn-soft: #fff1d6; --course: #6d3fc4; --course-soft: #ece4fb;
  --shadow: 0 1px 2px rgba(16,32,31,.06), 0 4px 14px rgba(16,32,31,.05);
  --r: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1413; --surface: #161e1d; --surface2: #1e2928; --line: #2b3837;
    --text: #e8efee; --muted: #9aaaa8; --accent: #3fc1b3; --accent-ink: #06201d;
    --accent-soft: #143b37; --warn: #f0be6a; --warn-soft: #3a2c10; --course: #b79cf2; --course-soft: #2b2145;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: calc(14px + env(safe-area-inset-top)) 20px 0; max-width: 1280px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--accent); }
.brand h1 { font-size: 20px; letter-spacing: -.01em; color: var(--text); }
.brand p { font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 4px; background: var(--surface2); padding: 4px; border-radius: 10px; }
.tabs button { border: 0; background: none; padding: 7px 14px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.pill { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; text-align: center; }

.searchbar {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 8px;
  padding: 12px 20px; max-width: 1280px; margin: 0 auto; background: var(--bg);
}
.searchbar input {
  flex: 1; min-width: 0; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); font-size: 16px; outline: none;
}
.searchbar input:focus, .filters input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#filterToggle { display: none; }

.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 20px; max-width: 1280px; margin: 0 auto; padding: 0 20px 60px; align-items: start; }
.filters {
  position: sticky; top: 70px; max-height: calc(100vh - 86px); overflow: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 16px 16px;
}
.filters section { padding: 14px 0; border-bottom: 1px solid var(--line); }
.filters h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 9px; display: flex; justify-content: space-between; align-items: center; }
.link { border: 0; background: none; color: var(--accent); font-size: 12px; padding: 0; text-transform: none; letter-spacing: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 11px;
  font-size: 13px; color: var(--text); line-height: 1.3;
}
.chip .n { color: var(--muted); font-size: 11px; margin-left: 3px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.on .n { color: inherit; opacity: .8; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface2); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: none; border-radius: 7px; padding: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.filters input[type="search"], .filters input[type="month"] {
  width: 100%; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); outline: none; font-size: 14px;
}
.checklist { max-height: 190px; overflow: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.checklist label { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; font-size: 14px; }
.checklist label:hover { background: var(--surface2); }
.checklist .n { margin-left: auto; color: var(--muted); font-size: 12px; }
.checklist .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 6px 2px; }
.daterow { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.daterow label { font-size: 12px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 3px 0; }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

.btn {
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 14px;
}
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn.full { width: 100%; margin-top: 14px; }
.btn:disabled { opacity: .45; cursor: default; }

.resultbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
#count { color: var(--muted); font-size: 14px; }
#count b { color: var(--text); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.month { position: sticky; top: 62px; z-index: 2; background: var(--bg); padding: 14px 2px 8px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.card {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 14px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 8px;
}
.card.past { opacity: .6; }
.date { text-align: center; background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 8px 4px; font-weight: 700; line-height: 1.15; }
.date .d { font-size: 20px; }
.date .m { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.date .y { font-size: 11px; font-weight: 500; opacity: .8; }
.card.course .date { background: var(--course-soft); color: var(--course); }
.card.tbc .date { background: var(--warn-soft); color: var(--warn); }
.card h3 { font-size: 16px; line-height: 1.3; letter-spacing: -.005em; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.meta { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.meta b { color: var(--text); font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: var(--surface2); color: var(--muted); }
.tag.type { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag.type.course { background: var(--course-soft); color: var(--course); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.cardbtns { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.star { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.star.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.org { grid-template-columns: minmax(0, 1fr) auto; }
.empty { text-align: center; color: var(--muted); padding: 50px 20px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.foot { color: var(--muted); font-size: 12.5px; margin-top: 26px; line-height: 1.6; }
.foot a { color: var(--accent); }

.menu {
  position: absolute; z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 5px; min-width: 210px;
}
.menu button, .menu a { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 7px; font-size: 14px; color: var(--text); text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--surface2); }
.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; max-width: calc(100vw - 32px);
}
[hidden] { display: none !important; }

@media (max-width: 860px) {
  .top { padding-left: 16px; padding-right: 16px; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding: 7px 6px; }
  .searchbar { padding: 10px 16px; }
  #filterToggle { display: inline-flex; align-items: center; gap: 6px; }
  .layout { grid-template-columns: minmax(0, 1fr); padding: 0 16px 60px; gap: 10px; }
  .filters { position: static; max-height: none; display: none; }
  .filters.open { display: block; }
  .month { top: 62px; }
  .card { grid-template-columns: 54px minmax(0, 1fr); gap: 11px; padding: 12px; }
  .cardbtns { grid-column: 1 / -1; flex-direction: row; }
  .cardbtns > * { flex: 1; }
  .org { grid-template-columns: minmax(0, 1fr); }
  .actions, .actions .btn { width: 100%; }
}

/* ───────── Refreshed look (matches the iPhone app) ───────── */
:root { --congress: #0f766e; --course-c: #6d3fc4; --symposium: #3869d4; --trade: #d9731a; --tbc-c: #b26b00; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--surface); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); border-top: 3px solid var(--congress); }
.stat.s-courses { border-top-color: var(--course-c); }
.stat.s-countries { border-top-color: var(--trade); }
.stat b { display: block; font-size: 26px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat span { font-size: 12.5px; color: var(--muted); }

.month { display: flex; justify-content: space-between; align-items: baseline; text-transform: none; letter-spacing: -.01em; font-size: 19px; font-weight: 800; color: var(--text); padding-top: 18px; }
.month .yr { color: var(--muted); font-weight: 500; margin-left: 6px; }
.month .n { font-size: 12px; font-weight: 700; background: var(--surface2); color: var(--muted); padding: 2px 9px; border-radius: 999px; }

.card { --t: var(--congress); border: 0; border-radius: 18px; box-shadow: var(--shadow); padding: 14px; margin-bottom: 10px; transition: transform .12s ease, box-shadow .12s ease; }
.card:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(16,32,31,.06), 0 10px 24px rgba(16,32,31,.08); }
.card.t-course { --t: var(--course-c); }
.card.t-symposium { --t: var(--symposium); }
.card.t-trade { --t: var(--trade); }
.card.tbc { --t: var(--tbc-c); }
.card .date, .card.tbc .date {
  background: linear-gradient(135deg, color-mix(in srgb, var(--t) 78%, white), var(--t)); color: #fff;
  border-radius: 15px; padding: 9px 4px; box-shadow: 0 5px 12px color-mix(in srgb, var(--t) 30%, transparent);
}
.date .m { font-size: 11px; font-weight: 800; opacity: .92; }
.date .d { font-size: 23px; font-weight: 800; }
.date .y { font-size: 10.5px; opacity: .85; }
.card h3 { font-size: 16.5px; font-weight: 700; }
.tag { border-radius: 999px; padding: 3px 9px; }
.tag.type, .tag.type.course { background: color-mix(in srgb, var(--t) 14%, transparent); color: color-mix(in srgb, var(--t) 78%, var(--text)); }
.sub { font-size: 12px; color: var(--muted); opacity: .8; margin-top: 7px; }
.card .btn.small { background: var(--t); border-color: var(--t); color: #fff; border-radius: 999px; padding: 6px 14px; }
.card .btn.small.ghost { background: var(--surface); color: var(--text); border-color: var(--line); }
.star { border-radius: 999px; padding: 6px 14px; }
.star.on { background: color-mix(in srgb, #f5c400 22%, var(--surface)); border-color: #e0b400; color: color-mix(in srgb, #8a6a00 70%, var(--text)); }
.chip { box-shadow: 0 1px 1px rgba(16,32,31,.04); }
.filters { border: 0; box-shadow: var(--shadow); border-radius: 18px; }
.searchbar input { border-radius: 14px; box-shadow: var(--shadow); border-color: transparent; }
.empty { border-radius: 18px; }
@media (max-width: 860px) { .stat b { font-size: 22px; } .stat { padding: 10px 12px; } }
