/* The Striqr bot's server dashboard (/discord/servers; views/discord-servers.ejs, discord-server.ejs, partials ds-*):
   a dark layout like Discord's own, with Striqr's purple. A top bar, the server switcher and the sections down the side,
   and one section at a time with a bar that offers Save once something changed (public/js/discord-dashboard.js).
   Narrow screens: the side becomes the switcher and a row of tabs that scrolls sideways. */

.ds-html {
    --ds-bg: #111214;
    --ds-side: #18191c;
    --ds-panel: #1f2125;
    --ds-raise: #26282d;
    --ds-line: #2f3238;
    --ds-line-strong: #3d4048;
    --ds-ink: #eceef2;
    --ds-muted: #a9adb6;
    --ds-accent: #8b5cf6;
    --ds-accent-strong: #7c3aed;
    --ds-accent-ink: #c4b5fd;
    --ds-accent-soft: rgba(139, 92, 246, 0.16);
    --ds-ok: #3ba55d;
    --ds-warn: #e3a42b;
    --ds-discord: #5865f2;
    --ds-radius: 12px;
    --ds-font: "DM Sans", system-ui, sans-serif;
    --ds-font-display: "Outfit", "DM Sans", system-ui, sans-serif;
    color-scheme: dark;
    background: var(--ds-bg);
}

.ds-body {
    margin: 0;
    min-height: 100vh;
    background: var(--ds-bg);
    color: var(--ds-ink);
    font-family: var(--ds-font);
    font-size: 15px;
    line-height: 1.5;
}

.ds-body *,
.ds-body *::before,
.ds-body *::after {
    box-sizing: border-box;
}

.ds-body a {
    color: var(--ds-accent-ink);
}

.ds-body code {
    padding: 1px 6px;
    border-radius: 6px;
    background: var(--ds-raise);
    font-size: 0.92em;
}

.ds-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.ds-skip {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 50;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--ds-accent-strong);
    color: #fff !important;
}

.ds-skip:focus {
    top: 12px;
}

.ds-body :focus-visible {
    outline: 2px solid var(--ds-accent-ink);
    outline-offset: 2px;
}

.ds-icon {
    flex: none;
    width: 20px;
    height: 20px;
}

/* ── The top bar ── */

.ds-top {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 16px;
    height: 60px;
    padding: 0 20px;
    border-bottom: 1px solid var(--ds-line);
    background: var(--ds-side);
}

.ds-top-logo {
    display: inline-flex;
    color: var(--ds-ink) !important;
}

.ds-logo {
    height: 22px;
    width: auto;
}

.ds-logo .st-logo-mark {
    color: var(--ds-accent);
}

.ds-top-title {
    padding-left: 16px;
    border-left: 1px solid var(--ds-line-strong);
    color: var(--ds-muted) !important;
    font-weight: 600;
    text-decoration: none;
}

.ds-top-who {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    min-width: 0;
}

.ds-top-who form {
    margin: 0;
}

