/* UAFL Forums - "Modern" look (tokens and shared controls are in ../../assets/modern-base.css). Everything here is scoped to html.modern; Classic (Delphi) lives in classic.css.
   Same DOM, same app.js: the look is switched by a class on <html>, so nothing re-renders and nothing is lost. */

/* buttons */
html.modern .btn-green, html.modern .btn-grey, html.modern .btn-red, html.modern .m-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  font: 600 14px/1 var(--font); border-radius: var(--r-sm); border: 1px solid transparent; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background-color .15s, border-color .15s, box-shadow .15s, transform .1s; }
html.modern .btn-green, html.modern .m-btn-primary { background: var(--btn); color: var(--btn-ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .12), inset 0 1px 0 rgba(255, 255, 255, .14); }
html.modern .btn-green:visited, html.modern .m-btn-primary:visited { color: var(--btn-ink); }
html.modern .btn-green:hover, html.modern .m-btn-primary:hover { background: var(--btn-hover); }
html.modern .btn-grey, html.modern .m-btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--sh-1); }
html.modern .btn-grey:hover, html.modern .m-btn-ghost:hover { background: var(--surface-2); }
html.modern .btn-red { background: var(--danger); color: #fff; }
html.modern[data-theme="dark"] .btn-red { color: #2a0603; }
html.modern .btn-green:active, html.modern .btn-grey:active, html.modern .m-btn:active, html.modern .btn-tool:active { transform: translateY(1px); }
html.modern .btn-green .mi, html.modern .btn-grey .mi, html.modern .m-btn .mi { width: 17px; height: 17px; }

/* ---------- header ---------- */
html.modern .m-head { position: sticky; top: 0; z-index: 30; background: var(--glass); border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px); }
html.modern .m-head-in { max-width: 1320px; margin: 0 auto; height: 64px; padding: 0 24px; display: flex; align-items: center; gap: 18px; }
html.modern .m-search { position: relative; flex: 1 1 auto; max-width: 520px; margin: 0 auto; }
html.modern .m-search .mi { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
html.modern .m-search input { width: 100%; height: 40px; padding: 0 44px 0 40px; font: 400 14.5px var(--font); color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 11px; transition: border-color .15s, box-shadow .15s, background-color .15s; }
html.modern .m-search input::placeholder { color: var(--muted); }
html.modern .m-search input:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: var(--ring); }
html.modern .m-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
html.modern .m-search input:focus ~ kbd { opacity: 0; }
html.modern .m-actions { display: flex; align-items: center; gap: 8px; flex: none; }
html.modern .m-iconbtn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; border: 0; background: transparent;
  color: var(--text-2); cursor: pointer; text-decoration: none; transition: background-color .15s, color .15s; }
html.modern .m-iconbtn:hover { background: var(--surface-2); color: var(--text); }
html.modern .m-iconbtn .mi { width: 20px; height: 20px; }
html.modern .m-count { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--btn);
  color: var(--btn-ink); font: 700 10.5px/17px var(--font); text-align: center; box-shadow: 0 0 0 2px var(--surface); }
html.modern .m-count[hidden] { display: none; }
html.modern .m-menu { display: none; }
html.modern .m-dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
html.modern .m-dot[hidden] { display: none; }

/* account menu */
html.modern .m-who { position: relative; }
html.modern .m-user > summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 4px; border-radius: 12px; cursor: pointer;
  font: 600 14px/1 var(--font); color: var(--text); transition: background-color .15s; }
html.modern .m-user > summary::-webkit-details-marker { display: none; }
html.modern .m-user > summary:hover, html.modern .m-user[open] > summary { background: var(--surface-2); }
html.modern .m-caret { width: 16px; height: 16px; color: var(--muted); transition: transform .2s; }
html.modern .m-user[open] .m-caret { transform: rotate(180deg); }
html.modern .m-user-pop { position: absolute; right: 0; top: calc(100% + 8px); width: 248px; padding: 6px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--sh-pop); z-index: 40; animation: m-pop .16s ease-out; }
html.modern .mu-head { display: flex; gap: 10px; align-items: center; padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--border); line-height: 1.35; }
html.modern .m-user-pop a, html.modern .m-user-pop button { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; font: 500 14px var(--font);
  color: var(--text); background: none; border: 0; cursor: pointer; text-decoration: none; }
html.modern .m-user-pop a:hover, html.modern .m-user-pop button:hover { background: var(--surface-2); }
html.modern .m-login { height: 36px; }

