:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --ink: #17201c;
  --muted: #5f6b66;
  --line: #dfe4e0;
  --accent: #0d7a5f;
  --accent-ink: #ffffff;
  --accent-soft: #e2f3ec;
  --warn: #b4540f;
  --danger: #b42318;
  --s0: #0d7a5f; --s1: #c2620e; --s2: #3d5bd9; --s3: #9b3fb5; --s4: #0e7490; --s5: #6b7280;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 20, .06), 0 1px 1px rgba(16, 24, 20, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101513; --surface: #171e1b; --ink: #e7ece9; --muted: #9aa6a0; --line: #2a3430;
    --accent: #34c497; --accent-ink: #062018; --accent-soft: #163329; --warn: #f0a35b; --danger: #f97066;
    --s0: #34c497; --s1: #f0a35b; --s2: #8ea2ff; --s3: #d79ae8; --s4: #5ec8dc; --s5: #a3acb9;
    --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { line-height: 1.2; margin: 0 0 .4rem; }
h1 { font-size: 1.7rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 16px; }
.muted { color: var(--muted); }
.kicker { margin: 0 0 .2rem; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.bar { display: flex; align-items: center; gap: 1rem; min-height: 56px; flex-wrap: wrap; padding-block: 6px; }
.brand { font-weight: 750; color: var(--ink); font-size: 1.05rem; letter-spacing: -.01em; }
.main-nav { display: flex; gap: .2rem; flex-wrap: wrap; flex: 1; }
.main-nav a { color: var(--muted); padding: .35rem .6rem; border-radius: 8px; }
.main-nav a:hover, .main-nav a.active { color: var(--ink); background: var(--accent-soft); text-decoration: none; }
.account { display: flex; align-items: center; gap: .75rem; }
.inline { display: inline; margin: 0; }
button.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
button.link:hover { color: var(--ink); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--accent); background: var(--accent);
  color: var(--accent-ink); padding: .5rem .95rem; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { padding: .25rem .65rem; font-size: .9rem; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger.ghost { background: transparent; color: var(--danger); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* layout blocks */
main { padding-block: 1.5rem 3rem; }
.hero { padding: 2.2rem 0 1.4rem; }
.hero h1 { font-size: 2.2rem; }
.lede { font-size: 1.1rem; color: var(--muted); max-width: 46rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-block: 1rem; }
.card.narrow { max-width: 30rem; margin-inline: auto; margin-top: 2rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .6rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head p { margin: .2rem 0 0; max-width: 48rem; }
.crumbs { margin: 0 0 .5rem; }
.empty { text-align: center; padding: 2.5rem 1rem; border: 1px dashed var(--line); border-radius: var(--radius); }
.foot { display: flex; gap: 1rem; justify-content: space-between; color: var(--muted); padding-block: 1.5rem; border-top: 1px solid var(--line); font-size: .9rem; }

/* tables */
.table-wrap { overflow-x: auto; }
/* style: tail — a box of one height whatever it holds: the newest rows of a list, or the
   last lines of a text, that fit; the rest is gone off the top. The height is the theme's
   to set (--tail-height). The box never grows, so what follows it never moves. */
.view.tail .table-wrap, .view.tail .empty, .view.tail > p, .view.tail > ul { height: var(--tail-height, 10rem); overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; margin: 0; }
.view.tail .empty { justify-content: center; }
.view.tail table { flex: 0 0 auto; }
.delete-cell { text-align: right; white-space: nowrap; }
.page-back { margin: 0 0 .5rem; font-size: .9rem; }
.page-back a { color: var(--muted); text-decoration: none; }
.page-back a:hover, .page-back a:focus-visible { color: inherit; text-decoration: underline; }
.delete-cell a { color: var(--danger); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: var(--accent-soft); }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.rank { font-weight: 700; color: var(--muted); width: 2.5rem; }
td.muted { color: var(--muted); }
.open { color: var(--muted); }

/* tags */
.tag { display: inline-block; padding: .05rem .5rem; border-radius: 99px; font-size: .8rem; background: var(--accent-soft); color: var(--ink); white-space: nowrap; }
.tag-imported { background: #d6f2e5; color: #0b5b45; }
.tag-error { background: #fde2df; color: #9c1c12; }
.tag-duplicate { background: #e9ecef; color: #49525c; }

/* detail fields */
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .9rem 1.2rem; margin: 0 0 1.2rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); }
.fields .f { min-width: 0; }
.fields .wide { grid-column: 1 / -1; }
.fields dt { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.fields dd { margin: .15rem 0 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.fields dd.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.fields dd.prose { white-space: pre-wrap; font-size: 1rem; }

/* forms */
.form fieldset { border: 0; padding: 0; margin: 0 0 1.2rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .9rem 1.2rem; }
.form legend { font-weight: 700; margin-bottom: .6rem; padding: 0; }
.card .form fieldset, .card.narrow .form { display: block; }
.field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .2rem; }
.field.wide { grid-column: 1 / -1; }
.card.narrow .field { margin-bottom: .9rem; }
label { font-weight: 600; font-size: .92rem; }
.req { color: var(--danger); }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; width: 100%; max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 500; padding-top: 1.6rem; }
.check input { width: auto; }
.help { margin: 0; font-size: .85rem; color: var(--muted); }
.err { margin: 0; font-size: .85rem; color: var(--danger); }
.count { margin: 0; font-size: .8rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.count.over { color: var(--danger); font-weight: 600; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.alert { background: #fde2df; color: #7a1a12; border-radius: 8px; padding: .6rem .8rem; }
@media (prefers-color-scheme: dark) { .alert { background: #401a17; color: #ffd9d4; } }
.notice { background: #e2f3e6; color: #164d22; border-radius: 8px; padding: .6rem .8rem; }
@media (prefers-color-scheme: dark) { .notice { background: #16331c; color: #d2f0d8; } }
dl.fixed { display: grid; grid-template-columns: max-content 1fr; gap: .2rem 1rem; margin: 0 0 1rem; font-size: .9rem; }
dl.fixed dt { color: var(--muted); } dl.fixed dd { margin: 0; font-family: ui-monospace, monospace; }
.form .providers { display: grid; grid-template-columns: minmax(0, 1fr); gap: .4rem; margin: 0 0 1rem; }
.form .provider { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .8rem; min-width: 0; }
.form .provider.in-use, .form .provider:has(> .provider-pick input:checked) { border-color: var(--accent); }
.form .provider-name { font-size: 1rem; margin: .2rem 0 .6rem; }
.form .provider .provider-pick { display: flex; align-items: baseline; gap: .5rem; padding: .1rem 0; min-width: 0; cursor: pointer; }
.form .provider .provider-summary { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.form .provider-settings { margin-top: .6rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.form .provider-settings[hidden] { display: none; }
.form .provider-settings .rank { display: flex; gap: .5rem; align-items: center; font-size: .9rem; color: var(--muted); margin-bottom: .6rem; }
.form .provider-settings .rank input { width: 4rem; }
.form .provider-filter { width: 100%; margin: 0 0 .6rem; }
.form .provider[hidden] { display: none; }

/* toolbar, filters, pager */
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .8rem; align-items: center; }
.toolbar input[type=search] { max-width: 18rem; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-left: auto; }
.seg a { padding: .4rem .8rem; color: var(--muted); }
.seg a.on { background: var(--accent); color: var(--accent-ink); }
.filters { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { background: var(--accent-soft); color: var(--ink); padding: .15rem .6rem; border-radius: 99px; font-size: .88rem; }
.facets { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: .6rem .8rem .8rem; margin: 0 0 .8rem; }
.facets h2 { font-size: 1rem; margin: 0 0 .2rem; }
.facet-group { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .45rem; }
.facet-name { color: var(--muted); font-size: .85rem; min-width: 7rem; }
details.facet-group { display: block; }
details.facet-group > summary { cursor: pointer; color: var(--ink); font-weight: 600; font-size: .92rem; padding: .2rem 0; }
details.facet-group[open] > summary { margin-bottom: .35rem; }
details.facet-group > .facet { margin: 0 .3rem .35rem 0; }
.facet { white-space: nowrap; display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line); border-radius: 99px; padding: .2rem .7rem; font-size: .88rem; color: var(--ink); text-decoration: none; }
a.facet:hover { border-color: var(--accent); }
.facet.sub { font-size: .8rem; padding: .12rem .55rem; border-style: dashed; }
.facet.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); border-style: solid; }
/* a grouped chips view's toggles (chips with group_by): buttons in the facets' look */
.chip-toggles form.toggle { display: inline-block; margin: 0 .3rem .35rem 0; }
.chip-toggles button.facet { background: none; cursor: pointer; font: inherit; font-size: .88rem; }
.chip-toggles button.facet.sub { font-size: .8rem; }
.chip-toggles button.facet:hover { border-color: var(--accent); }
.chip-toggles button.facet.on { background: var(--accent); color: var(--accent-ink); }
.facet.off { color: var(--muted); opacity: .55; }
.facet .count { font-size: .75rem; color: var(--muted); }
.facet.on .count { color: inherit; }
.rank-note { font-size: .88rem; margin: -.3rem 0 .6rem; }
.pager { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-top: .8rem; }

/* upload */
.upload .drop { display: flex; flex-direction: column; gap: .4rem; border: 2px dashed var(--line); border-radius: var(--radius); padding: 1.4rem; margin-bottom: 1rem; cursor: pointer; font-weight: 500; }
.upload .drop:hover { border-color: var(--accent); }
.help-card ul { padding-left: 1.2rem; margin: 0; }
.help-card li { margin-bottom: .4rem; }

/* calendar */
.cal-nav { display: flex; align-items: center; gap: 1rem; margin-bottom: .6rem; }
.cal-nav a { font-size: 1.3rem; padding: 0 .5rem; }
.cal-nav h2 { margin: 0; min-width: 11rem; text-align: center; }
.legend { display: flex; gap: .8rem; flex-wrap: wrap; margin: .3rem 0 0; }
.key::before { content: ""; display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; margin-right: .35rem; background: currentColor; vertical-align: -1px; }
/* Grids (a board) and calendars (a grid of days). */
.grid { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); --cols: 7; }
/* The column count comes as data-cols (an inline style would be refused by the page's content security policy). */
.grid[data-cols="1"] { --cols: 1; } .grid[data-cols="2"] { --cols: 2; } .grid[data-cols="3"] { --cols: 3; } .grid[data-cols="4"] { --cols: 4; } .grid[data-cols="5"] { --cols: 5; } .grid[data-cols="6"] { --cols: 6; } .grid[data-cols="7"] { --cols: 7; } .grid[data-cols="8"] { --cols: 8; } .grid[data-cols="9"] { --cols: 9; } .grid[data-cols="10"] { --cols: 10; } .grid[data-cols="11"] { --cols: 11; } .grid[data-cols="12"] { --cols: 12; } .grid[data-cols="13"] { --cols: 13; } .grid[data-cols="14"] { --cols: 14; } .grid[data-cols="15"] { --cols: 15; } .grid[data-cols="16"] { --cols: 16; }
.grid-row { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
.grid.headed .grid-row { grid-template-columns: 2rem repeat(var(--cols), minmax(0, 1fr)); }
.grid-head div, .grid-rowhead { padding: .4rem .5rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.grid-head div { border-bottom: 1px solid var(--line); text-align: center; }
.grid-rowhead { display: flex; align-items: center; justify-content: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cell { min-height: 6.5rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .3rem .35rem; display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.grid-row .cell:last-child { border-right: 0; }
.cell.out { background: var(--bg); }
.cell.out .dnum { color: var(--muted); opacity: .6; }
.cell.today .dnum { color: var(--accent); font-weight: 800; }
.grid.headed .cell { min-height: 3.2rem; aspect-ratio: 1; align-items: center; justify-content: center; padding: .1rem; }
.grid.headed .cell.dark { background: var(--accent-soft); }
.dnum { display: flex; justify-content: space-between; font-size: .85rem; font-weight: 600; }
/* a calendar's open: the day's number links to the day, and its empty space does too
   (the link's layer spans the cell, under the entries and the "+") */
.cell:has(> .dnum > a.open) { position: relative; }
.dnum a.open { color: inherit; text-decoration: none; }
.dnum a.open::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.cell:has(> .dnum > a.open) > a, .cell:has(> .dnum > a.open) .add { position: relative; z-index: 1; }
.cell:has(> .dnum > a.open):hover { background: var(--accent-soft); }
.dnum .add, .cell > .add { opacity: 0; font-weight: 700; padding: 0 .3rem; }
.cell:hover .add, .add:focus { opacity: 1; }
.item { display: block; font-size: .8rem; line-height: 1.25; padding: .15rem .35rem; border-radius: 5px; background: var(--accent-soft); color: var(--ink);
  border-left: 3px solid var(--s0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item:hover { text-decoration: none; filter: brightness(.97); }
.item[draggable=true] { cursor: grab; }
.item.dragging { opacity: .45; }
.item.saving { opacity: .6; }
.grid.headed .item { background: none; border: 0; padding: 0; font-size: 2rem; line-height: 1; }
.cell.drop { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -3px; }
/* A list drawn as a conversation (style: thread): the first field right, as the viewer's
   own line; the rest left, as what came back; an empty line takes no room. */
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.thread li { display: flex; flex-direction: column; gap: .25rem; position: relative; }
.thread li > p { margin: 0; max-width: 85%; padding: .45rem .7rem; border-radius: var(--radius); white-space: pre-wrap; overflow-wrap: anywhere; }
.thread li > p.mine { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.thread li > p.theirs { align-self: flex-start; background: var(--accent-soft); color: var(--ink); }
.thread li > p:empty { display: none; }
.thread li > a.open { position: absolute; right: 0; top: 0; }
.grid-status { margin: 0 0 .5rem; padding: .4rem .7rem; border-radius: var(--radius); background: var(--accent-soft); font-size: .9rem; }
.grid-status.bad { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.grid-hint { font-size: .85rem; margin-top: .5rem; }
.series-0 { --c: var(--s0); } .series-1 { --c: var(--s1); } .series-2 { --c: var(--s2); }
.series-3 { --c: var(--s3); } .series-4 { --c: var(--s4); } .series-5 { --c: var(--s5); }
.item[class*="series-"] { border-left-color: var(--c); }
.key[class*="series-"] { color: var(--c); }

@media (max-width: 720px) {
  h1 { font-size: 1.4rem; }
  .hero h1 { font-size: 1.7rem; }
  .account { width: 100%; justify-content: flex-end; }
  .cell { min-height: 4.2rem; padding: .2rem; }
  .grid.headed .cell { min-height: 2.4rem; }
  .item { font-size: .7rem; padding: .1rem .2rem; }
  .grid.headed .item { font-size: 1.5rem; }
  .grid-head div { padding: .3rem .2rem; font-size: .7rem; }
  .seg { margin-left: 0; }
}

.move-to { display: inline-flex; gap: .4rem; align-items: center; margin-left: .5rem; font-size: .9rem; }
.move-to input[type=number] { width: 4.5rem; display: inline-block; }

/* Interface views: chips, reordering rows, radios */
.view { margin-bottom: 1.5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0 0 .8rem; }
.chips .chip { display: inline-flex; align-items: center; gap: .3rem; }
.chips .chip button.link { padding: 0 .15rem; line-height: 1; }
tr[draggable=true] { cursor: grab; }
tr.dragging { opacity: .45; }
tr.drop td { background: var(--accent-soft); }
td.move-cell { white-space: nowrap; }
td.move-cell .move-to { margin-left: 0; }
/* reorder.js running: the row's handle (drag, or the arrow keys) in place of its Move form */
table.reorder-live .move-to { display: none; }
.reorder-handle { cursor: grab; border: 0; background: none; color: var(--muted, #888); font-size: 1.1rem; line-height: 1; padding: .2rem .35rem; border-radius: .3rem; }
.reorder-handle:hover, .reorder-handle:focus-visible { color: inherit; background: var(--accent-soft); }
.radios { display: flex; flex-wrap: wrap; gap: .6rem; }

/* The support window (support.html, dd.support): a floating button at the lower right
   and the conversation as a popover in the browser's top layer, above everything,
   taking no room in the page. Until the support library has run (data-support-ready) —
   or without scripts — the widget stands open in the page's flow and the form posts the
   plain way. A theme restyles these classes, or replaces support.html. */
.dd-support { margin: 2rem 0 0; }
.dd-support-toggle, .dd-support-close { display: none; }
.dd-support[data-support-ready] { position: fixed; right: 1rem; bottom: 1rem; z-index: 30; margin: 0; display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; }
.dd-support[data-support-ready] .dd-support-toggle { display: inline-flex; align-items: flex-end; gap: .4rem; appearance: none; background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink); }
.dd-support[data-support-ready] .dd-support-close { display: inline-block; }
.dd-support-bubble { font-size: .85rem; line-height: 1.3; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 8px rgba(0,0,0,.12); padding: .4rem .6rem; margin-bottom: 1.2rem; white-space: nowrap; }
.dd-support.open .dd-support-bubble { display: none; }
.dd-support-icon { display: inline-block; width: 56px; height: 56px; line-height: 0; }
.dd-support-icon svg { width: 100%; height: 100%; fill: var(--accent); }
.dd-support-icon .dd-support-face { fill: var(--surface); }
.dd-support-icon .dd-support-eye { fill: var(--ink); }
.dd-support-icon .dd-support-light { fill: var(--danger); }
.dd-support-icon.small { width: 22px; height: 22px; }
.dd-support-toggle:hover .dd-support-icon, .dd-support-toggle:focus-visible .dd-support-icon { transform: translateY(-3px); }
/* The window: its margin, padding, overflow and size set outright, because the browser
   gives a popover defaults of its own. Shut until the toggle is clicked; open as a fixed
   box where the Popover API is missing. */
.dd-support-panel { display: flex; flex-direction: column; width: 22rem; max-width: 100%; margin: 0; padding: 0; overflow: visible; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0,0,0,.18); }
.dd-support[data-support-ready] .dd-support-panel { display: none; max-width: calc(100vw - 2rem); }
.dd-support[data-support-ready].open .dd-support-panel { display: flex; }
.dd-support-panel:popover-open { display: flex; position: fixed; inset: auto 1rem calc(1rem + 56px + .5rem) auto; max-height: calc(100vh - 2rem - 56px - 1rem); }
.dd-support-head { display: flex; align-items: center; gap: .5rem; flex: 0 0 auto; padding: .55rem .7rem; background: var(--accent); color: var(--accent-ink); border-radius: var(--radius) var(--radius) 0 0; }
.dd-support-head .dd-support-icon svg { fill: var(--accent-ink); }
.dd-support-head .dd-support-icon .dd-support-face { fill: var(--accent); }
.dd-support-head .dd-support-icon .dd-support-eye { fill: var(--accent-ink); }
.dd-support-title { flex: 1 1 auto; font-weight: 600; }
.dd-support-close { appearance: none; background: none; border: 0; color: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 .2rem; }
.dd-support-log { flex: 1 1 auto; min-height: 0; max-height: 50vh; overflow-y: auto; padding: .6rem; }
.dd-support-log .view { margin: 0; }
.dd-support-log .card-head, .dd-support-log h2, .dd-support-log .pager { display: none; }
.dd-support-log .thread li > p[data-dd-field="ai_status"] { display: none; }
.dd-support-log .thread li[data-dd-ai_status="queued"]::after { content: "● ● ●"; align-self: flex-start; padding: .45rem .7rem; border-radius: var(--radius); background: var(--accent-soft); color: var(--ink); letter-spacing: .1em; animation: dd-support-typing 1.1s steps(3, end) infinite; }
.dd-support-log .empty { border: 0; background: none; text-align: left; padding: .3rem; color: var(--muted); font-size: .95rem; }
@keyframes dd-support-typing { 0% { opacity: .3; } 50% { opacity: 1; } 100% { opacity: .3; } }
.dd-support-ask { flex: 0 0 auto; border-top: 1px solid var(--line); padding: .5rem; }
.dd-support-ask .view, .dd-support-ask .field, .dd-support-ask fieldset { margin: 0; padding: 0; border: 0; }
.dd-support-ask h2, .dd-support-ask label, .dd-support-ask .muted { display: none; }
.dd-support-ask form { display: flex; gap: .4rem; align-items: stretch; }
.dd-support-ask fieldset { flex: 1 1 auto; min-width: 0; }
.dd-support-ask textarea, .dd-support-ask input[type=text] { width: 100%; min-height: 2.4rem; height: 2.4rem; resize: none; }
.dd-support-ask .actions { margin: 0; display: flex; }
.dd-support-ask .btn { flex: 0 0 auto; align-self: stretch; }
@media (prefers-reduced-motion: reduce) { .dd-support-log .thread li[data-dd-ai_status="queued"]::after { animation: none; } }
@media (max-width: 700px) {
  .dd-support[data-support-ready] { right: .5rem; bottom: .5rem; }
  .dd-support-icon { width: 40px; height: 40px; }
  .dd-support-bubble { font-size: .75rem; margin-bottom: .8rem; }
  .dd-support[data-support-ready] .dd-support-panel { width: calc(100vw - 1rem); }
  .dd-support-panel:popover-open { inset: auto .5rem calc(.5rem + 40px + .5rem) auto; max-height: calc(100vh - 1rem - 40px - 1rem); }
}

/* The admin area: its sections under the main bar, on the admin pages. */
.admin-nav { display: flex; gap: .25rem 1rem; flex-wrap: wrap; padding: .4rem 0 0; font-size: .95rem; }
.admin-nav a { color: var(--muted); padding: .2rem 0; border-bottom: 2px solid transparent; }
.admin-nav a.active { color: var(--fg, inherit); border-bottom-color: var(--accent); text-decoration: none; }

/* The Media page (media.html, media.js). */
.dd-media-drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 1.5rem; text-align: center; color: var(--muted); }
.dd-media-drop.over { border-color: var(--accent); color: inherit; }
.dd-media-drop input[type=file] { display: block; margin: .6rem auto 0; }
.dd-media-queue { list-style: none; padding: 0; margin: .6rem 0 0; }
.dd-media-queue li { display: flex; gap: .6rem; align-items: center; padding: .25rem 0; font-size: .9rem; }
.dd-media-queue progress { flex: 1; height: .5rem; }
.dd-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 1rem; margin-top: 1rem; }
.dd-media-item { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; display: flex; flex-direction: column; gap: .4rem; background: var(--surface); }
.dd-media-thumb { aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; background: var(--bg, #f6f6f6); border-radius: calc(var(--radius) - 2px); overflow: hidden; }
.dd-media-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.dd-media-thumb span { font-size: 1.6rem; color: var(--muted); }
.dd-media-name { font-weight: 600; word-break: break-all; }
.dd-media-meta { font-size: .85rem; color: var(--muted); }
.dd-media-url { display: flex; gap: .4rem; }
.dd-media-url input { flex: 1; font-size: .8rem; }
.dd-media-item .alt { font-size: .9rem; }
.dd-media-actions { display: flex; gap: .4rem; justify-content: space-between; align-items: center; margin-top: auto; }
.dd-media-empty { color: var(--muted); margin-top: 1rem; }

/* The Admins page (admins.html): the admins and their levels. */
.admin-table input[type=number] { width: 5rem; }
.admin-table .inline { display: inline-flex; align-items: center; gap: .4rem; }
.admin-actions { white-space: nowrap; text-align: right; }
.admin-actions .inline + .inline { margin-left: .4rem; }
.admin-owners { margin: 0; padding-left: 1.2rem; }
input.admin-link { width: 100%; font-family: ui-monospace, monospace; font-size: .85rem; }
.admin-linkform { display: inline-flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.admin-linkform input[type=number] { width: 5rem; }
/* What the admin area tells every admin: something wrong with the app as it runs. */
.admin-notice .alert { margin: .8rem 0 0; font-weight: 600; }
/* The providers a sign-in or sign-up page offers, above its own form. */
.signin-providers { display: grid; gap: .6rem; margin: 1rem 0; }
.signin-providers .btn.provider { display: block; text-align: center; border: 1px solid currentColor; }
.signin-providers .or { display: flex; align-items: center; gap: .8rem; margin: .4rem 0 0; }
.signin-providers .or::before, .signin-providers .or::after { content: ""; flex: 1; border-top: 1px solid currentColor; opacity: .3; }

/* Service Configuration: a card's optional settings folded under "Advanced" (+ / −). */
details.advanced { margin: .75rem 0 1rem; border-top: 1px solid var(--line); padding-top: .6rem; }
details.advanced > summary { cursor: pointer; list-style: none; color: var(--muted); font-weight: 600; font-size: .92rem; display: inline-flex; align-items: center; gap: .4rem; }
details.advanced > summary::-webkit-details-marker { display: none; }
details.advanced > summary::before { content: "+"; display: inline-grid; place-items: center; width: 1.2rem; height: 1.2rem; border: 1px solid var(--line); border-radius: 4px; font-weight: 700; line-height: 1; }
details.advanced[open] > summary::before { content: "\2212"; }
details.advanced[open] > summary { margin-bottom: .5rem; }

/* the DNS admin page */
table.dns { width: 100%; border-collapse: collapse; font-size: .9rem; margin: 0 0 1rem; table-layout: auto; }
table.dns th, table.dns td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.dns tr[hidden] { display: none; }
table.dns .dns-content { word-break: break-all; font-size: .8rem; }
table.dns .dns-actions { white-space: nowrap; }
table.dns form { margin: 0; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.badge.dns-ok { color: var(--accent); }
.badge.dns-todo { color: #a15c00; }
.badge.dns-off { color: var(--muted); }
.form [data-dd-show-if][hidden] { display: none; }
@media (max-width: 640px) {
  table.dns thead { display: none; }
  table.dns tr { display: block; padding: .5rem 0; border-bottom: 1px solid var(--line); }
  table.dns td { display: block; border: 0; padding: .1rem 0; }
  table.dns td:empty { display: none; }
  table.dns code { word-break: break-all; }
  table.dns td[data-label]:not(:empty)::before { content: attr(data-label) ": "; color: var(--muted); }
}

/* Payment Checkout (templates/checkout.html) */
.dd-mode { padding: .55rem .8rem; border-radius: 8px; border-left: 4px solid; margin: .75rem 0; }
.dd-mode.is-test { border-color: #c80; background: color-mix(in srgb, #c80 12%, transparent); }
.dd-mode.is-live { border-color: #2a8a4a; background: color-mix(in srgb, #2a8a4a 12%, transparent); }
.checkout-steps { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; padding-left: 1.2rem; margin: .5rem 0 0; }
.checkout-head { margin: 1.6rem 0 .25rem; }
.checkout-intro { margin: 0 0 .8rem; }
.checkout-problems { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .35rem; }
.checkout-problems li { margin: 0; }
.country-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: .2rem .9rem; max-height: 16rem; overflow: auto; padding: .4rem; border: 1px solid color-mix(in srgb, currentColor 18%, transparent); border-radius: 8px; margin-top: .4rem; }
.country-list [hidden] { display: none; }
.checkout-method { border: 1px solid color-mix(in srgb, currentColor 15%, transparent); border-radius: 8px; padding: .6rem .8rem; margin: 0 0 .75rem; }
.provider-check { margin: .4rem 0; }