.ds-top-name {
    overflow: hidden;
    max-width: 180px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ds-avatar {
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.ds-avatar--initial,
.ds-server-icon--initial {
    display: inline-grid;
    place-items: center;
    background: var(--ds-accent-strong);
    color: #fff;
    font-family: var(--ds-font-display);
    font-weight: 700;
}

/* ── Buttons ── */

.ds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

.ds-btn--primary {
    background: var(--ds-accent-strong);
    color: #fff !important;
}

.ds-btn--primary:hover {
    background: #6d28d9;
}

.ds-btn--ghost {
    border-color: var(--ds-line-strong);
    background: transparent;
    color: var(--ds-ink) !important;
}

.ds-btn--ghost:hover {
    background: var(--ds-raise);
}

.ds-btn--discord {
    background: var(--ds-discord);
    color: #fff !important;
}

.ds-btn--discord:hover {
    background: #4752c4;
}

.ds-btn--sm {
    min-height: 34px;
    padding: 6px 12px;
    font-size: 14px;
}

.ds-btn--lg {
    min-height: 48px;
    padding: 12px 22px;
    font-size: 16px;
}

.ds-btn[disabled] {
    opacity: 0.6;
    cursor: wait;
}

/* ── The layout: the side and the page ── */

.ds-app {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    min-height: calc(100vh - 60px);
}

.ds-side {
    position: sticky;
    top: 60px;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 16px 12px;
    border-right: 1px solid var(--ds-line);
    background: var(--ds-side);
}

.ds-main {
    width: 100%;
    max-width: 900px;
    padding: 32px 40px 120px;
}

.ds-main--wide {
    max-width: 1120px;
    margin: 0 auto;
}

/* ── The server switcher ── */

.ds-picker {
    position: relative;
}

.ds-picker-now {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--ds-line-strong);
    border-radius: var(--ds-radius);
    background: var(--ds-raise);
    font-weight: 700;
    list-style: none;
    cursor: pointer;
}

.ds-picker-now::-webkit-details-marker {
    display: none;
}

.ds-picker-now:hover {
    border-color: var(--ds-accent);
}

.ds-picker-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ds-picker-chevron {
    color: var(--ds-muted);
    transition: transform 0.15s;
}

.ds-picker[open] .ds-picker-chevron {
    transform: rotate(180deg);
}

.ds-picker-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 30;
    max-height: 60vh;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--ds-line-strong);
    border-radius: var(--ds-radius);
    background: var(--ds-panel);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.ds-picker-menu ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ds-picker-label {
    margin: 4px 8px 6px;
    color: var(--ds-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ds-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    color: var(--ds-ink) !important;
    text-decoration: none;
}

.ds-picker-item:hover {
    background: var(--ds-raise);
}

.ds-picker-item.is-current {
    background: var(--ds-accent-soft);
}

.ds-picker-item-name {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.ds-picker-check {
    color: var(--ds-accent-ink);
}

.ds-picker-all {
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--ds-line);
    border-radius: 0 0 8px 8px;
    color: var(--ds-muted) !important;
}

/* ── Server pictures ── */

/* A server without a picture shows its first letter, in one of six tones from its id. */
.ds-tone-1 { background: #2563eb; }
.ds-tone-2 { background: #0e7490; }
.ds-tone-3 { background: #15803d; }
.ds-tone-4 { background: #b45309; }
.ds-tone-5 { background: #be185d; }

.ds-server-icon {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.ds-server-icon--sm {
    width: 28px;
    height: 28px;
    font-size: 13px;
}

.ds-server-icon--lg {
    width: 72px;
    height: 72px;
    font-size: 28px;
}

.ds-server-icon--xl {
    width: 80px;
    height: 80px;
    font-size: 32px;
}

/* ── The sections down the side ── */

.ds-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ds-nav-group {
    margin: 14px 10px 6px;
    color: var(--ds-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ds-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--ds-muted) !important;
    font-weight: 600;
    text-decoration: none;
}

.ds-nav-item:hover {
    background: var(--ds-raise);
    color: var(--ds-ink) !important;
}

.ds-nav-item.is-on {
    background: var(--ds-accent-soft);
    color: var(--ds-ink) !important;
    box-shadow: inset 3px 0 0 var(--ds-accent);
}

.ds-nav-item.is-on .ds-icon {
    color: var(--ds-accent-ink);
}

.ds-side-note {
    margin: auto 8px 0;
    padding-top: 16px;
    color: var(--ds-muted);
    font-size: 13px;
}

/* ── Headings and words ── */

.ds-eyebrow {
    margin: 0 0 4px;
    color: var(--ds-accent-ink);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ds-h1 {
    margin: 0;
    font-family: var(--ds-font-display);
    font-size: clamp(26px, 3vw, 32px);
    line-height: 1.15;
}

.ds-h2 {
    margin: 32px 0 12px;
    color: var(--ds-muted);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.ds-lead {
    margin: 6px 0 0;
    max-width: 62ch;
    color: var(--ds-muted);
    font-size: 16px;
}

.ds-small,
.ds-foot {
    margin: 24px 0 0;
    max-width: 62ch;
    color: var(--ds-muted);
    font-size: 14px;
}

.ds-hero,
.ds-tabhead {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
}

.ds-tabhead-icon,
.ds-card-icon {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: var(--ds-radius);
    background: var(--ds-accent-soft);
    color: var(--ds-accent-ink);
}

.ds-tabhead-icon .ds-icon {
    width: 24px;
    height: 24px;
}

.ds-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 12px 0 0;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--ds-raise);
    color: var(--ds-muted);
    font-size: 13px;
    font-weight: 600;
}

.ds-chip .ds-icon {
    width: 16px;
    height: 16px;
}

/* ── Notices ── */

.ds-flash {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid var(--ds-line-strong);
    border-left-width: 4px;
    border-radius: 10px;
    background: var(--ds-panel);
}

.ds-flash.is-ok {
    border-left-color: var(--ds-ok);
}

.ds-flash.is-ok .ds-icon {
    color: var(--ds-ok);
}

.ds-flash.is-warn {
    border-left-color: var(--ds-warn);
}

.ds-flash.is-warn .ds-icon {
    color: var(--ds-warn);
}

.ds-flash.is-info {
    border-left-color: var(--ds-accent);
}

.ds-flash.is-info .ds-icon {
    color: var(--ds-accent-ink);
}

.ds-now {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: baseline;
    margin: 0 0 16px;
    color: var(--ds-muted);
}

.ds-now-label {
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--ds-raise);
    color: var(--ds-ink);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ── Panels and the overview's cards ── */

.ds-panel {
    padding: 24px;
    border: 1px solid var(--ds-line);
    border-radius: var(--ds-radius);
    background: var(--ds-panel);
}

.ds-empty {
    max-width: 620px;
}

.ds-empty h1,
.ds-empty h2 {
    margin: 8px 0;
    color: var(--ds-ink);
    font-family: var(--ds-font-display);
    font-size: 22px;
    letter-spacing: 0;
    text-transform: none;
}

.ds-empty-icon {
    width: 32px;
    height: 32px;
    color: var(--ds-warn);
}

.ds-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.ds-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ds-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    height: 100%;
    padding: 18px;
    border: 1px solid var(--ds-line);
    border-radius: var(--ds-radius);
    background: var(--ds-panel);
    color: var(--ds-ink) !important;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}

.ds-card:hover {
    border-color: var(--ds-accent);
    background: var(--ds-raise);
}

.ds-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.ds-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ds-card-name {
    font-weight: 700;
    font-size: 16px;
}

.ds-card-about {
    color: var(--ds-muted);
    font-size: 14px;
}

.ds-card-now {
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--ds-line);
    color: var(--ds-ink);
    font-size: 13px;
}

.ds-card-go {
    align-self: center;
    color: var(--ds-muted);
}

/* ── A section's form ── */

.ds-form {
    margin: 0;
}

.ds-fields {
    display: grid;
    gap: 28px;
}

.ds-field {
    display: grid;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.ds-label {
    padding: 0;
    font-weight: 700;
    font-size: 15px;
}

.ds-desc,
.ds-field-note {
    margin: 0;
    color: var(--ds-muted);
    font-size: 14px;
}

/* A tick box group: one switch a row. */
.ds-switches {
    display: grid;
    border: 1px solid var(--ds-line);
    border-radius: 10px;
    overflow: hidden;
}

.ds-switchrow {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--ds-raise);
    cursor: pointer;
}

.ds-switches .ds-switchrow + .ds-switchrow {
    border-top: 1px solid var(--ds-line);
}

.ds-field.ds-switchrow {
    border: 1px solid var(--ds-line);
    border-radius: 10px;
}

.ds-switchrow-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ds-switchrow-name {
    font-weight: 600;
}

.ds-switchrow-desc {
    color: var(--ds-muted);
    font-size: 14px;
}

.ds-switch {
    position: relative;
    flex: none;
    width: 44px;
    height: 26px;
    margin: 0;
    border-radius: 999px;
    background: #4b4e57;
    appearance: none;
    cursor: pointer;
    transition: background 0.15s;
}

.ds-switch::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.15s;
}

.ds-switch:checked {
    background: var(--ds-ok);
}

.ds-switch:checked::before {
    transform: translateX(18px);
}

/* A choice: option cards. */
.ds-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
    gap: 10px;
}

.ds-option {
    position: relative;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border: 1px solid var(--ds-line-strong);
    border-radius: 10px;
    background: var(--ds-raise);
    cursor: pointer;
}

.ds-option:hover {
    border-color: var(--ds-accent);
}

.ds-option:has(.ds-option-input:checked) {
    border-color: var(--ds-accent);
    background: var(--ds-accent-soft);
}

.ds-option-input {
    flex: none;
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    accent-color: var(--ds-accent);
}

.ds-option-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ds-option-name {
    font-weight: 600;
}

.ds-option-desc {
    color: var(--ds-muted);
    font-size: 14px;
}

.ds-input,
.ds-select {
    width: 100%;
    max-width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--ds-line-strong);
    border-radius: 8px;
    background: var(--ds-bg);
    color: var(--ds-ink);
    font: inherit;
}

.ds-input:focus,
.ds-select:focus {
    border-color: var(--ds-accent);
}

.ds-input--short {
    width: 9em;
}

.ds-select {
    max-width: 420px;
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a9adb6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
}

.ds-select[multiple] {
    min-height: 9em;
    background-image: none;
}

.ds-form-actions {
    display: flex;
    justify-content: flex-end;
}

/* With the script on, Save lives in the bar that comes up once something changed. */
.ds-js .ds-form-actions {
    display: none;
}

.ds-savebar {
    position: fixed;
    left: 50%;
    bottom: 20px;
    z-index: 40;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    width: min(760px, calc(100% - 32px));
    padding: 12px 12px 12px 18px;
    border: 1px solid var(--ds-line-strong);
    border-radius: var(--ds-radius);
    background: #0b0c0e;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    transform: translateX(-50%);
}

.ds-savebar[hidden] {
    display: none;
}

.ds-savebar-text {
    flex: 1;
    min-width: 12em;
    margin: 0;
    font-weight: 600;
}

/* ── A section's blocks: words, forms, buttons and a list (the Start here panel, Tags, Class mode) ── */

.ds-blocks {
    display: grid;
    gap: 16px;
}

.ds-block {
    display: grid;
    gap: 14px;
    margin: 0;
}

.ds-block-title {
    margin: 0;
    font-family: var(--ds-font-display);
    font-size: 18px;
}

.ds-block-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}

.ds-block-actions form {
    margin: 0;
}

.ds-block-text p {
    margin: 0 0 10px;
    color: var(--ds-muted);
}

.ds-ticks {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ds-ticks li {
    position: relative;
    padding-left: 22px;
}

.ds-ticks li::before {
    content: "";
    position: absolute;
    top: 0.55em;
    left: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ds-accent);
}

.ds-btn--danger {
    background: #da373c;
    color: #fff !important;
}

.ds-btn--danger:hover {
    background: #b32b30;
}

.ds-btn--danger-ghost {
    border-color: rgba(242, 63, 67, 0.55);
    background: transparent;
    color: #fca5a5 !important;
}

.ds-btn--danger-ghost:hover {
    background: rgba(242, 63, 67, 0.12);
}

/* Ask first: the button opens what it will do, and a second button says yes. */
.ds-confirm > summary {
    list-style: none;
    cursor: pointer;
}

.ds-confirm > summary::-webkit-details-marker {
    display: none;
}

.ds-confirm-body {
    display: grid;
    gap: 12px;
    justify-items: start;
    margin-top: 10px;
    padding: 14px;
    border: 1px solid rgba(242, 63, 67, 0.45);
    border-radius: 10px;
    background: rgba(242, 63, 67, 0.08);
}

.ds-confirm-body p {
    margin: 0;
}

/* A list: one item a row (a tag), opened to show and change it. */
.ds-items {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ds-item {
    border: 1px solid var(--ds-line);
    border-radius: var(--ds-radius);
    background: var(--ds-panel);
}

.ds-item[open] {
    border-color: var(--ds-line-strong);
}

.ds-item > summary {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    align-items: baseline;
    padding: 14px 44px 14px 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a9adb6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px;
    list-style: none;
    cursor: pointer;
}

.ds-item > summary::-webkit-details-marker {
    display: none;
}

.ds-item[open] > summary {
    border-bottom: 1px solid var(--ds-line);
}

.ds-item-name {
    font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 600;
}

.ds-item-meta {
    color: var(--ds-muted);
    font-size: 14px;
}

.ds-item-body {
    display: grid;
    gap: 16px;
    padding: 16px;
}

.ds-input--code {
    min-height: 16em;
    font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 14px;
    line-height: 1.5;
    tab-size: 4;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}

/* ── The server list ── */

.ds-pagehead {
    margin-bottom: 24px;
}

.ds-signin {
    max-width: 560px;
    margin: 48px auto 0;
    text-align: center;
}

.ds-signin .ds-lead {
    margin: 8px auto 24px;
}

.ds-signin .ds-small {
    margin: 20px auto 0;
}

.ds-servers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ds-server {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 24px 18px 18px;
    border: 1px solid var(--ds-line);
    border-radius: var(--ds-radius);
    background: var(--ds-panel);
    text-align: center;
}

.ds-server--add {
    border-style: dashed;
}

.ds-server-name {
    margin: 8px 0 0;
    overflow-wrap: anywhere;
    font-size: 17px;
}

.ds-server-how {
    flex: 1;
    margin: 0 0 10px;
    color: var(--ds-muted);
    font-size: 14px;
}

.ds-server .ds-btn {
    width: 100%;
}

/* ── Narrow screens: the side becomes the switcher and a row of tabs ── */

/* ── Stats (lib/discord-charts.js, views/partials/ds-chart.ejs): the period, the tiles, column charts and ranked bars.
   Thin marks in Striqr's purple on a hairline grid; every number is also in words or in a table. ── */

.ds-period {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-top: 16px;
}

.ds-period-title {
    margin: 0;
}

.ds-period-pick {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ds-period-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 14px;
    border: 1px solid var(--ds-line-strong);
    border-radius: 999px;
    color: var(--ds-ink) !important;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.ds-period-option:hover {
    background: var(--ds-raise);
}

.ds-period-option.is-on {
    border-color: var(--ds-accent);
    background: var(--ds-accent-soft);
}

.ds-period-check {
    width: 16px;
    height: 16px;
    stroke-width: 3;
}

.ds-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ds-tile {
    display: grid;
    align-content: start;
    gap: 4px;
    padding: 16px 18px;
    border: 1px solid var(--ds-line);
    border-radius: var(--ds-radius);
    background: var(--ds-panel);
}

.ds-tile-label,
.ds-tile-words,
.ds-chart-sum,
.ds-chart-none {
    margin: 0;
    color: var(--ds-muted);
    font-size: 14px;
}

.ds-tile-words {
    font-size: 13px;
}

.ds-tile-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.15;
}

/* A wide table scrolls in its own box: nothing in a block may widen the page. */
.ds-blocks > *,
.ds-chart > * {
    min-width: 0;
}

/* A column chart: the plot (gridlines, the columns, the baseline), the days or months under it, and a tip. */
.ds-cols {
    --ds-gutter: 44px;
    --ds-col-gap: clamp(1px, 0.4%, 2px);
    position: relative;
    padding-top: 28px;
}

.ds-cols-plot {
    position: relative;
    height: 180px;
    margin-left: var(--ds-gutter);
    border-bottom: 1px solid var(--ds-line-strong);
}

.ds-cols-grid {
    position: absolute;
    inset: 0;
}

.ds-cols-tick {
    position: absolute;
    right: 0;
    bottom: calc(var(--at) * 100%);
    left: 0;
    border-top: 1px solid var(--ds-line);
}

.ds-cols-tick:first-child {
    border-top: 0;
}

.ds-cols-tick-text {
    position: absolute;
    right: calc(100% + 8px);
    bottom: -0.65em;
    color: var(--ds-muted);
    font-size: 12px;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ds-cols-bars,
.ds-cols-axis {
    display: flex;
    gap: var(--ds-col-gap);
    margin: 0;
    padding: 0 2px;
    list-style: none;
}

.ds-cols-bars {
    position: absolute;
    inset: 0;
    align-items: flex-end;
}

.ds-col {
    position: relative;
    display: flex;
    flex: 1 1 0;
    align-items: flex-end;
    justify-content: center;
    min-width: 0;
    height: 100%;
}

.ds-col-bar {
    width: 100%;
    max-width: 24px;
    height: calc(var(--h) * 100%);
    border-radius: 4px 4px 0 0;
    background: var(--ds-accent);
}

.ds-col.is-on {
    background: rgba(255, 255, 255, 0.05);
}

.ds-col.is-on .ds-col-bar {
    background: var(--ds-accent-ink);
}

.ds-col-cap,
.ds-cols-axis-item span {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    white-space: nowrap;
}

.ds-col-cap {
    bottom: calc(var(--h) * 100% + 4px);
    font-weight: 600;
}

.ds-col.is-last .ds-col-cap,
.ds-cols-axis-item.is-last span {
    right: 0;
    left: auto;
    transform: none;
}

.ds-cols-none {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
}

.ds-cols-axis {
    height: 18px;
    margin: 6px 0 0 var(--ds-gutter);
}

.ds-cols-axis-item {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
}

.ds-cols-axis-item span {
    color: var(--ds-muted);
}

.ds-cols-tip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    margin: 0;
    padding: 6px 10px;
    border: 1px solid var(--ds-line-strong);
    border-radius: 8px;
    background: var(--ds-raise);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    color: var(--ds-muted);
    font-size: 13px;
    white-space: nowrap;
    pointer-events: none;
}

.ds-cols-tip strong {
    color: var(--ds-ink);
    font-size: 15px;
}

.ds-cols-tip[hidden] {
    display: none;
}

.ds-chart-table summary {
    color: var(--ds-accent-ink);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.ds-table-wrap {
    margin-top: 10px;
    overflow-x: auto;
}

.ds-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.ds-table th,
.ds-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--ds-line);
    text-align: left;
    white-space: nowrap;
}

.ds-table thead th {
    color: var(--ds-muted);
    font-weight: 600;
}

.ds-table tbody th {
    font-weight: 500;
}

.ds-table .is-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Ranked bars: a name, its bar and its number a row, the bars lined up. */
.ds-hbar-list {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ds-hbar {
    display: grid;
    grid-template-columns: minmax(90px, 13rem) 1fr auto;
    align-items: center;
    gap: 6px 12px;
}

.ds-hbar-name {
    overflow-wrap: anywhere;
}

.ds-hbar-track {
    display: block;
    height: 12px;
}

.ds-hbar-fill {
    display: block;
    width: calc(var(--w) * 100%);
    height: 100%;
    border-radius: 0 4px 4px 0;
    background: var(--ds-accent);
}

.ds-hbar-value {
    min-width: 3ch;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

@media (max-width: 560px) {
    .ds-hbar {
        grid-template-columns: 1fr auto;
    }

    .ds-hbar-name {
        grid-column: 1 / -1;
    }

    .ds-cols {
        --ds-gutter: 36px;
    }

    .ds-cols-axis-item .is-wide {
        display: none;
    }
}

@media (max-width: 860px) {
    .ds-top {
        padding: 0 14px;
    }

    .ds-top-title,
    .ds-top-name {
        display: none;
    }

    .ds-app {
        display: block;
    }

    .ds-side {
        position: static;
        height: auto;
        padding: 12px 14px 0;
        border-right: 0;
        border-bottom: 1px solid var(--ds-line);
        overflow: visible;
    }

    .ds-nav {
        flex-direction: row;
        gap: 4px;
        margin: 0 -14px;
        padding: 0 14px 10px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .ds-nav::-webkit-scrollbar {
        display: none;
    }

    .ds-nav-group,
    .ds-side-note {
        display: none;
    }

    .ds-nav-item {
        flex: none;
        padding: 8px 12px;
        white-space: nowrap;
    }

    .ds-nav-item.is-on {
        box-shadow: inset 0 -3px 0 var(--ds-accent);
    }

    .ds-main {
        padding: 24px 16px 140px;
    }

    .ds-hero {
        align-items: flex-start;
    }

    .ds-panel {
        padding: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ds-switch,
    .ds-switch::before,
    .ds-picker-chevron,
    .ds-card {
        transition: none;
    }
}