/* avatars: team badges in soft tiles */
html.modern .av { display: inline-grid; place-items: center; flex: none; background: var(--surface-2); border: 1px solid var(--border); }
html.modern .av-sm { width: 26px; height: 26px; border-radius: 8px; }
html.modern .av-md { width: 34px; height: 34px; border-radius: 10px; }
html.modern .av-lg { width: 46px; height: 46px; border-radius: 13px; }
html.modern[data-theme="dark"] .av { background: #1a2540; }

/* ---------- layout ---------- */
html.modern .layout { max-width: 1320px; margin: 0 auto; padding: 28px 24px 72px; display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 36px; align-items: start; }
html.modern .sidebar { position: sticky; top: 92px; max-height: calc(100vh - 110px); overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 2px; }
html.modern .main { min-width: 0; max-width: 880px; display: flex; flex-direction: column; }
html.modern .main > * { animation: m-in .24s cubic-bezier(.2, .8, .2, 1) both; }

/* rail */
html.modern .rail-top { display: flex; gap: 8px; margin-bottom: 18px; }
html.modern .rail-new { flex: 1; height: 42px; }
html.modern .rail-close { display: none; }
html.modern .rail-nav, html.modern .rail-folders { list-style: none; margin: 0; padding: 0; }
html.modern .rail-nav a, html.modern .rail-folders a { display: flex; align-items: center; gap: 11px; padding: 7px 10px; border-radius: 9px; color: var(--text-2);
  text-decoration: none; font: 500 14px/1.35 var(--font); transition: background-color .15s, color .15s; }
html.modern .rail-nav a:hover, html.modern .rail-folders a:hover { background: var(--surface-3); color: var(--text); }
html.modern .rail-nav a.on, html.modern .rail-folders a.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--sh-1), 0 0 0 1px var(--border); }
html.modern[data-theme="dark"] .rail-nav a.on, html.modern[data-theme="dark"] .rail-folders a.on { background: var(--surface-2); }
html.modern .rail-nav .mi { color: var(--muted); }
html.modern .rail-nav a.on .mi { color: var(--accent-ink); }
html.modern .rail-h { margin: 22px 10px 6px; font: 600 11.5px/1 var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
html.modern .rf-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.modern .rf-count { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
html.modern .pill { margin-left: auto; display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; background: var(--accent-bg);
  color: var(--accent-ink); font: 650 12px/1 var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; }
html.modern .fdot { width: 9px; height: 9px; border-radius: 3px; flex: none; background: var(--muted); margin: 0 3px; }
html.modern .fd-rs { background: #3b82f6; } html.modern .fd-wv { background: #8b5cf6; } html.modern .fd-inj { background: #ef4444; }
html.modern .fd-ln { background: #e8591c; } html.modern .fd-sch { background: #64748b; } html.modern .fd-gw { background: #10b981; }
html.modern .fd-tr { background: #f59e0b; } html.modern .fd-dr { background: #ec4899; } html.modern .fd-fa { background: #06b6d4; }
html.modern .rail-foot { margin-top: 18px; padding: 14px 10px 4px; border-top: 1px solid var(--border); }
html.modern .rail-foot .m-btn { width: 100%; height: 36px; font-size: 13px; }
html.modern .rail-foot p { margin: 10px 0 0; font-size: 12px; }

/* ---------- page headings ---------- */
html.modern .main > h2#page-h:not(.crumb) { font: 700 28px/1.2 var(--font-display); letter-spacing: -.025em; margin: 2px 0 18px; color: var(--text); }
html.modern .crumb { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin: 2px 0 8px; font: 700 30px/1.18 var(--font-display); letter-spacing: -.028em; color: var(--text); }
html.modern .crumb-folder { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 12px 0 8px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--sh-1); color: var(--text-2); font: 600 13px/1 var(--font); letter-spacing: 0; text-decoration: none; }
html.modern .crumb-folder:hover { color: var(--text); border-color: var(--border-strong); }
html.modern .crumb-sep, html.modern .crumb-title ~ .views { display: none; }
html.modern .crumb > .maroon { color: var(--text); }
html.modern .crumb .views { font: 400 15px var(--font); color: var(--muted); letter-spacing: 0; }
html.modern .crumb .small { font: 500 15px var(--font); letter-spacing: 0; color: var(--muted); }
html.modern .crumb-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 0 0 22px; color: var(--muted); font-size: var(--fs-sm); }
html.modern .crumb-meta .mi { width: 15px; height: 15px; margin-right: -4px; vertical-align: -3px; }

/* ---------- message card ---------- */
html.modern .msg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 22px 26px 20px; margin: 0 0 16px; }
html.modern .m-msg-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; }
html.modern .mm-line1 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
html.modern .author { font-weight: 650; color: var(--text); text-decoration: none; }
html.modern .author:hover { color: var(--accent-ink); text-decoration: underline; }
html.modern .mm-line2 { font-size: var(--fs-sm); color: var(--muted); }
html.modern .mm-line2 .author { font-weight: 600; color: var(--text-2); }
html.modern .mm-when { text-align: right; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; }
html.modern .mm-ref { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 1px; }
html.modern .msgno { font: 500 12px var(--mono); color: var(--muted); text-decoration: none; }
html.modern .msgno:hover { color: var(--accent-ink); }
html.modern .mm-inreply { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; }
html.modern .mm-inreply .mi { width: 13px; height: 13px; }
html.modern .mm-inreply a { color: var(--muted); }
html.modern .chip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 6px; font: 650 11.5px/1 var(--font); letter-spacing: .01em; }
html.modern .chip .mi { width: 12px; height: 12px; }
html.modern .chip-host { background: var(--navy-bg); color: var(--navy); }
html.modern .chip-new { background: var(--accent-bg); color: var(--accent-ink); }
html.modern .chip-you { background: var(--surface-3); color: var(--text-2); }
html.modern .msg-body { padding: 18px 0 0; max-width: 70ch; font-size: calc(var(--fs) + 1px); line-height: 1.7; color: var(--text); overflow-wrap: anywhere; }
html.modern .msg-body p { margin: 0 0 14px; }
html.modern .msg-body p:last-child { margin-bottom: 0; }
html.modern .msg-body strong { font-weight: 650; }
html.modern .quote { margin: 4px 0 16px; padding: 12px 16px; background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: 4px 12px 12px 4px; color: var(--text-2); font-size: .95em; }
html.modern .quote .quote { background: var(--surface-3); border-left-color: var(--border-strong); }
html.modern .quote p { margin: 0 0 8px; }
html.modern .quote p:last-child { margin-bottom: 0; }
html.modern .quote-cite { font: 600 12.5px var(--font) !important; color: var(--muted); }
html.modern .sig { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
html.modern .sig-rule { display: none; }
html.modern .sig-inner { display: flex; align-items: center; gap: 10px; }
html.modern .sig-badge { line-height: 0; border-radius: 6px; }
html.modern .sig-badge svg { width: 22px; height: auto; }
html.modern .sig-text { font-size: var(--fs-sm); color: var(--muted); line-height: 1.45; }
html.modern .sig-text strong { color: var(--text-2); font-weight: 600; }
html.modern .sig-text br { display: none; }
html.modern .sig-text em::before { content: " \00b7  "; font-style: normal; }

/* actions under a message */
html.modern .msg-tools { margin: 0 0 26px; }
html.modern .msg-tools ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
html.modern .bt-gap { margin-left: auto; }
html.modern .btn-tool { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: var(--r-sm); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--sh-1); color: var(--text); font: 550 14px/1 var(--font); text-decoration: none;
  transition: background-color .15s, border-color .15s, transform .1s; }
