/* FileScout. Two themes: light is the default, dark is [data-theme="dark"] on
   <html>, set by theme.js from the saved choice or the device setting. */
:root {
  --bg: #f2f6f5;
  --panel: #ffffff;
  --panel-2: #f6faf9;
  --text: #0f172a;
  --muted: #5b6577;
  --line: #dfe7e5;
  --accent: #0f766e;
  --accent-2: #10b981;
  --accent-soft: #e3f5f1;
  --on-accent: #ffffff;
  --mark: #fde68a;
  --mark-text: #3f2d00;
  --target: #fff7db;
  --target-line: #f5b301;
  --good: #15803d;
  --good-soft: #e3f6ea;
  --bad: #b91c1c;
  --bad-soft: #fde8e8;
  --warn: #a8590a;
  --warn-soft: #fdf1d8;
  --busy: #1d4ed8;
  --busy-soft: #e2ebfe;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .12);
  --radius: 12px;
  --mono: "Cascadia Mono", Consolas, "Courier New", monospace;
}
:root[data-theme="dark"] {
  --bg: #0a1413;
  --panel: #121f1e;
  --panel-2: #182827;
  --text: #e6eaf5;
  --muted: #98a4ba;
  --line: #26393a;
  --accent: #14b8a6;
  --accent-2: #34d399;
  --accent-soft: #12302e;
  --on-accent: #ffffff;
  --mark: #facc15;
  --mark-text: #1c1500;
  --target: #2a2713;
  --target-line: #eab308;
  --good: #4ade80;
  --good-soft: #10301f;
  --bad: #f87171;
  --bad-soft: #3a171a;
  --warn: #fbbf24;
  --warn-soft: #36290c;
  --busy: #7aa7ff;
  --busy-soft: #16264d;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
/* 14.5px on a laptop, growing gently to 17.5px on a very wide monitor. */
html { color-scheme: light; font-size: clamp(14.5px, 0.3vw + 10px, 17.5px); }
html[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.55 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
html[data-theme="dark"] a { color: #5eead4; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
h3 { font-size: .95rem; margin: 0 0 .25rem; }
p { margin: 0 0 .8rem; }
code { background: var(--accent-soft); padding: .05em .4em; border-radius: 5px; font-family: var(--mono); font-size: .9em; }
mark { background: var(--mark); color: var(--mark-text); padding: 0 2px; border-radius: 3px; font-weight: 600; }
.i { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }
.logo { width: 2.6rem; height: 2.6rem; flex: none; border-radius: 10px; filter: drop-shadow(0 4px 10px rgba(15, 118, 110, .38)); }
/* The name, in the colours of the mark. */
.wordmark {
  font-weight: 800; letter-spacing: -.02em;
  background: linear-gradient(100deg, #0f766e, #10b981); -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
}
html[data-theme="dark"] .wordmark { background-image: linear-gradient(100deg, #5eead4, #6ee7b7); }
.hint { color: var(--muted); font-size: .88rem; }
.lead { color: var(--muted); font-size: 1rem; margin: 0; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }

/* ── top bar ─────────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap;
  padding: .55rem 1.4rem;
  background: var(--panel); border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .02);
}
.brand { display: inline-flex; align-items: center; gap: .7rem; font-weight: 800; font-size: 1.3rem; color: var(--text) !important; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.top nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.top nav a {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .42rem .8rem; border-radius: 9px; color: var(--muted) !important; font-weight: 500;
}
.top nav a:hover { background: var(--panel-2); color: var(--text) !important; text-decoration: none; }
.top nav a.on { background: var(--accent-soft); color: var(--accent) !important; font-weight: 600; }
html[data-theme="dark"] .top nav a.on { color: #99f6e4 !important; }
.who { margin-left: auto; display: flex; gap: .5rem; align-items: center; }
.who form { margin: 0; }
.chip { display: inline-flex; align-items: center; gap: .55rem; padding: .25rem .7rem .25rem .3rem; border-radius: 999px; border: 1px solid var(--line); color: var(--text) !important; }
.chip:hover { text-decoration: none; background: var(--panel-2); }
.chip b { font-size: .92rem; }
.signout { height: 36px; padding: 0 .95rem; border-radius: 10px; font-size: .9rem; font-weight: 700;
  background: var(--bad-soft); border-color: transparent; color: var(--bad) !important; }
.signout:hover { background: var(--bad); color: #fff !important; }
html[data-theme="dark"] .signout:hover { color: #1a0606 !important; }
.avatar {
  width: 28px; height: 28px; flex: none; border-radius: 50%; display: inline-grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; font-size: .85rem;
}
.iconbtn {
  width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer;
}
.iconbtn:hover { color: var(--text); background: var(--panel-2); }
.theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: inline; }
html[data-theme="dark"] .theme-toggle .moon { display: none; }

/* The page uses the screen: wide on a wide monitor, with small margins. */
main { width: 100%; max-width: min(94vw, 128rem); margin: 0 auto; padding: 1.6rem 1.4rem; flex: 1; }
.pagehead { margin: 0 0 1.2rem; }

/* ── cards, forms, buttons ───────────────────────────────────────────────── */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem 1.3rem; margin: 0 0 1.1rem; box-shadow: var(--shadow);
}
.card.narrow { max-width: 440px; margin: 3rem auto; padding: 1.8rem; }
.card.narrow.left { margin: 1.5rem 0; }
.card.center, .card.empty { text-align: center; }
.card.empty { padding: 2.2rem 1.3rem; }
.card-ic {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; margin: 0 0 .9rem;
  background: var(--accent-soft); color: var(--accent); font-size: 1.3rem;
}
html[data-theme="dark"] .card-ic { color: #99f6e4; }
.card.center .card-ic, .card.empty .card-ic { margin-left: auto; margin-right: auto; }
.card-ic.warn { background: var(--warn-soft); color: var(--warn); }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: .9rem; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.1rem; margin: 0 0 1.1rem; }
.split .card { margin: 0; display: flex; flex-direction: column; }
.split .card-foot { margin-top: auto; padding-top: .9rem; }

label { display: block; margin: 0 0 .9rem; font-weight: 600; font-size: .9rem; }
label.check { font-weight: 400; display: inline-flex; gap: .45rem; align-items: center; margin: 0; cursor: pointer; }
input, select, textarea, button, .btn {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: .55rem .75rem;
}
input[type=checkbox] { width: 1.05rem; height: 1.05rem; padding: 0; accent-color: var(--accent); }
label input:not([type=checkbox]):not([type=file]), label select, label textarea { display: block; width: 100%; margin-top: .35rem; font-weight: 400; }
textarea { font-family: var(--mono); font-size: .92rem; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20, 184, 166, .22); }
button:focus-visible, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button, .btn { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font-weight: 600; text-decoration: none !important; color: var(--text) !important; }
button:hover, .btn:hover { background: var(--panel-2); }
button.primary, .btn.primary {
  background: linear-gradient(135deg, #0f766e, #14b8a6); border-color: transparent; color: #fff !important;
  box-shadow: 0 4px 14px rgba(15, 118, 110, .3);
}
button.primary:hover, .btn.primary:hover { background: linear-gradient(135deg, #115e59, #0f766e); }
button.wide { width: 100%; padding: .7rem; margin-top: .3rem; }
.btn.small { padding: .3rem .65rem; font-size: .86rem; border-radius: 8px; }
button.link { border: 0; background: none; color: var(--accent) !important; padding: 0; font-weight: 500; }
html[data-theme="dark"] button.link { color: #5eead4 !important; }
button.link:hover { text-decoration: underline !important; background: none; }
.danger { color: var(--bad) !important; }

.flash { padding: .7rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); margin: 0 0 1rem; }
.flash.ok { border-color: transparent; background: var(--good-soft); color: var(--good); }
.flash.error { border-color: transparent; background: var(--bad-soft); color: var(--bad); }

/* ── sign-in ─────────────────────────────────────────────────────────────── */
/* One fixed look, whatever theme is chosen for the pages inside: a deep
   panel that carries the brand, and a light card to sign in. */
.auth {
  --bg: #f2f6f5; --panel: #ffffff; --panel-2: #f6faf9; --text: #0f172a; --muted: #5b6577; --line: #dfe7e5;
  --accent: #0f766e; --accent-soft: #e3f5f1; --bad: #b91c1c; --bad-soft: #fde8e8; --good: #15803d;
  --shadow-lg: 0 18px 50px rgba(6, 48, 45, .2);
  color-scheme: light; color: var(--text);
  flex: 1; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); min-height: 100vh;
}
.auth a { color: var(--accent); }
.auth-info {
  display: flex; flex-direction: column; justify-content: center; padding: 2.6rem 3.4rem 2.2rem 4.2rem; color: #fff;
  background:
    radial-gradient(60rem 34rem at 0% 0%, rgba(52, 211, 153, .32), transparent 62%),
    radial-gradient(52rem 34rem at 100% 100%, rgba(250, 204, 21, .16), transparent 60%),
    linear-gradient(155deg, #042f2e 0%, #0b4f4a 48%, #0f766e 100%);
}
.auth-brand { display: flex; align-items: center; gap: 1rem; margin: 0 0 2rem; }
.auth-brand .logo {
  width: 4rem; height: 4rem; border-radius: 1.1rem; outline: 2px solid rgba(255, 255, 255, .35);
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .35));
}
.auth-brand .wordmark {
  display: block; font-size: 2.2rem; line-height: 1.1; background: none !important;
  color: #fff; -webkit-text-fill-color: #fff;
}
.auth-brand small { display: block; color: rgba(255, 255, 255, .78); font-size: .88rem; margin-top: .15rem; }
.auth-info h1 { font-size: 2.3rem; line-height: 1.15; letter-spacing: -.025em; font-weight: 800; margin: 0 0 1rem; }
.auth-info h1 em {
  font-style: normal; background: linear-gradient(100deg, #6ee7b7, #fde68a);
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
}
.auth-lead { color: rgba(255, 255, 255, .84); font-size: 1.04rem; max-width: 46rem; margin: 0 0 1.4rem; }
.pills { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0 0 1.7rem; }
.pills li {
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .22); border-radius: 999px;
  padding: .3rem .9rem; font-size: .84rem; color: rgba(255, 255, 255, .86);
}
.pills b { color: #fff; font-size: .98rem; font-weight: 800; margin-right: .3rem; }
.feats { list-style: none; padding: 0; margin: 0 0 1.6rem; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.1rem 1.5rem; }
.feats li { display: flex; gap: .75rem; align-items: flex-start; }
.feat-ic {
  flex: none; width: 2.3rem; height: 2.3rem; border-radius: .65rem; display: grid; place-items: center;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .2); color: #a7f3d0; font-size: 1rem;
}
.feats li:nth-child(3n+2) .feat-ic { color: #fde68a; }
.feats li:nth-child(3n) .feat-ic { color: #bae6fd; }
.feats b { display: block; font-size: .93rem; line-height: 1.3; color: #fff; }
.feats div span { display: block; color: rgba(255, 255, 255, .76); font-size: .82rem; line-height: 1.45; margin-top: .1rem; }
.auth-live { display: flex; align-items: center; gap: .6rem; color: rgba(255, 255, 255, .8); font-size: .84rem; margin: 0; }
.auth-live i { width: .55rem; height: .55rem; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 4px rgba(74, 222, 128, .25); }
.auth-side {
  display: flex; padding: 1.6rem;
  background: radial-gradient(40rem 26rem at 100% 0%, rgba(20, 184, 166, .14), transparent 70%), #eef4f2;
}
.auth-card {
  width: 100%; max-width: 26rem; margin: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 1.2rem; padding: 2.4rem 2.2rem 2rem; box-shadow: var(--shadow-lg);
}
.auth-card h2 { font-size: 1.65rem; font-weight: 800; margin: 0 0 .2rem; letter-spacing: -.015em; }
.auth-card > .hint { margin: 0 0 1.5rem; font-size: .97rem; }
.auth-card label { text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; color: #475269; }
.auth-card input { padding: .75rem .85rem; font-size: 1rem; text-transform: none; letter-spacing: 0; color: var(--text); background: #fff; border-color: var(--line); }
.auth-card .flash { font-size: .9rem; }
.auth-mobile-brand { display: none; align-items: center; gap: .7rem; font-size: 1.5rem; margin: 0 0 1.4rem; }
.auth-mobile-brand .wordmark { background-image: linear-gradient(100deg, #0f766e, #10b981) !important; }
.auth-note { margin: 1.2rem 0 0; color: var(--muted); font-size: .84rem; text-align: center; }
@media (max-width: 1280px) {
  .auth-info { padding: 2rem 2.2rem; }
  .feats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-info h1 { font-size: 1.9rem; }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-info { display: none; }
  .auth-mobile-brand { display: flex; }
}

/* ── search ──────────────────────────────────────────────────────────────── */
.hero { text-align: center; padding: 2.2rem 0 1.4rem; }
.hero h1 { font-size: 2.1rem; letter-spacing: -.02em; }
.hero .lead { margin: 0 auto 1.5rem; max-width: 46rem; }
.hero.compact { padding: 0 0 .4rem; text-align: left; }
.searchbar { margin: 0 auto 1rem; max-width: 54rem; }
.hero.compact .searchbar { max-width: none; }
.searchbox {
  display: flex; align-items: center; gap: .5rem; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: .4rem .4rem .4rem 1rem; box-shadow: var(--shadow);
}
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(20, 184, 166, .2), var(--shadow); }
.searchbox > .i { color: var(--muted); font-size: 1.15rem; }
.searchbox input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 1.08rem; padding: .55rem .3rem; box-shadow: none !important; }
.searchbox button { padding: .6rem 1.3rem; border-radius: 10px; }
.searchbox.small { flex: 1; min-width: 220px; padding: .1rem .2rem .1rem .8rem; box-shadow: none; }
.searchbox.small input { font-size: 1rem; padding: .45rem .3rem; }
.searchbar.inline { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; max-width: none; margin: 0 0 1rem; }
.options { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: center; margin-top: .8rem; }
.hero:not(.compact) .options { justify-content: center; }
.options label { margin: 0; display: inline-flex; gap: .5rem; align-items: center; font-weight: 400; color: var(--muted); }
.options label select { width: auto; margin: 0; display: inline-block; padding: .35rem .6rem; }
.scope { color: var(--muted); background: var(--accent-soft); padding: .25rem .7rem; border-radius: 999px; }
.scope a { margin-left: .5rem; }

.tiles { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; margin: .4rem 0 1.6rem; }
.tile {
  display: flex; align-items: center; gap: .9rem; min-width: 210px; padding: .9rem 1.2rem; color: var(--text) !important;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
a.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile b { display: block; font-size: 1.5rem; line-height: 1.1; letter-spacing: -.01em; }
.tile span { color: var(--muted); font-size: .86rem; }
.tile-ic, .tip-ic { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent) !important; font-size: 1.15rem; }
html[data-theme="dark"] .tile-ic, html[data-theme="dark"] .tip-ic { color: #99f6e4 !important; }
.tile-ic.alt { background: var(--busy-soft); color: var(--busy) !important; }
.tile-ic.good { background: var(--good-soft); color: var(--good) !important; }
.tile-ic.bad { background: var(--bad-soft); color: var(--bad) !important; }
.tile-ic.busy { background: var(--warn-soft); color: var(--warn) !important; }
.tips { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.tip { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.tip-ic { width: 36px; height: 36px; border-radius: 10px; font-size: 1rem; margin-bottom: .7rem; }
.tip p { margin: 0; color: var(--muted); font-size: .9rem; }

.summary { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem; margin: .6rem 0 .9rem; }
.summary p { margin: 0; }
.actions { display: flex; align-items: center; gap: .5rem; }

/* ── results ─────────────────────────────────────────────────────────────── */
.hit {
  display: flex; gap: 1rem; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .95rem 1.1rem; margin: 0 0 .7rem; box-shadow: var(--shadow); transition: border-color .12s;
}
.hit:hover { border-color: var(--accent); }
.hit-main { flex: 1; min-width: 0; }
.hit header { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-bottom: .5rem; }
.hit .where { font-weight: 650; font-size: 1.02rem; color: var(--text) !important; }
.hit .loc { color: var(--accent); background: var(--accent-soft); padding: .05rem .6rem; border-radius: 999px; font-size: .82rem; font-weight: 600; }
html[data-theme="dark"] .hit .loc { color: #99f6e4; }
.hit .open { display: inline-block; margin-top: .55rem; font-size: .86rem; font-weight: 600; }
.ft {
  flex: none; display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 10px;
  font-size: .7rem; font-weight: 800; font-style: normal; letter-spacing: .04em; color: #fff; background: #64748b;
}
.ft-excel { background: linear-gradient(135deg, #15803d, #22c55e); }
.ft-csv { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.ft-text { background: linear-gradient(135deg, #475569, #94a3b8); }
.ft-word { background: linear-gradient(135deg, #1d4ed8, #60a5fa); }
.ft-pdf { background: linear-gradient(135deg, #b91c1c, #f87171); }
.ft-image { background: linear-gradient(135deg, #7c3aed, #c084fc); }
.cells { display: flex; flex-wrap: wrap; gap: .45rem .5rem; margin: 0; }
.cells div { max-width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: .3rem .65rem; }
.cells dt { font-size: .68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.cells dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.mlines { display: grid; gap: .35rem; }
.mline { display: flex; flex-wrap: wrap; gap: .35rem; background: var(--panel-2); border: 1px solid var(--line); border-left: 3px solid var(--target-line); border-radius: 9px; padding: .4rem .6rem; }
.mline span { padding: 0 .55rem; border-right: 1px solid var(--line); overflow-wrap: anywhere; }
.mline span:first-child { padding-left: .1rem; }
.mline span:last-child { border-right: 0; }
pre { font-family: var(--mono); font-size: .88rem; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
pre.list { max-height: 18rem; overflow: auto; }
.lines { background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; padding: .4rem 0; }
.lines .ln { display: block; color: var(--muted); padding: 0 .7rem; }
.lines .ln b { display: inline-block; min-width: 4.5ch; margin-right: 1.2ch; text-align: right; font-weight: 400; opacity: .65; }
.lines .hitline { color: var(--text); background: var(--target); box-shadow: inset 3px 0 0 var(--target-line); }
.group { margin: 1.6rem 0; }
.group > h2 { font-family: var(--mono); }
.count { color: var(--muted); font-weight: 500; font-size: .82rem; font-family: "Segoe UI", system-ui, sans-serif; }

.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .08rem .6rem; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.good { color: var(--good); background: var(--good-soft); border-color: transparent; }
.badge.bad { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.badge.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.badge.busy { color: var(--busy); background: var(--busy-soft); border-color: transparent; }
.reason { color: var(--bad); font-size: .86rem; max-width: 42ch; margin-top: .2rem; }
.grid.files td:nth-child(3) { min-width: 15rem; }

/* ── tables ──────────────────────────────────────────────────────────────── */
.scroll { overflow: auto; max-height: 74vh; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin: 0 0 1.1rem; box-shadow: var(--shadow); }
.grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .9rem; }
.grid th, .grid td { border-bottom: 1px solid var(--line); padding: .55rem .8rem; text-align: left; vertical-align: top; }
.grid th { position: sticky; top: 0; z-index: 1; background: var(--panel-2); color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.grid tbody tr:hover td { background: var(--panel-2); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid td { max-width: 46ch; overflow-wrap: break-word; }
.grid td.nowrap, .grid td.num, .grid td.acts { max-width: none; }
.grid.sheet td, .grid.sheet th { border-right: 1px solid var(--line); padding: .35rem .65rem; white-space: pre-wrap; }
.grid.sheet th { text-transform: none; letter-spacing: 0; font-size: .84rem; color: var(--text); text-align: center; white-space: nowrap; }
.grid.sheet th small { display: block; color: var(--muted); font-weight: 600; font-size: .72rem; }
.grid.sheet td { min-width: 5.5rem; height: 2rem; }
.grid.sheet td.rn { min-width: 0; text-align: center; }
.grid.sheet td[colspan] { max-width: none; white-space: nowrap; font-weight: 600; }
.grid.sheet tr.gaprow td { color: var(--muted); font-style: italic; font-weight: 400; background: var(--panel-2); text-align: center; }
.grid .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.grid .rn { color: var(--muted); text-align: right; white-space: nowrap; width: 1%; font-variant-numeric: tabular-nums; background: var(--panel-2); }
.grid tr.hdr td { font-weight: 700; background: var(--accent-soft); }
.grid tr.hiddenrow td { opacity: .6; font-style: italic; }
.grid tr.target td { background: var(--target) !important; }
.grid tr.target td.rn { box-shadow: inset 4px 0 0 var(--target-line); color: var(--text); font-weight: 700; }
.fname { display: flex; align-items: center; gap: .7rem; }
.fname .ft { width: 34px; height: 34px; border-radius: 8px; font-size: .62rem; }
.fname a { font-weight: 600; }
.acts { white-space: nowrap; text-align: right !important; }
.acts form { display: inline; margin-left: .7rem; }
.acts button { margin-left: .7rem; }
.acts form button:first-of-type { margin-left: 0; }
.inlineform { display: flex; gap: .4rem; margin: 0; }
.inlineform input { width: 8.5rem; padding: .35rem .6rem; }
.inlineform button { padding: .35rem .7rem; }

/* ── upload ──────────────────────────────────────────────────────────────── */
.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: .2rem; text-align: center;
  border: 2px dashed var(--line); border-radius: var(--radius); padding: 1.3rem 1rem; margin: 0; cursor: pointer;
  background: var(--panel-2); font-weight: 400;
}
.drop:hover, .drop:focus-within, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.picked { list-style: none; margin: .7rem 0 0; padding: 0; max-height: 13rem; overflow: auto; font-size: .9rem; }
.picked:empty { display: none; }
.picked li { display: flex; align-items: center; gap: .8rem; padding: .35rem .2rem; border-bottom: 1px solid var(--line); }
.picked li:last-child { border-bottom: 0; }
.picked span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked small { color: var(--muted); white-space: nowrap; }
.picked small.good { color: var(--good); font-weight: 600; }
.picked small.bad { color: var(--bad); font-weight: 600; }
button:disabled { opacity: .6; cursor: default; }
.drop b { font-size: 1rem; }
.drop-ic { color: var(--accent); font-size: 1.5rem; }
html[data-theme="dark"] .drop-ic { color: #99f6e4; }
.drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.path { display: flex; align-items: center; gap: .5rem; overflow-wrap: anywhere; }
.path .i { color: var(--accent); }

/* ── one file ────────────────────────────────────────────────────────────── */
.filehead { margin: 0 0 1.1rem; }
.back { display: inline-block; font-size: .88rem; margin-bottom: .7rem; }
.filetitle { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.filetitle > div { flex: 1; min-width: 240px; }
.filetitle h1 { font-size: 1.35rem; margin: 0 0 .15rem; overflow-wrap: anywhere; }
.filetitle p { margin: 0; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.filetitle .ft { width: 50px; height: 50px; border-radius: 12px; font-size: .78rem; }
.tabs { display: flex; gap: .35rem; flex-wrap: wrap; margin: 0 0 .9rem; }
.tabs a { padding: .35rem .85rem; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted) !important; font-weight: 500; }
.tabs a:hover { text-decoration: none; border-color: var(--accent); }
.tabs a.on { background: var(--accent); border-color: var(--accent); color: #fff !important; font-weight: 600; }
.tabs a.on .count { color: rgba(255, 255, 255, .8); }
.headerrow { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: 0 0 .9rem; }
.headerrow label { margin: 0; display: inline-flex; gap: .5rem; align-items: center; white-space: nowrap; }
.headerrow input { width: 6rem !important; display: inline-block !important; margin: 0 !important; padding: .35rem .6rem; }
.headerrow button { padding: .35rem .8rem; }
.marking { margin: 0 0 .8rem; color: var(--muted); }
.doc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 1.1rem; box-shadow: var(--shadow); overflow: hidden; }
.docrow { display: flex; gap: 1rem; padding: .3rem 1rem; border-bottom: 1px solid var(--line); }
.docrow:last-child { border-bottom: 0; }
.docrow .rn { flex: none; color: var(--muted); min-width: 9ch; text-align: right; font-size: .82rem; white-space: nowrap; padding-top: .1rem; font-variant-numeric: tabular-nums; }
.docrow pre { flex: 1; min-width: 0; }
.docrow .pl { display: block; min-height: 1.4em; }
.docrow .pl.hit { background: var(--target); box-shadow: inset 3px 0 0 var(--target-line); border-radius: 4px; }
.docrow.target { box-shadow: inset 4px 0 0 var(--target-line); }
.docrow.gaprow pre { color: var(--muted); font-style: italic; }
.doc-text { padding: .6rem 0; }
.doc-text .docrow { border-bottom: 0; padding-top: .05rem; padding-bottom: .05rem; }
.doc-text .docrow .rn { min-width: 6ch; border-right: 1px solid var(--line); padding-right: .8rem; }
/* A Word document, as a page. */
.paper { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  max-width: 880px; margin: 0 auto 1.1rem; padding: 2.6rem 3rem; font-size: 1rem; line-height: 1.7; }
.paper .wp { margin: 0 0 .8rem; white-space: pre-wrap; overflow-wrap: anywhere; border-radius: 4px; }
.paper .wp.h1 { font-size: 1.6rem; font-weight: 700; line-height: 1.3; margin: 1.2rem 0 .7rem; letter-spacing: -.01em; }
.paper .wp.h2 { font-size: 1.25rem; font-weight: 700; margin: 1.1rem 0 .6rem; }
.paper .wp.h3 { font-size: 1.05rem; font-weight: 700; margin: 1rem 0 .5rem; }
.paper .wp:first-child { margin-top: 0; }
.paper .wp.li { padding-left: 1.6rem; position: relative; margin-bottom: .35rem; }
.paper .wp.li::before { content: "\2022"; position: absolute; left: .55rem; color: var(--muted); }
.paper .wp.target { background: var(--target); box-shadow: inset 4px 0 0 var(--target-line); }
.wtable tr.target td { background: var(--target) !important; }
.wtable tr.target td:first-child { box-shadow: inset 4px 0 0 var(--target-line); }
.paper .wp.target { padding-left: .7rem; }
.wscroll { overflow-x: auto; margin: 0 0 1rem; }
.wtable { border-collapse: collapse; width: 100%; font-size: .94rem; }
.wtable td { border: 1px solid var(--line); padding: .4rem .7rem; vertical-align: top; white-space: pre-wrap; overflow-wrap: anywhere; }
.wtable tr:first-child td { background: var(--panel-2); font-weight: 600; }
@media (max-width: 720px) { .paper { padding: 1.4rem 1.1rem; } }
.docrow.target .rn { color: var(--text); font-weight: 700; }
.doc-text .docrow.target, .doc-word .docrow.target { background: var(--target); }
/* A PDF page keeps its layout: columns stay lined up, wide pages scroll. */
.doc-pdf .docrow { flex-direction: column; gap: .5rem; padding: 1rem 1.2rem 1.2rem; }
.doc-pdf .docrow .rn { text-align: left; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.doc-pdf .docrow pre { white-space: pre; overflow-x: auto; overflow-wrap: normal; line-height: 1.75; padding: .2rem 0 .4rem; }
.doc-pdf .docrow .pl { padding: 0 .5rem; width: max-content; min-width: 100%; }
.pager { display: flex; gap: .4rem; align-items: center; margin: 0 0 .9rem; color: var(--muted); font-size: .9rem; }
.pager a { padding: .25rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.pager span { padding: 0 .5rem; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: .3rem 0; display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }

@media (max-width: 720px) {
  main { padding: 1rem .8rem; }
  .top { padding: .5rem .8rem; gap: .6rem; }
  .chip b { display: none; }
  .chip { padding: .2rem; border: 0; }
  .hero h1 { font-size: 1.6rem; }
  .hit { flex-direction: column; gap: .6rem; }
  .searchbox button { padding: .6rem .9rem; }
}

/* ── small helps ─────────────────────────────────────────────────────────── */
.steps { margin: 0 0 .8rem; padding-left: 1.3rem; color: var(--muted); font-size: .9rem; }
.steps li { margin: .25rem 0; }
.help { margin-top: .9rem; border-top: 1px solid var(--line); padding-top: .8rem; font-size: .9rem; }
.help summary { cursor: pointer; font-weight: 600; color: var(--accent); }
html[data-theme="dark"] .help summary { color: #5eead4; }
.help p { margin: .6rem 0 0; color: var(--muted); }
.help b { color: var(--text); }

/* ── a PDF, shown as the original ────────────────────────────────────────── */
.viewswitch { display: inline-flex; gap: .2rem; padding: .2rem; margin: 0 0 .9rem; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; }
.viewswitch a { padding: .3rem 1rem; border-radius: 999px; color: var(--muted) !important; font-weight: 600; font-size: .9rem; }
.viewswitch a:hover { text-decoration: none; color: var(--text) !important; }
.viewswitch a.on { background: var(--accent); color: #fff !important; }
.found { margin: 0 0 .9rem; }
.found > p { margin: 0 0 .4rem; color: var(--muted); font-size: .9rem; }
.pdfview { display: block; width: 100%; height: 86vh; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); box-shadow: var(--shadow); margin: 0 0 1.1rem; }
.pdfview p { padding: 2rem; text-align: center; color: var(--muted); }

/* ── wide layouts: content beside a side column ──────────────────────────── */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(19rem, 25rem); gap: 1.2rem; align-items: start; }
.cols.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols > aside > .card:last-child, .cols > div > .card:last-child { margin-bottom: 0; }
.cols > aside { position: sticky; top: 4.6rem; max-height: calc(100vh - 5.6rem); overflow-y: auto; padding-bottom: .3rem; }
.cols .card h2 { display: flex; align-items: center; gap: .5rem; }
.cols .card h2 .i { color: var(--accent); }
@media (max-width: 1100px) {
  .cols, .cols.even { grid-template-columns: 1fr; }
  .cols > aside { position: static; max-height: none; overflow: visible; }
}
.pagehead.row { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.pagehead.row .viewswitch { margin: 0; }
.viewswitch a { display: inline-flex; align-items: center; gap: .4rem; }
.sectionhead { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: 1.6rem 0 .7rem; }
.sectionhead h2 { margin: 0; font-size: 1.1rem; }
.sectionhead a { font-size: .9rem; font-weight: 600; }
.tiles.left { justify-content: flex-start; margin-top: 0; }

/* ── file cards ──────────────────────────────────────────────────────────── */
.filecards { display: grid; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); gap: 1rem; margin: 0 0 1.1rem; }
.filecard {
  display: flex; flex-direction: column; gap: .35rem; min-height: 9.5rem; padding: 1rem 1.1rem; color: var(--text) !important;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.filecard:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.filecard-top { display: flex; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.filecard-top .ft { margin-right: auto; }
.filecard b { font-size: .98rem; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.filecard-meta { color: var(--accent); font-size: .86rem; font-weight: 600; }
html[data-theme="dark"] .filecard-meta { color: #5eead4; }
.filecard-foot { margin-top: auto; color: var(--muted); font-size: .8rem; }

/* ── results: where it was found ─────────────────────────────────────────── */
.facet ul { list-style: none; margin: 0 0 .6rem; padding: 0; }
.facet li a { display: flex; align-items: center; gap: .6rem; padding: .4rem .3rem; border-radius: 8px; color: var(--text) !important; }
.facet li a:hover { background: var(--panel-2); text-decoration: none; }
.facet li a > span:not(.ft) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.facet li b { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 0 .55rem; font-size: .8rem; }
html[data-theme="dark"] .facet li b { color: #99f6e4; }
.facet .ft { flex: none; width: 1.9rem; height: 1.9rem; border-radius: 7px; font-size: .55rem; }

/* ── online links ────────────────────────────────────────────────────────── */
.linkform { display: grid; gap: .5rem; margin: 0 0 .2rem; }
.linkform button { justify-self: start; }
.linklist { list-style: none; margin: .9rem 0 0; padding: 0; border-top: 1px solid var(--line); }
.linklist li { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.linklist li:last-child { border-bottom: 0; padding-bottom: 0; }
.linkhead { display: flex; align-items: center; gap: .5rem; justify-content: space-between; }
.linkname { font-weight: 600; overflow-wrap: anywhere; }
.linkurl { display: block; font-size: .78rem; color: var(--muted) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.linkfoot { display: flex; align-items: center; gap: .9rem; margin-top: .3rem; }
.linkfoot .hint { margin-right: auto; font-size: .78rem; }
.linkfoot form { margin: 0; }

/* ── admin area ──────────────────────────────────────────────────────────── */
.adminwrap { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); gap: 1.6rem; align-items: start; }
.sidemenu { position: sticky; top: 4.6rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; box-shadow: var(--shadow); }
.sidemenu-title { margin: .2rem .6rem .5rem; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sidemenu a { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border-radius: 9px; color: var(--muted) !important; font-weight: 500; }
.sidemenu a:hover { background: var(--panel-2); color: var(--text) !important; text-decoration: none; }
.sidemenu a.on { background: var(--accent-soft); color: var(--accent) !important; font-weight: 700; }
html[data-theme="dark"] .sidemenu a.on { color: #99f6e4 !important; }
@media (max-width: 900px) {
  .adminwrap { grid-template-columns: 1fr; }
  .sidemenu { position: static; display: flex; flex-wrap: wrap; gap: .2rem; }
  .sidemenu-title { display: none; }
}
.filterbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0 0 1rem; }
.filterbar label { margin: 0; display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; color: var(--muted); }
.filterbar select { width: auto !important; display: inline-block !important; margin: 0 !important; padding: .35rem .6rem; }
.filterbar button { padding: .35rem .9rem; }
.settings { margin: 0; }
.settings > div { display: grid; grid-template-columns: 15rem minmax(0, 1fr) 13rem; gap: 1rem; align-items: baseline; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.settings > div:last-child { border-bottom: 0; padding-bottom: 0; }
.settings dt { color: var(--muted); }
.settings dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.settings code { font-size: .74rem; color: var(--muted); justify-self: end; }
.settings.plainset > div { grid-template-columns: 7rem minmax(0, 1fr); }

/* ── my account ──────────────────────────────────────────────────────────── */
.profile { display: flex; align-items: center; gap: 1rem; }
.avatar.big { width: 3.6rem; height: 3.6rem; font-size: 1.5rem; }

/* A form laid out in one row, wrapping when there is no room. */
.rowform { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; align-items: end; margin-bottom: .7rem; }
.rowform label { margin: 0; }
.rowform button { height: 2.65rem; }

/* ── Files page: the two ways to add, in one bar above the list ──────────── */
.addbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; margin: 0 0 1.3rem; }
@media (max-width: 1000px) { .addbar { grid-template-columns: 1fr; } }
.addbox { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin: 0; }
.addhead { display: flex; align-items: center; gap: .8rem; margin: 0 0 .9rem; }
.addhead h2 { margin: 0; font-size: 1.05rem; }
.addhead p { margin: .1rem 0 0; color: var(--muted); font-size: .86rem; }
.add-ic { flex: none; width: 2.6rem; height: 2.6rem; border-radius: .8rem; display: grid; place-items: center; font-size: 1.15rem; background: var(--accent-soft); color: var(--accent); }
html[data-theme="dark"] .add-ic { color: #99f6e4; }
.add-ic.alt { background: var(--busy-soft); color: var(--busy); }
.addrow { display: flex; gap: .6rem; align-items: stretch; flex-wrap: wrap; }
.addrow > input { flex: 2 1 14rem; min-width: 0; }
.addrow > input.short { flex: 1 1 9rem; }
.addrow > button { flex: none; white-space: nowrap; }
.addrow .drop {
  flex: 1 1 14rem; flex-direction: row; justify-content: center; gap: .6rem; padding: .55rem 1rem; text-align: left;
  border-width: 1.5px; border-radius: 10px; color: var(--muted);
}
.addrow .drop .i { color: var(--accent); font-size: 1.1rem; }
.addrow .drop b { font-size: .95rem; color: var(--text); }
.help.inline { margin-top: .7rem; padding-top: .6rem; }
.addbox .picked { margin-top: .6rem; }
.linktable td:nth-child(2) { max-width: 34rem; }
.linktable .linkurl { max-width: 100%; font-size: .84rem; }
.watchbar { display: flex; align-items: center; gap: .9rem; margin-top: 1.3rem; }
.watchbar > div { flex: 1; min-width: 0; }
.watchbar h2 { margin: 0; }
.watchbar p { margin: .1rem 0 0; overflow-wrap: anywhere; }

/* Search tips right under the search box: small, one glance. */
.tips.compact { max-width: 78rem; margin: 0 auto 1.6rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .7rem; }
.tips.compact .tip { display: grid; grid-template-columns: auto 1fr; column-gap: .7rem; padding: .7rem .9rem; align-items: center; }
.tips.compact .tip-ic { grid-row: span 2; margin: 0; width: 2.1rem; height: 2.1rem; }
.tips.compact h3 { margin: 0; font-size: .9rem; }
.tips.compact p { font-size: .82rem; }

/* ── backups, sync ───────────────────────────────────────────────────────── */
.syncnow { display: flex; align-items: center; gap: .8rem; margin: 0; }
.syncnow button { padding: .4rem .9rem; font-size: .9rem; }
.addrow > input[type=file] { flex: 1 1 14rem; min-width: 0; padding: .4rem .5rem; background: var(--panel-2); }
.plainlist { display: block; margin: 0; padding-left: 1.2rem; color: var(--muted); }
.plainlist li { margin: .35rem 0; }
.plainlist b { color: var(--text); }

/* ── editing a sheet ─────────────────────────────────────────────────────── */
.editoffer { margin: 0 0 .9rem; display: flex; align-items: center; gap: .5rem; }
.editnote { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0 0 .9rem; padding: .7rem 1rem;
  background: var(--busy-soft); color: var(--text); border-radius: 10px; font-size: .92rem; }
.editnote .btn { margin-left: auto; }
.grid.editing td[data-c] { cursor: text; }
.grid.editing td[data-c]:hover { box-shadow: inset 0 0 0 1px var(--line); }
.grid.editing td[data-c]:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); background: var(--panel); }
.grid.editing td.changed { background: var(--target) !important; box-shadow: inset 0 0 0 1px var(--target-line); }
.grid.editing td.locked {
  cursor: not-allowed; color: var(--muted);
  background-image: repeating-linear-gradient(135deg, transparent 0 6px, var(--line) 6px 7px);
}
.grid.editing tr.added td.rn { color: var(--accent); font-weight: 700; }
.editbar {
  position: sticky; bottom: .8rem; z-index: 5; display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
  margin: 0 0 1.1rem; padding: .7rem 1rem; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.editcount { margin-left: auto; color: var(--muted); font-weight: 600; }
.editcount.has { color: var(--warn); }

/* A list of short instructions, one per line: who, then how. */
.howto { list-style: none; margin: .7rem 0 0; padding: 0; }
.howto li { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: .8rem; padding: .4rem 0; border-top: 1px solid var(--line); }
.howto li:first-child { border-top: 0; }
.howto b { color: var(--text); }
.howto span { color: var(--muted); }
@media (max-width: 700px) { .howto li { grid-template-columns: 1fr; gap: .1rem; } }

/* ── backup schedule and off-site form ───────────────────────────────────── */
.addhead h2 .badge { margin-left: .4rem; vertical-align: middle; }
.check.master { display: flex; align-items: flex-start; gap: .6rem; margin: 0 0 .9rem; padding: .7rem .8rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.check.master input { margin-top: .2rem; }
.check.master small, .sched small { display: block; color: var(--muted); font-weight: 400; font-size: .82rem; }
.sched { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: .8rem 1rem; align-items: center; margin: 0 0 1rem; }
.daypick { display: flex; flex-wrap: wrap; gap: .4rem; }
.day { display: inline-flex; align-items: center; gap: .35rem; margin: 0; padding: .3rem .65rem; border: 1px solid var(--line); border-radius: 999px; font-weight: 500; font-size: .86rem; cursor: pointer; background: var(--panel); }
.day:hover { border-color: var(--accent); }
.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .1rem .9rem; margin: 0 0 .3rem; }
.formgrid label { margin-bottom: .7rem; }
.addbox > .check { margin: 0 0 .9rem; }
.addbox > .hint { margin: .8rem 0 0; }
@media (max-width: 700px) { .sched, .formgrid { grid-template-columns: 1fr; } }

/* ── Microsoft 365 connection ────────────────────────────────────────────── */
.card.connected { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; border-color: var(--good); }
.card.connected > div { flex: 1; min-width: 16rem; }
.card.connected h2 { margin: 0 0 .2rem; }
.card.connected p { margin: 0 0 .3rem; }
.codecard { border-color: var(--accent); }
.usercode { font-family: var(--mono); font-size: 2.2rem; font-weight: 700; letter-spacing: .18em; margin: .2rem 0 .6rem 1.3rem;
  padding: .4rem 1rem; display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 12px; user-select: all; }
html[data-theme="dark"] .usercode { color: #99f6e4; }

/* ── access ──────────────────────────────────────────────────────────────── */
.pick { display: flex; gap: .6rem; align-items: flex-start; margin: 0; padding: .8rem .9rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); cursor: pointer; font-weight: 400; }
.pick input { flex: none; width: auto !important; display: inline-block !important; margin: .25rem 0 0 !important; accent-color: var(--accent); }
.pick small { display: block; color: var(--muted); font-size: .86rem; }
label.fname { margin: 0; font-weight: 500; cursor: pointer; }
.card > h2 .i { color: var(--accent); margin-right: .2rem; }
.btn.choose { margin-left: .5rem; }

/* ── admin overview ──────────────────────────────────────────────────────── */
.admincards { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1.1rem; }
.admincard { display: flex; flex-direction: column; gap: .5rem; padding: 1.2rem 1.3rem; min-height: 12rem; color: var(--text) !important;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .12s, border-color .12s, box-shadow .12s; }
.admincard:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.admincard h2 { margin: .3rem 0 0; font-size: 1.1rem; }
.admincard p { margin: 0; color: var(--muted); font-size: .9rem; }
.admincard-foot { margin-top: auto; padding-top: .6rem; font-size: .82rem; font-weight: 600; color: var(--accent); }
html[data-theme="dark"] .admincard-foot { color: #5eead4; }

/* ── Enable / Disable on a card ──────────────────────────────────────────── */
.addhead > div { flex: 1; min-width: 0; }
.toggle { margin: 0; flex: none; align-self: flex-start; }
.toggle button { min-width: 6.2rem; padding: .5rem 1rem; }
.toggle button.off { background: var(--bad-soft); border-color: transparent; color: var(--bad) !important; }
.toggle button.off:hover { background: var(--bad); color: #fff !important; }
.dimmed .sched, .dimmed .formgrid, .dimmed > .check { opacity: .55; }
.offnote { margin: 0 0 .8rem; padding: .5rem .8rem; background: var(--panel-2); border: 1px dashed var(--line); border-radius: 9px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: .8rem; }

/* Home page: the tiles stay in the middle, the List / Cards switch sits at the right, above the files. */
.tilerow { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 1rem; margin: .4rem 0 0; }
.tilerow .tiles { grid-column: 2; margin: 0; }
.tilerow .viewswitch { grid-column: 3; justify-self: end; margin: 0; box-shadow: var(--shadow); }
.tilerow + .sectionhead { margin-top: .9rem; }
.tilerow + .card { margin-top: 1.6rem; }
@media (max-width: 62rem) {
  .tilerow { grid-template-columns: 1fr; }
  .tilerow .tiles, .tilerow .viewswitch { grid-column: 1; }
  .tilerow .viewswitch { justify-self: center; }
}

/* The Admin menu of the top bar: opens on hover or with the keyboard; a click goes to the overview. */
.top nav .menu { position: relative; display: inline-flex; }
.top nav .menu-top::after { content: ""; width: .38rem; height: .38rem; margin-left: .1rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: .7; }
.top nav .menu-items { display: none; position: absolute; top: 100%; left: 0; z-index: 30; padding-top: .45rem; }
.top nav .menu:hover .menu-items, .top nav .menu:focus-within .menu-items { display: block; }
.top nav .menu-items > div { display: flex; flex-direction: column; gap: .1rem; min-width: 15.5rem; padding: .45rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 14px 34px rgba(15, 23, 42, .16); }
.top nav .menu-items a { white-space: nowrap; }


/* Backups: the note on top, the on / off switches, the schedule one kind under the other. */
.infobar { display: flex; gap: .7rem; align-items: flex-start; margin: 0 0 1.2rem; padding: .75rem 1rem; background: var(--accent-soft); border: 1px solid var(--line); border-radius: 10px; font-size: .9rem; }
.infobar .i { flex: none; color: var(--accent); font-size: 1.1rem; margin-top: .1rem; }
.switchrow { display: flex; align-items: center; gap: .9rem; margin: 0 0 1rem; padding: .7rem .9rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.switchrow b { display: block; font-size: .92rem; }
.switchrow small { color: var(--muted); font-size: .82rem; }
button.switch { flex: none; position: relative; width: 2.9rem; height: 1.6rem; padding: 0; border: 0; border-radius: 999px; background: #94a3b8; box-shadow: none; transition: background .15s; }
button.switch:hover { background: #7c8aa0; }
button.switch::after { content: ""; position: absolute; top: .2rem; left: .2rem; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: left .15s; }
button.switch.on { background: var(--accent); }
button.switch.on:hover { background: var(--accent); filter: brightness(.92); }
button.switch.on::after { left: 1.5rem; }
.schedlist { display: grid; gap: .9rem; margin: 0 0 1rem; }
.schedlist > div + div { padding-top: .9rem; border-top: 1px solid var(--line); }
.schedlist b { display: block; font-size: .95rem; }
.schedlist small { display: block; color: var(--muted); font-size: .82rem; margin: 0 0 .5rem; }
.dimmed .schedlist { opacity: .55; }
.addbox .offnote { margin: .8rem 0 0; }
.card.saved h2 { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.card.saved h2 .hint { font-weight: 400; font-size: .82rem; }
.card.saved .offnote { margin: .6rem 0 .9rem; }
.card.saved .scroll { margin: 0; box-shadow: none; }
.addrow + .addrow { margin-top: .7rem; }
.addbox form > .check { margin: .2rem 0 .9rem; }

/* My account > Appearance: one row of three joined buttons. */
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--panel); margin: .2rem 0 .6rem; }
.segmented button { border: 0; border-radius: 0; padding: .55rem 1.1rem; background: transparent; box-shadow: none; gap: .5rem; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.on { background: var(--accent); color: #fff !important; }
.segmented button.on:hover { background: var(--accent); }

/* Elements switched off with the hidden attribute stay hidden whatever their display is. */
[hidden] { display: none !important; }
.picked li.bad { color: var(--bad); }

/* Files page: folders on the server. */
.serverfolders { margin: 0 0 1.3rem; }
.serverfolders .addrow > input { flex: 1 1 22rem; }
.serverfolders .hint { margin: .6rem 0 .8rem; }
.serverfolders .scroll { margin: 0; box-shadow: none; }
.serverfolders .acts form { display: inline; }
.hint.small { font-size: .8rem; margin: .1rem 0 0; }

/* Excel, Original view: the sheet as in Excel - white cells, its own colours and bold, in either theme. */
.sheet.look tbody td:not(.rn) { background: #fff; color: #111; }
.sheet.look td.xb { font-weight: 700; }
.sheet.look td.xi { font-style: italic; }
.sheet.look td.xu { text-decoration: underline; }
.sheet.look tr.target td:not(.rn) { box-shadow: inset 0 0 0 9999px rgba(250, 204, 21, .28); }
.sheet.look td mark { color: #111; }

/* Excel, Original view: Excel's own grid - fixed column widths, light gridlines, the cells' borders. */
.sheet.look { table-layout: fixed; border-collapse: collapse; font-size: .84rem; }
.sheet.look col.rncol { width: 44px; }
.sheet.look thead th { text-align: center; font-weight: 600; padding: .2rem; }
.sheet.look tbody td:not(.rn) { padding: 2px 5px; line-height: 1.3; vertical-align: bottom; white-space: nowrap;
  overflow: hidden; text-overflow: clip; border: 1px solid #e3e3e3; }
.sheet.look tbody td.num { text-align: right; }
.sheet.look tbody td.xal { text-align: left; }
.sheet.look tbody td.xac { text-align: center; }
.sheet.look tbody td.xar { text-align: right; }
.sheet.look tbody td.xvt { vertical-align: top; }
.sheet.look tbody td.xvm { vertical-align: middle; }
.sheet.look tbody td.xw { white-space: normal; overflow-wrap: anywhere; }
/* "double" at 1px draws a plain line, and in a collapsed table it always wins
   over the neighbour's light gridline - so a line stored on either of the two
   cells is drawn, as in Excel. */
.sheet.look tbody td.xbl { border-left: 1px double #000; }
.sheet.look tbody td.xbr { border-right: 1px double #000; }
.sheet.look tbody td.xbt { border-top: 1px double #000; }
.sheet.look tbody td.xbb { border-bottom: 1px double #000; }
.sheet.look tbody td.xbl2 { border-left: 2px solid #000; }
.sheet.look tbody td.xbr2 { border-right: 2px solid #000; }
.sheet.look tbody td.xbt2 { border-top: 2px solid #000; }
.sheet.look tbody td.xbb2 { border-bottom: 2px solid #000; }
.sheet.look tbody td[rowspan] { vertical-align: middle; }
.sheet.look tbody td.xvt[rowspan] { vertical-align: top; }
/* Excel's own font, so text fits the sheet's column widths as it does in Excel. */
.sheet.look tbody td:not(.rn) { font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; font-size: 14.5px; }
.sheet.look tbody td:not(.rn) { padding: 2px 3px; }
/* Nothing is ever cut off: the sheet's widths are the least a column gets; it grows when its text needs it. */
.sheet.look { table-layout: auto; }
.sheet.look tbody td:not(.rn) { overflow: visible; }

/* Pictures: shown whole, never wider than the page. */
.imgview { margin: 0 0 1.2rem; padding: 1rem; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; }
.imgview img { max-width: 100%; max-height: 80vh; height: auto; border-radius: 6px;
  background: repeating-conic-gradient(#e5e7eb 0 25%, #fff 0 50%) 0 0 / 16px 16px; }
.imgview figcaption { margin-top: .6rem; }

/* Rows as tight as Excel's: the row-number cells too. */
.sheet.look tbody td.rn { padding: 2px 6px; line-height: 1.3; font-size: .78rem; vertical-align: middle; }
/* A merged block taller than a few rows: its text at the top, kept in view while scrolling through it. */
.sheet.look tbody td.xtall { vertical-align: top; }
.sheet.look tbody td.xtall .stick { position: sticky; top: 2.2rem; padding: 4px 0; }
/* The sheet at its natural width: every column at least as wide as its longest value (never overlapping text). */
.sheet.look { width: max-content; }