html.modern .btn-tool:hover { background: var(--surface-2); border-color: var(--border-strong); }
html.modern .btn-tool .mi { width: 17px; height: 17px; color: var(--muted); }
html.modern .btn-tool.bt-primary { background: var(--btn); color: var(--btn-ink); border-color: transparent; }
html.modern .btn-tool.bt-primary .mi { color: inherit; }
html.modern .btn-tool.bt-primary:hover { background: var(--btn-hover); }
html.modern .btn-tool.off { color: var(--muted); background: transparent; box-shadow: none; border-style: dashed; }
html.modern .msg-pos { margin: 10px 2px 0; font-size: 12.5px; color: var(--muted); text-align: right; }

/* outline / "In this discussion" */
html.modern .thread-outline { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 18px 18px 14px; }
html.modern .thread-outline h3 { display: flex; align-items: baseline; gap: 10px; margin: 0 6px 10px; font: 650 15px var(--font-display); }
html.modern .thread-outline h3 .small { margin-left: auto; font: 500 13px var(--font); }
html.modern .outline-tree ul { list-style: none; margin: 0 0 0 18px; padding: 0 0 0 14px; border-left: 2px solid var(--border); }
html.modern .outline-tree > ul { margin: 0; padding: 0; border: 0; }
html.modern .outline-tree li { margin: 1px 0; }
html.modern .ol-row { position: relative; display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 10px; transition: background-color .15s; }
html.modern .ol-row:hover { background: var(--surface-2); }
html.modern .ol-row.current { background: var(--accent-bg); }
html.modern .ol-row a { flex: 1; min-width: 0; color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
html.modern .ol-row a::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }   /* whole row clickable */
html.modern .ol-row a:focus-visible { outline: none; }
html.modern .ol-row:has(a:focus-visible) { outline: 2px solid var(--accent-ink); outline-offset: 1px; }
html.modern .ol-row strong { font-weight: 600; }
html.modern .ol-colon { display: none; }
html.modern .ol-snip { color: var(--muted); margin-left: 8px; }
html.modern .ol-row.current .ol-snip { color: var(--text-2); }
html.modern .ol-when { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
html.modern .ol-row .newflag { order: 9; flex: none; width: 8px; height: 8px; padding: 0; border-radius: 50%; background: var(--accent); font-size: 0; color: transparent; overflow: hidden; }
html.modern .ol-folder { margin-bottom: 18px; }
html.modern .ol-folder .folder-bar { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font: 650 16px var(--font-display); }
html.modern .ol-folder .folder-bar a { color: var(--text); text-decoration: none; }
html.modern .ol-thread { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); margin: 0 0 8px; padding: 4px 10px; }
html.modern .ol-thread summary { cursor: pointer; padding: 8px 4px; font-weight: 600; border-radius: 8px; }
html.modern .ol-thread .t-count { font-weight: 400; color: var(--muted); font-size: var(--fs-sm); }

/* whole discussion (threaded / by date) */
html.modern .viewswitch { margin: 0 0 18px; color: var(--muted); font-size: var(--fs-sm); }
html.modern .msg-compact { padding: 16px 20px 12px; }
html.modern .msg-compact .msg-body { padding-top: 12px; font-size: var(--fs); }
html.modern .msg-compact .m-msg-head .av-lg { width: 38px; height: 38px; border-radius: 11px; }
html.modern .msg-mini-tools { display: flex; gap: 6px; margin: 12px 0 0; }
html.modern .msg-mini-tools a { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px; color: var(--muted); font: 550 13px var(--font); text-decoration: none; }
html.modern .msg-mini-tools a:hover { background: var(--surface-2); color: var(--text); }
html.modern .msg-mini-tools .mi { width: 15px; height: 15px; }
html.modern .depth-1, html.modern .depth-2, html.modern .depth-3, html.modern .depth-4, html.modern .depth-5 { position: relative; }
html.modern .depth-1 { margin-left: 28px; } html.modern .depth-2 { margin-left: 56px; } html.modern .depth-3 { margin-left: 84px; }
html.modern .depth-4, html.modern .depth-5 { margin-left: 112px; }
html.modern [class*="depth-"]:not(.depth-0)::before { content: ""; position: absolute; left: -16px; top: -16px; bottom: 50%; width: 12px; border-left: 2px solid var(--border);
  border-bottom: 2px solid var(--border); border-bottom-left-radius: 10px; }

/* ---------- folder page: filter chips and thread cards ---------- */
html.modern .folder-actions { margin: 0 0 18px; }
html.modern .chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
html.modern .chip-btn { height: 32px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  font: 550 13px var(--font); cursor: pointer; transition: background-color .15s, color .15s, border-color .15s; }
html.modern .chip-btn:hover { border-color: var(--border-strong); color: var(--text); }
html.modern .chip-btn[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
html.modern .tcards { list-style: none; margin: 0 0 18px; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); overflow: hidden; }
html.modern .tcard + .tcard { border-top: 1px solid var(--border); }
html.modern .tc-link { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 18px; color: var(--text); text-decoration: none;
  transition: background-color .15s; }
html.modern .tc-link:hover { background: var(--surface-2); }
html.modern .tc-link:focus-visible { outline-offset: -2px; border-radius: 0; }
html.modern .tcards li:first-child .tc-link:focus-visible { border-radius: var(--r-lg) var(--r-lg) 0 0; }
html.modern .tc-body { min-width: 0; }
html.modern .tc-title { display: flex; align-items: center; gap: 8px; font: 550 15.5px/1.35 var(--font); color: var(--text-2); }
html.modern .tcard.unread .tc-title { font-weight: 650; color: var(--text); }
html.modern .udot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; box-shadow: 0 0 0 3px var(--accent-bg); }
html.modern .tc-meta { display: block; margin-top: 3px; font-size: var(--fs-sm); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.modern .tc-folder { display: inline-flex; align-items: center; gap: 2px; }
html.modern .tc-folder .fdot { width: 7px; height: 7px; border-radius: 2px; margin-left: 0; }
html.modern .tc-side { display: flex; align-items: center; gap: 14px; }
html.modern .tc-faces { display: flex; }
html.modern .tc-faces .av { margin-left: -7px; box-shadow: 0 0 0 2px var(--surface); }
html.modern .tc-faces .av:first-child { margin-left: 0; }
html.modern .tc-stat { display: inline-flex; align-items: center; gap: 5px; min-width: 3.2em; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
html.modern .tc-stat .mi { width: 16px; height: 16px; }
html.modern .tc-side .pill { margin-left: 0; min-width: 52px; justify-content: center; }
html.modern .empty { color: var(--muted); font-style: normal; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--r-lg); padding: 22px; text-align: center; }

/* ---------- ads (spoofs) become a quiet sponsored card at the end ---------- */
html.modern .adwrap { order: 50; margin: 28px 0 0; padding: 0; max-width: none; }
html.modern .ad { display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: hidden; box-shadow: var(--sh-1); }
html.modern .ad-mark { display: none; }
html.modern .ad-art svg { display: block; width: 132px; height: 80px; }
html.modern .ad-text { padding: 10px 16px; }
html.modern .ad-head { margin: 0 0 2px; font: 600 14.5px/1.35 var(--font); color: var(--text); }
html.modern .ad-src { margin: 0; font-size: 12px; color: var(--muted); }
html.modern .ad-src::before { content: "Sponsored (not really) \00b7  "; }
html.modern .ad-open { margin-right: 14px; display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--border);
  color: var(--text); font: 600 13px var(--font); text-decoration: none; }
html.modern .ad-open:hover { background: var(--surface-2); }
html.modern .adfree { margin: 8px 2px 0; font-size: 12px; color: var(--muted); }
html.modern .adfree strong { font-weight: 600; }

/* ---------- forms ---------- */
html.modern .composer, html.modern .search-form, html.modern .prefs, html.modern .notice, html.modern .replying-to {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 20px 22px; max-width: none; margin: 0 0 16px; }
html.modern .frow { display: flex; flex-direction: column; align-items: stretch; gap: 6px; margin: 0 0 16px; }
html.modern .frow:has(> span.flabel) { flex-direction: row; align-items: center; gap: 10px; }
html.modern .flabel { font: 600 13px var(--font); color: var(--text-2); min-width: 0; }
html.modern .flabel:empty { display: none; }
html.modern .frow > span:not(.flabel):not(.small) { display: inline-flex; align-items: center; gap: 8px; }
html.modern .frow > span .badge { width: 16px; height: auto; }
html.modern input[type="text"], html.modern input[type="search"]:not(#top-q), html.modern select, html.modern textarea {
  font: 400 15px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s; }
html.modern input[type="text"], html.modern input[type="search"]:not(#top-q), html.modern select { height: 42px; padding: 0 12px; width: 100%; }
html.modern select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
html.modern input:focus, html.modern select:focus, html.modern textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
html.modern input[readonly] { background: var(--surface-2); color: var(--muted); }
html.modern .editor { border: 1px solid var(--border-strong); border-radius: var(--r-md); overflow: hidden; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
html.modern .editor:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
html.modern .editor textarea { display: block; width: 100%; min-height: 220px; padding: 14px 16px; border: 0; border-radius: 0; resize: vertical; line-height: 1.6; box-shadow: none; }
html.modern .editor textarea:focus { box-shadow: none; }
html.modern .fmt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
html.modern .fmt-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2);
  font: 550 13px var(--font); cursor: pointer; }
html.modern .fmt-btn:hover { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
html.modern .fmt-btn .mi { width: 16px; height: 16px; }
html.modern .fmt-hint { margin-left: auto; padding-right: 6px; font: 500 12px var(--mono); color: var(--muted); }
html.modern .frow.actions { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0 0; }
html.modern .frow.actions > a { margin-left: 4px; font-weight: 500; }
html.modern .search-form .frow:has(input[type="checkbox"]) { flex-direction: row; }
html.modern input[type="checkbox"], html.modern input[type="radio"] { accent-color: var(--btn); width: 17px; height: 17px; margin: 0; flex: none; }
html.modern .err { background: var(--danger-bg); border: 1px solid var(--danger-line); color: var(--danger); padding: 10px 14px; border-radius: var(--r-sm); margin-bottom: 14px; font-weight: 500; }
html.modern .preview h3 { font: 600 13px var(--font); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 20px 0 8px; }
html.modern .preview .msg { border-style: dashed; box-shadow: none; }
html.modern .replying-to { padding: 4px 18px; }
html.modern .replying-to summary { cursor: pointer; padding: 10px 0; font-weight: 600; color: var(--text-2); }
html.modern .replying-to .msg-body { padding: 0 0 14px; font-size: var(--fs); }
html.modern .prefs fieldset { border: 0; padding: 0; margin: 0 0 20px; }
html.modern .prefs legend { font: 650 15px var(--font-display); margin-bottom: 8px; padding: 0; }
html.modern .opt { display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin: 0 0 6px; border: 1px solid var(--border); border-radius: var(--r-sm); cursor: pointer;
  transition: border-color .15s, background-color .15s; }
html.modern .opt:hover { border-color: var(--border-strong); }
html.modern .opt:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
html.modern .notice p { margin: 0 0 12px; }
html.modern .notice p:last-child { margin: 0; }

/* ---------- start page, panels, tables, lists ---------- */
html.modern .welcome { display: flex; gap: 20px; align-items: flex-start; padding: 24px 26px; margin: 0 0 20px; border-radius: 20px; border: 1px solid var(--border);
  background: radial-gradient(120% 140% at 100% 0%, var(--accent-bg) 0%, transparent 55%), var(--surface); box-shadow: var(--sh-1); }
html.modern .welcome p { margin: 0 0 10px; color: var(--text-2); }
html.modern .welcome p:first-child { font-size: 17px; color: var(--text); }
html.modern .welcome-badge svg { width: 56px; height: auto; }
html.modern .start-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
html.modern .panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: 18px 20px; margin: 0 0 16px; min-width: 0; }
html.modern .start-grid .panel { margin: 0; }
html.modern .panel h3 { margin: 0 0 12px; font: 650 15px var(--font-display); color: var(--text); }
html.modern .panel-latest { grid-column: 1 / -1; order: -1; padding-bottom: 6px; }
html.modern .start-grid > .panel { grid-column: 1 / -1; }
@media (min-width: 801px) { html.modern .standings th, html.modern .standings td { white-space: nowrap; } }
html.modern .m-brand-h { margin: 0; font: inherit; letter-spacing: normal; display: flex; flex: none; }
html.modern .start-grid .fixtures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
html.modern .start-grid .fixtures li:nth-last-child(2) { border-bottom: 0; }
html.modern .panel-latest .tcards { border: 0; box-shadow: none; border-radius: 0; margin: 0 -20px; background: transparent; }
html.modern .panel-latest .tc-link { padding: 12px 20px; }
html.modern .members-strip { margin-top: 16px; }
html.modern .stats { margin-top: 10px; text-align: center; }
html.modern .tablewrap { overflow-x: auto; }
html.modern .grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; font-size: 14px; }
html.modern .grid th, html.modern .grid td { padding: 9px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
html.modern .grid tbody tr:last-child > * { border-bottom: 0; }
html.modern .grid thead th { background: var(--surface-2); color: var(--muted); font: 600 11.5px var(--font); text-transform: uppercase; letter-spacing: .05em; }
html.modern .grid tbody th { font-weight: 550; white-space: nowrap; }
html.modern .grid tbody th .badge, html.modern .grid tbody td .badge { display: inline-block; vertical-align: -4px; margin-right: 6px; }
html.modern .grid tbody tr:hover > * { background: var(--surface-2); }
html.modern .standings td:not(:first-child) { font-variant-numeric: tabular-nums; }
html.modern .panel .grid { border-radius: var(--r-sm); }
html.modern .fixtures, html.modern .latest, html.modern .results { list-style: none; margin: 0; padding: 0; }
html.modern .fixtures li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-weight: 500; }
html.modern .fixtures li:last-child { border-bottom: 0; }
html.modern .fixtures .badge { display: inline-block; }
html.modern .fixtures .at { color: var(--muted); font-size: 12px; font-weight: 400; padding: 0 2px; }
html.modern .latest, html.modern .results { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1); overflow: hidden; }
html.modern .panel .latest { border: 0; box-shadow: none; border-radius: 0; margin: 0 -20px; background: transparent; }
html.modern .latest li, html.modern .results li { padding: 12px 18px; border-bottom: 1px solid var(--border); }
html.modern .latest li:last-child, html.modern .results li:last-child { border-bottom: 0; }
html.modern .latest .newflag { display: inline-flex; vertical-align: 1px; height: 18px; align-items: center; padding: 0 6px; border-radius: 5px; background: var(--accent-bg); color: var(--accent-ink); font: 650 10.5px var(--font); letter-spacing: .04em; }
html.modern .results li > a { font-weight: 600; text-decoration: none; color: var(--text); }
html.modern .results li > a:hover { color: var(--accent-ink); }
html.modern .snip { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
html.modern .result-count { margin: 4px 2px 12px; color: var(--muted); }
html.modern .badges { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
html.modern .badges a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px 10px; border-radius: var(--r-md); text-align: center; text-decoration: none; color: var(--text);
  font-weight: 550; font-size: 13.5px; transition: background-color .15s, transform .15s; }
html.modern .badges a:hover { background: var(--surface-2); transform: translateY(-1px); }
html.modern .badges a svg { width: 34px; height: auto; margin-bottom: 4px; }
html.modern .badges .small { font-size: 11.5px; font-weight: 400; }
html.modern .member { display: flex; gap: 22px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--sh-1); padding: 22px 24px; margin: 0 0 16px; }
html.modern .member-badge { display: grid; place-items: center; width: 112px; height: 112px; border-radius: 26px; background: var(--surface-2); border: 1px solid var(--border); flex: none; }
html.modern .member-badge svg { width: 68px; height: auto; }
html.modern .facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 14.5px; }
html.modern .facts dt { color: var(--muted); font-weight: 500; }
html.modern .facts dd { margin: 0; }
html.modern .upsell { border-style: dashed; }
html.modern .main > p { margin: 0 0 14px; }

/* ---------- dialogs ---------- */
html.modern dialog { padding: 0; width: min(580px, calc(100vw - 24px)); max-height: calc(100vh - 32px); border: 1px solid var(--border); border-radius: 20px; background: var(--surface); color: var(--text);
  box-shadow: var(--sh-pop); font: 400 var(--fs)/1.55 var(--font); }
html.modern dialog[open] { animation: m-pop .2s cubic-bezier(.2, .8, .2, 1); }
html.modern dialog::backdrop { background: rgba(8, 12, 24, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
html.modern dialog form { padding: 22px 24px 20px; }
html.modern dialog h2 { margin: 0 0 6px; font: 700 20px var(--font-display); }
html.modern .acct-pick { border: 0; padding: 2px; margin: 14px -2px 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; max-height: 52vh; overflow: auto; }
html.modern .acct { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); cursor: pointer; transition: border-color .15s, background-color .15s; }
html.modern .acct:hover { border-color: var(--border-strong); }
html.modern .acct:has(input:checked) { border-color: var(--accent); background: var(--accent-bg); }
html.modern .acct input { position: absolute; opacity: 0; width: 1px; height: 1px; }
html.modern .acct:has(input:focus-visible) { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
html.modern .acct span { display: flex; flex-direction: column; line-height: 1.3; font-size: 13.5px; min-width: 0; }
html.modern .acct .small { font-size: 12px; }
html.modern .dlg-actions { display: flex; gap: 10px; justify-content: flex-end; }
html.modern .keys { display: grid; grid-template-columns: max-content 1fr; gap: 10px 16px; margin: 16px 0 20px; font-size: 14px; }
html.modern .keys dd { margin: 0; color: var(--text-2); }

/* ---------- footer, toast ---------- */
html.modern .footer { max-width: 1320px; margin: 0 auto; padding: 28px 24px 48px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
html.modern .footer p { margin: 4px 0; max-width: 80ch; }
html.modern .footer strong { color: var(--text-2); }
html.modern .foot-look { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 16px; }
html.modern .toast { position: fixed; left: 50%; bottom: 24px; z-index: 70; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; max-width: calc(100vw - 32px);
  padding: 11px 16px; border-radius: 12px; background: var(--text); color: var(--surface); font: 550 14px var(--font); box-shadow: var(--sh-pop);
  transition: opacity .2s, transform .25s cubic-bezier(.2, .8, .2, 1); }
html.modern .toast.show { opacity: 1; transform: translate(-50%, 0); }
html.modern .fab { display: none; }
html.modern .m-scrim[hidden] { display: none; }
html.modern .newflag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px; background: var(--accent-bg); color: var(--accent-ink); font: 650 10.5px var(--font); letter-spacing: .04em; }

@keyframes m-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes m-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- tablet ---------- */
@media (max-width: 1080px) {
  html.modern .theme-switch:not(.foot-look .theme-switch) { display: none; }
  html.modern .m-user-name { display: none; }
  html.modern .layout { grid-template-columns: 220px minmax(0, 1fr); gap: 24px; }
}

/* ---------- phone: rail becomes a bottom sheet, thumb-friendly reply ---------- */
@media (max-width: 800px) {
  html.modern { --fs: 15px; }
  html.modern .m-head-in { height: auto; flex-wrap: wrap; gap: 8px 6px; padding: 8px 12px 10px; }
  html.modern .m-menu { display: inline-grid; margin-left: -6px; }
  html.modern .m-brand { gap: 8px; }
  html.modern .m-mark { width: 30px; height: 30px; }
  html.modern .m-word span { display: none; }
  html.modern .m-actions { margin-left: auto; gap: 6px; }
  html.modern .m-actions > .m-iconbtn { display: none; }
  html.modern .m-search { order: 10; flex: 1 1 100%; max-width: none; margin: 0; }
  html.modern .m-search kbd { display: none; }
  html.modern .m-search input { height: 42px; font-size: 16px; }
  html.modern .skin-switch button { padding: 0 9px; }
  html.modern .m-user > summary { padding: 0 4px; }
  html.modern .m-user-pop { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; }

  html.modern .layout { display: block; padding: 18px 14px 110px; }
  html.modern .sidebar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 50; max-height: 84vh; overflow: auto; background: var(--surface);
    border-radius: 22px 22px 0 0; box-shadow: var(--sh-pop); padding: 10px 16px calc(22px + env(safe-area-inset-bottom));
    transform: translateY(105%); visibility: hidden; transition: transform .3s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .3s; }
  html.modern .sidebar::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 999px; background: var(--border-strong); margin: 0 auto 12px; }
  html.modern .sidebar.open { transform: none; visibility: visible; transition-delay: 0s; }
  html.modern .m-scrim { position: fixed; inset: 0; z-index: 45; background: rgba(8, 12, 24, .45); animation: m-fade .2s ease-out; }
  html.modern .rail-close { display: inline-grid; }
  html.modern .rail-nav a, html.modern .rail-folders a { padding: 11px 12px; font-size: 15px; }
  html.modern body.rail-open { overflow: hidden; }

  html.modern .crumb { font-size: 24px; }
  html.modern .main > h2#page-h:not(.crumb) { font-size: 24px; }
  html.modern .msg { padding: 16px 16px 14px; border-radius: 14px; }
  html.modern .m-msg-head { grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; }
  html.modern .mm-when { grid-column: 2; text-align: left; display: flex; gap: 10px; align-items: center; }
  html.modern .mm-ref { margin: 0; }
  html.modern .m-msg-head .av-lg { grid-row: span 2; align-self: start; }
  html.modern .msg-body { font-size: 16px; padding-top: 14px; }
  html.modern .bt-gap { margin-left: 0; }
  html.modern .msg-tools .bt-reply { display: none; }
  html.modern .btn-tool { height: 42px; }
  html.modern .msg-pos { text-align: left; }
  html.modern .thread-outline { padding: 14px 10px 10px; }
  html.modern .outline-tree ul { margin-left: 10px; padding-left: 8px; }
  html.modern .ol-snip { display: none; }
  html.modern .ol-row { padding: 9px 8px; }
  html.modern .depth-1 { margin-left: 12px; } html.modern .depth-2 { margin-left: 24px; }
  html.modern .depth-3, html.modern .depth-4, html.modern .depth-5 { margin-left: 32px; }
  html.modern [class*="depth-"]:not(.depth-0)::before { display: none; }
  html.modern .fab { position: fixed; z-index: 40; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: 8px;
    height: 54px; padding: 0 22px; border-radius: 999px; background: var(--btn); color: var(--btn-ink); font: 650 16px var(--font); text-decoration: none; box-shadow: var(--sh-pop); }
  html.modern .fab .mi { width: 20px; height: 20px; }
  html.modern .tc-link { grid-template-columns: auto minmax(0, 1fr); padding: 12px 14px; gap: 4px 12px; }
  html.modern .tc-link > .av { grid-row: span 2; align-self: start; }
  html.modern .tc-side { grid-column: 2; gap: 10px; }
  html.modern .tc-faces { display: none; }
  html.modern .tc-meta { white-space: normal; }
  html.modern .start-grid { grid-template-columns: minmax(0, 1fr); }
  html.modern .start-grid .fixtures { grid-template-columns: minmax(0, 1fr); }
  html.modern .grid { font-size: 13px; }
  html.modern .grid th, html.modern .grid td { padding: 8px 7px; }
  html.modern .grid tbody th { white-space: normal; }
  html.modern .start-grid > .panel { padding: 16px 12px; }
  html.modern .start-grid .fixtures li:nth-last-child(2) { border-bottom: 1px solid var(--border); }
  html.modern .welcome, html.modern .member { flex-direction: column; padding: 18px; }
  html.modern .ad { grid-template-columns: 96px minmax(0, 1fr); }
  html.modern .ad-art svg { width: 96px; height: 72px; }
  html.modern .ad-open { grid-column: 1 / -1; margin: 0 12px 12px; justify-content: center; }
  html.modern .composer, html.modern .search-form, html.modern .prefs { padding: 16px; }
  html.modern .fmt-hint { display: none; }
  html.modern .footer { padding: 24px 16px 100px; }
}
@media (max-width: 360px) {
  html.modern .m-word { display: none; }
}
@keyframes m-fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  html.modern *, html.modern *::before, html.modern *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  html.modern .skin-switch button[aria-pressed="true"], html.modern .theme-switch button[aria-pressed="true"], html.modern .chip-btn[aria-pressed="true"] { outline: 2px solid Highlight; }
  html.modern .udot, html.modern .ol-row .newflag, html.modern .fdot { forced-color-adjust: none; }
}
