/* ==========================================================================
   DevBrain — Your Second Brain
   Design system. All styling lives here (no inline CSS anywhere).
   Prefix: db-   |   Theme-aware (light/dark)   |   Responsive.
   ========================================================================== */

:root {
    --db-primary: #6c5ce7;
    --db-primary-600: #5b4bd6;
    --db-primary-700: #4c3fc0;
    --db-primary-soft: #efedfd;
    --db-primary-soft-2: #f5f4fe;

    --db-bg: #f5f6f8;
    --db-surface: #ffffff;
    --db-surface-2: #fafafb;
    --db-sidebar: #ffffff;
    --db-border: #eceef1;
    --db-border-strong: #e2e5ea;

    --db-text: #1f2430;
    --db-text-soft: #566072;
    --db-text-muted: #8a94a6;

    --db-green: #22b573;
    --db-green-soft: #e6f7ef;
    --db-blue: #3b82f6;
    --db-blue-soft: #e8f1fe;
    --db-orange: #f59e42;
    --db-orange-soft: #fdf0e3;
    --db-red: #ef5b6e;
    --db-red-soft: #fdeaed;
    --db-amber: #f0b429;
    --db-amber-soft: #fdf4e0;
    --db-violet: #6c5ce7;
    --db-violet-soft: #efedfd;

    --db-radius: 14px;
    --db-radius-sm: 10px;
    --db-radius-lg: 18px;
    --db-shadow: 0 1px 3px rgba(23, 28, 41, .06), 0 1px 2px rgba(23, 28, 41, .04);
    --db-shadow-lg: 0 10px 30px rgba(23, 28, 41, .08);

    --db-sidebar-w: 246px;
    --db-topbar-h: 72px;
    --db-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

[data-theme="dark"] {
    --db-bg: #0f1420;
    --db-surface: #171d2b;
    --db-surface-2: #1c2334;
    --db-sidebar: #141a27;
    --db-border: #232b3d;
    --db-border-strong: #2c3547;
    --db-text: #e7ebf3;
    --db-text-soft: #aab3c5;
    --db-text-muted: #79839a;
    --db-primary-soft: #241f4d;
    --db-primary-soft-2: #1e1a3f;
    --db-green-soft: #16342a;
    --db-blue-soft: #16283f;
    --db-orange-soft: #34281a;
    --db-red-soft: #3a2028;
    --db-amber-soft: #33291a;
    --db-violet-soft: #241f4d;
    --db-shadow: 0 1px 3px rgba(0, 0, 0, .3);
    --db-shadow-lg: 0 10px 30px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--db-font);
    background: var(--db-bg);
    color: var(--db-text);
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
    max-width: 100%;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img { max-width: 100%; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; color: var(--db-text); }
p { margin: 0; }
ul { margin: 0; }

/* ---------- App shell ---------- */
.db-app { display: flex; min-height: 100vh; }

.db-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    margin-left: var(--db-sidebar-w);
}

.db-content { padding: 26px 30px 60px; }

/* ---------- Sidebar ---------- */
.db-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--db-sidebar-w);
    background: var(--db-sidebar);
    border-right: 1px solid var(--db-border);
    display: flex;
    flex-direction: column;
    z-index: 60;
    overflow-y: auto;
}

.db-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 20px 22px 16px;
}
.db-brand__logo {
    width: 38px; height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--db-primary), #8b7cf0);
    display: grid; place-items: center;
    color: #fff; flex-shrink: 0;
}
.db-brand__text { display: flex; flex-direction: column; min-width: 0; }
.db-brand__name { display: block; font-size: 17px; font-weight: 800; letter-spacing: -.2px; }
.db-brand__sub { display: block; font-size: 11px; color: var(--db-text-muted); margin-top: 1px; }

.db-nav { padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; }
.db-nav__item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    border-radius: var(--db-radius-sm);
    color: var(--db-text-soft);
    font-weight: 500;
    transition: background .15s, color .15s;
}
.db-nav__item svg { width: 19px; height: 19px; flex-shrink: 0; }
.db-nav__item:hover { background: var(--db-surface-2); color: var(--db-text); }
.db-nav__item.is-active { background: var(--db-primary-soft); color: var(--db-primary); font-weight: 600; }
.db-nav__badge { margin-left: auto; font-size: 11px; color: var(--db-text-muted); }

.db-nav__title {
    padding: 16px 14px 6px;
    font-size: 11px; font-weight: 700; letter-spacing: .5px;
    text-transform: uppercase; color: var(--db-text-muted);
}
.db-cat { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: var(--db-radius-sm); color: var(--db-text-soft); }
.db-cat:hover { background: var(--db-surface-2); }
.db-cat__dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.db-cat__count { margin-left: auto; font-size: 11px; color: var(--db-text-muted); }
.db-cat--add { color: var(--db-primary); font-weight: 600; }

.db-storage {
    margin: 14px 14px 18px;
    padding: 14px;
    border: 1px solid var(--db-border);
    border-radius: var(--db-radius);
    background: var(--db-surface-2);
}
.db-storage__label { font-size: 12px; font-weight: 600; margin-bottom: 9px; }
.db-storage__bar { height: 7px; border-radius: 6px; background: var(--db-border-strong); overflow: hidden; }
.db-storage__fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--db-green), #4cd18a); }
.db-storage__text { font-size: 11px; color: var(--db-text-muted); margin-top: 8px; }
.db-storage__upgrade { display: inline-flex; gap: 6px; align-items: center; margin-top: 10px; font-size: 12px; color: var(--db-primary); font-weight: 600; }
.db-sidebar__foot { margin-top: auto; }

/* ---------- Collapsed sidebar (desktop icons-only) ---------- */
@media (min-width: 1025px) {
    body.db-collapsed { --db-sidebar-w: 76px; }
    body.db-collapsed .db-brand { justify-content: center; gap: 0; padding: 20px 0 16px; }
    body.db-collapsed .db-brand__text { display: none; }
    body.db-collapsed .db-nav { padding: 6px 10px; }
    body.db-collapsed .db-nav__item { justify-content: center; padding: 11px 0; }
    body.db-collapsed .db-nav__item > span { display: none; }        /* label + count badge */
    body.db-collapsed .db-nav__title { display: none; }
    body.db-collapsed .db-cat { justify-content: center; padding: 8px 0; }
    body.db-collapsed .db-cat > span:not([class]) { display: none; } /* category name / "Add Category" text */
    body.db-collapsed .db-cat__count { display: none; }
    body.db-collapsed .db-storage { display: none; }
    body.db-collapsed .db-adm-foot__main,
    body.db-collapsed .db-adm-foot__status { display: none; }
    body.db-collapsed .db-adm-foot { justify-content: center; gap: 0; margin: 6px 8px 16px; padding: 8px; }
    body.db-collapsed .db-sidebar__foot .db-nav__item { padding: 11px 0; }
}

/* ---------- Topbar ---------- */
.db-topbar {
    position: sticky; top: 0; z-index: 40;
    height: var(--db-topbar-h);
    background: var(--db-surface);
    border-bottom: 1px solid var(--db-border);
    display: flex; align-items: center; gap: 18px;
    padding: 0 30px;
}
.db-search {
    flex: 1; max-width: 720px;
    display: flex; align-items: center; gap: 10px;
    background: var(--db-surface-2);
    border: 1px solid var(--db-border);
    border-radius: var(--db-radius-sm);
    padding: 10px 14px;
    color: var(--db-text-muted);
}
.db-search input { border: 0; background: transparent; outline: none; flex: 1; color: var(--db-text); font-size: 13.5px; }
.db-search__kbd { font-size: 11px; border: 1px solid var(--db-border-strong); border-radius: 6px; padding: 2px 7px; color: var(--db-text-muted); }
.db-topbar__spacer { flex: 1; }
.db-topbar__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.db-iconbtn {
    width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
    display: grid; place-items: center;
    background: transparent; border: 1px solid transparent; color: var(--db-text-soft);
}
.db-iconbtn:hover { background: var(--db-surface-2); color: var(--db-text); }
.db-user { display: flex; align-items: center; gap: 10px; padding: 5px 8px 5px 5px; border-radius: 12px; }
.db-user:hover { background: var(--db-surface-2); }
.db-user__avatar { width: 38px; height: 38px; min-width: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--db-primary-soft); }
.db-user__name { font-size: 13.5px; font-weight: 700; line-height: 1.1; }
.db-user__role { font-size: 11.5px; color: var(--db-text-muted); }

/* ---------- Page header ---------- */
.db-page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.db-page-head__titles { flex: 1; min-width: 200px; }
.db-page-title { font-size: 26px; font-weight: 800; letter-spacing: -.4px; display: flex; align-items: center; gap: 10px; }
.db-page-sub { color: var(--db-text-soft); margin-top: 5px; }
.db-page-head__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.db-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px; border-radius: var(--db-radius-sm);
    font-weight: 600; font-size: 13.5px; border: 1px solid transparent;
    background: var(--db-surface); color: var(--db-text); border-color: var(--db-border-strong);
    transition: background .15s, border-color .15s, transform .05s;
}
.db-btn svg { width: 17px; height: 17px; }
.db-btn:hover { background: var(--db-surface-2); }
.db-btn:active { transform: translateY(1px); }
.db-btn--primary { background: var(--db-primary); color: #fff; border-color: var(--db-primary); }
.db-btn--primary:hover { background: var(--db-primary-600); }
.db-btn--danger { background: var(--db-red); color: #fff; border-color: var(--db-red); }
.db-btn--danger:hover { filter: brightness(.95); }
.db-btn--ghost { background: transparent; border-color: transparent; color: var(--db-text-soft); }
.db-btn--sm { padding: 7px 12px; font-size: 12.5px; }
.db-btn--block { width: 100%; justify-content: center; }

/* ---------- Cards ---------- */
.db-card {
    background: var(--db-surface);
    border: 1px solid var(--db-border);
    border-radius: var(--db-radius);
    box-shadow: var(--db-shadow);
}
.db-card__pad { padding: 20px; }
.db-card__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--db-border); }
.db-card__title { font-size: 15.5px; font-weight: 700; }
.db-card__link { color: var(--db-primary); font-weight: 600; font-size: 13px; }

/* ---------- Grid helpers ---------- */
.db-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; }
.db-grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.db-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.db-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.db-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.db-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; }
.db-cols--wide { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; }
.db-mt { margin-top: 18px; }
.db-mb { margin-bottom: 18px; }

/* ---------- Stat cards ---------- */
.db-stat {
    background: var(--db-surface); border: 1px solid var(--db-border);
    border-radius: var(--db-radius); padding: 18px; box-shadow: var(--db-shadow);
    display: flex; flex-direction: column; gap: 10px;
}
.db-stat__top { display: flex; align-items: center; gap: 12px; }
.db-stat__icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.db-stat__icon svg { width: 22px; height: 22px; }
.db-stat__label { font-size: 13px; color: var(--db-text-soft); font-weight: 600; }
.db-stat__value { font-size: 27px; font-weight: 800; letter-spacing: -.5px; }
.db-stat__delta { font-size: 12px; color: var(--db-green); font-weight: 600; }

/* soft tinted tiles */
.db-tile--violet { background: var(--db-violet-soft); color: var(--db-violet); }
.db-tile--green { background: var(--db-green-soft); color: var(--db-green); }
.db-tile--orange { background: var(--db-orange-soft); color: var(--db-orange); }
.db-tile--blue { background: var(--db-blue-soft); color: var(--db-blue); }
.db-tile--red { background: var(--db-red-soft); color: var(--db-red); }
.db-tile--amber { background: var(--db-amber-soft); color: var(--db-amber); }

/* ---------- Badges / pills ---------- */
.db-badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
    background: var(--db-surface-2); color: var(--db-text-soft);
}
.db-badge--violet { background: var(--db-violet-soft); color: var(--db-violet); }
.db-badge--green { background: var(--db-green-soft); color: var(--db-green); }
.db-badge--orange { background: var(--db-orange-soft); color: var(--db-orange); }
.db-badge--blue { background: var(--db-blue-soft); color: var(--db-blue); }
.db-badge--red { background: var(--db-red-soft); color: var(--db-red); }
.db-badge--amber { background: var(--db-amber-soft); color: var(--db-amber); }
.db-tag { display: inline-flex; padding: 3px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 500; background: var(--db-surface-2); color: var(--db-text-soft); border: 1px solid var(--db-border); }
.db-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.db-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.db-dot--violet { background: var(--db-violet); }
.db-dot--green { background: var(--db-green); }
.db-dot--orange { background: var(--db-orange); }
.db-dot--blue { background: var(--db-blue); }
.db-dot--red { background: var(--db-red); }
.db-dot--amber { background: var(--db-amber); }
.db-dot--muted { background: var(--db-border-strong); }

/* ---------- Tabs / filter bar ---------- */
.db-tabs { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.db-tab {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 14px; border-radius: var(--db-radius-sm);
    border: 1px solid var(--db-border-strong); background: var(--db-surface);
    color: var(--db-text-soft); font-weight: 600; font-size: 13px;
}
.db-tab svg { width: 16px; height: 16px; }
.db-tab:hover { background: var(--db-surface-2); }
.db-tab.is-active { background: var(--db-primary-soft); color: var(--db-primary); border-color: transparent; }
.db-toolbar { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.db-toolbar__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.db-select {
    padding: 9px 12px; border-radius: var(--db-radius-sm);
    border: 1px solid var(--db-border-strong); background: var(--db-surface);
    color: var(--db-text); font-size: 13px; font-weight: 500;
}
.db-viewtoggle { display: inline-flex; border: 1px solid var(--db-border-strong); border-radius: var(--db-radius-sm); overflow: hidden; }
.db-viewtoggle button { padding: 8px 10px; background: var(--db-surface); border: 0; color: var(--db-text-muted); }
.db-viewtoggle button.is-active { background: var(--db-primary-soft); color: var(--db-primary); }

.db-info-banner {
    display: flex; align-items: center; gap: 10px; justify-content: space-between;
    background: var(--db-primary-soft-2); border: 1px solid var(--db-border);
    border-radius: var(--db-radius); padding: 13px 16px; margin-bottom: 16px;
    color: var(--db-text-soft); font-weight: 500;
}
.db-info-banner a { color: var(--db-primary); font-weight: 600; }

/* ---------- Table ---------- */
.db-table-wrap { overflow-x: auto; }
.db-table { width: 100%; border-collapse: collapse; }
.db-table th {
    text-align: left; font-size: 12px; font-weight: 700; text-transform: none;
    color: var(--db-text-muted); padding: 14px 16px; border-bottom: 1px solid var(--db-border);
}
.db-table td { padding: 15px 16px; border-bottom: 1px solid var(--db-border); vertical-align: middle; }
.db-table tr:last-child td { border-bottom: 0; }
.db-table tbody tr:hover { background: var(--db-surface-2); }
.db-titlecell { display: flex; align-items: center; gap: 12px; }
.db-titlecell__icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.db-titlecell__icon svg { width: 19px; height: 19px; }
.db-titlecell__name { font-weight: 600; color: var(--db-text); }
.db-titlecell__sub { font-size: 12px; color: var(--db-text-muted); margin-top: 2px; }
.db-cell-muted { color: var(--db-text-muted); font-size: 13px; }
.db-star { color: var(--db-amber); }
.db-star--off { color: var(--db-border-strong); }
.db-rowactions { display: flex; align-items: center; gap: 6px; }

/* ---------- Item cards (grid view) ---------- */
.db-itemcard { background: var(--db-surface); border: 1px solid var(--db-border); border-radius: var(--db-radius); padding: 18px; box-shadow: var(--db-shadow); display: flex; flex-direction: column; gap: 12px; }
.db-itemcard__head { display: flex; align-items: flex-start; justify-content: space-between; }
.db-itemcard__type { font-size: 11px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--db-text-muted); }
.db-itemcard__title { font-size: 15px; font-weight: 700; }
.db-itemcard__desc { color: var(--db-text-soft); font-size: 13px; }
.db-itemcard__foot { display: flex; align-items: center; justify-content: space-between; color: var(--db-text-muted); font-size: 12px; margin-top: auto; }

/* ---------- Code block ---------- */
.db-code {
    background: #0f1626; color: #d7def0; border-radius: var(--db-radius-sm);
    padding: 16px 18px; overflow-x: auto; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 12.5px; line-height: 1.7; white-space: pre;
}
.db-code__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.db-code__lang { font-size: 12px; font-weight: 700; color: var(--db-text-muted); }

/* ---------- Donut chart (pure CSS via conic-gradient) ---------- */
.db-donut-wrap { display: flex; align-items: center; justify-content: center; gap: 22px; flex-wrap: wrap; }
.db-donut { width: 150px; height: 150px; border-radius: 50%; position: relative; flex-shrink: 0; }
.db-donut__hole { position: absolute; inset: 26px; background: var(--db-surface); border-radius: 50%; display: grid; place-items: center; text-align: center; }
.db-donut__value { font-size: 22px; font-weight: 800; }
.db-donut__label { font-size: 11px; color: var(--db-text-muted); }
.db-legend { display: flex; flex-direction: column; gap: 11px; flex: 1; min-width: 160px; }
.db-legend__row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.db-legend__name { color: var(--db-text-soft); }
.db-legend__val { margin-left: auto; font-weight: 700; }

/* ---------- Progress bars ---------- */
.db-progress { height: 7px; border-radius: 6px; background: var(--db-border-strong); overflow: hidden; }
.db-progress__fill { height: 100%; border-radius: 6px; background: var(--db-primary); }
.db-progress--green .db-progress__fill { background: var(--db-green); }

/* ---------- Lists (recent notes etc) ---------- */
.db-list { display: flex; flex-direction: column; }
.db-listrow { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--db-border); }
.db-listrow:last-child { border-bottom: 0; }
.db-listrow__num { width: 22px; color: var(--db-text-muted); font-weight: 600; font-size: 13px; }
.db-listrow__icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.db-listrow__icon svg { width: 17px; height: 17px; }
.db-listrow__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.db-listrow__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.db-listrow__meta { color: var(--db-text-muted); font-size: 12px; }

/* ---------- Quick actions ---------- */
.db-quick { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; }
.db-quick__item { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--db-border); border-radius: var(--db-radius-sm); background: var(--db-surface); }
.db-quick__item:hover { border-color: var(--db-primary); background: var(--db-primary-soft-2); }
.db-quick__ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; }

/* ---------- Calendar ---------- */
.db-cal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.db-cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.db-cal__dow { font-size: 11px; color: var(--db-text-muted); font-weight: 700; padding: 6px 0; }
.db-cal__day { padding: 8px 0; border-radius: 9px; font-size: 13px; color: var(--db-text-soft); }
.db-cal__day.is-muted { color: var(--db-text-muted); opacity: .5; }
.db-cal__day.is-today { background: var(--db-primary); color: #fff; font-weight: 700; }

/* ---------- Forms ---------- */
.db-form { display: flex; flex-direction: column; gap: 18px; }
.db-field { display: flex; flex-direction: column; gap: 7px; }
.db-field__label { font-size: 13px; font-weight: 600; color: var(--db-text); }
.db-field__hint { font-size: 12px; color: var(--db-text-muted); }
.db-input, .db-textarea {
    width: 100%; padding: 11px 13px; border-radius: var(--db-radius-sm);
    border: 1px solid var(--db-border-strong); background: var(--db-surface);
    color: var(--db-text); font-size: 13.5px; font-family: inherit; outline: none;
}
.db-input:focus, .db-textarea:focus { border-color: var(--db-primary); box-shadow: 0 0 0 3px var(--db-primary-soft); }
.db-textarea { resize: vertical; min-height: 120px; }
.db-textarea--code { font-family: ui-monospace, Menlo, Consolas, monospace; min-height: 220px; }
.db-field__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.db-error { color: var(--db-red); font-size: 12.5px; }
.db-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--db-text-soft); }

.db-alert { padding: 12px 16px; border-radius: var(--db-radius-sm); margin-bottom: 18px; font-weight: 500; }
.db-alert--success { background: var(--db-green-soft); color: var(--db-green); }
.db-alert--error { background: var(--db-red-soft); color: var(--db-red); }

/* ---------- Empty state ---------- */
.db-empty { text-align: center; padding: 50px 20px; color: var(--db-text-muted); grid-column: 1 / -1; width: 100%; }
.db-empty svg { width: 44px; height: 44px; margin-bottom: 12px; opacity: .5; }

/* ---------- Pagination ---------- */
.db-pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; flex-wrap: wrap; gap: 10px; }
.db-pagination__info { color: var(--db-text-muted); font-size: 13px; }
.db-pagination nav { display: flex; gap: 4px; }
.db-pagination a, .db-pagination span { padding: 7px 12px; border-radius: 9px; border: 1px solid var(--db-border-strong); font-size: 13px; color: var(--db-text-soft); }
.db-pagination .active span { background: var(--db-primary); color: #fff; border-color: var(--db-primary); }

/* ---------- Mood selector ---------- */
.db-moods { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.db-mood { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border-radius: var(--db-radius-sm); border: 1px solid var(--db-border); background: var(--db-surface); font-size: 12.5px; font-weight: 600; color: var(--db-text-soft); }
.db-mood input { display: none; }
.db-mood__emoji { font-size: 22px; }
.db-mood.is-active { border-color: var(--db-primary); background: var(--db-primary-soft-2); color: var(--db-primary); }

/* ---------- Streak / misc ---------- */
.db-streak { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: var(--db-radius-sm); background: var(--db-amber-soft); color: var(--db-amber); font-weight: 700; }
.db-streak__num { font-size: 20px; }

/* ---------- Knowledge graph ---------- */
.db-graph { position: relative; height: 620px; background: radial-gradient(circle, var(--db-surface-2) 1px, transparent 1px); background-size: 22px 22px; border-radius: var(--db-radius); overflow: hidden; border: 1px solid var(--db-border); }
.db-graph__svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.db-node { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; cursor: grab; touch-action: none; }
.db-node.is-dragging { cursor: grabbing; z-index: 10; }
.db-graphhint { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 2px 2px; font-size: 12.5px; color: var(--db-text-muted); }
.db-graphhint span { display: inline-flex; align-items: center; gap: 6px; }
.db-graphhint svg { width: 14px; height: 14px; }
.db-node__circle { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--db-surface); border: 2px solid; box-shadow: var(--db-shadow); font-weight: 700; }
.db-node__circle svg { width: 22px; height: 22px; }
.db-node--lg .db-node__circle { width: 74px; height: 74px; }
.db-node__label { font-size: 11px; font-weight: 600; max-width: 90px; }
.db-node__count { font-size: 10px; color: var(--db-text-muted); }

/* ---------- AI chat ---------- */
.db-chat { display: flex; flex-direction: column; }
.db-chat__body { overflow-y: auto; max-height: 60vh; padding: 8px 4px; display: flex; flex-direction: column; gap: 18px; }
.db-msg { display: flex; gap: 12px; max-width: 82%; }
.db-msg__avatar { width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: var(--db-primary-soft); color: var(--db-primary); }
.db-msg__bubble { padding: 13px 16px; border-radius: 14px; background: var(--db-surface-2); border: 1px solid var(--db-border); white-space: pre-wrap; }
.db-msg--user { align-self: flex-end; flex-direction: row-reverse; }
.db-msg--user .db-msg__bubble { background: var(--db-primary-soft); border-color: transparent; }
.db-chat__input { display: flex; gap: 10px; align-items: flex-end; margin-top: 14px; }
.db-chat__input .db-textarea { min-height: 52px; }

.db-convlist { display: flex; flex-direction: column; gap: 4px; }
.db-conv { padding: 12px 14px; border-radius: var(--db-radius-sm); }
.db-conv:hover { background: var(--db-surface-2); }
.db-conv.is-active { background: var(--db-primary-soft); }
.db-conv__title { font-weight: 600; font-size: 13.5px; display: flex; justify-content: space-between; gap: 8px; }
.db-conv__time { font-size: 11px; color: var(--db-text-muted); font-weight: 500; }
.db-conv__preview { font-size: 12px; color: var(--db-text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Mobile header + bottom nav (hidden on desktop) ---------- */
.db-mobile-top { display: none; }
.db-bottomnav { display: none; }
.db-backdrop { display: none; }

/* ==========================================================================
   RESPONSIVE — tablet & mobile
   ========================================================================== */
@media (max-width: 1180px) {
    .db-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .db-grid--5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
    .db-grid--5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Stack the two-column layouts (main + right rail) once the sidebar
   switches to mobile mode, so nothing is pushed off-screen. */
@media (max-width: 1024px) {
    .db-cols, .db-cols--wide { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 1024px) {
    .db-sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--db-shadow-lg); }
    .db-sidebar.is-open { transform: translateX(0); }
    .db-main { margin-left: 0; }
    .db-topbar { display: none; }
    .db-mobile-top {
        display: flex; align-items: center; gap: 12px;
        position: sticky; top: 0; z-index: 40;
        height: 60px; padding: 0 16px;
        background: var(--db-surface); border-bottom: 1px solid var(--db-border);
    }
    .db-mobile-top__brand { display: flex; align-items: center; gap: 8px; margin: 0 auto; font-weight: 800; }
    .db-mobile-top__brand .db-brand__logo { width: 30px; height: 30px; border-radius: 9px; }
    .db-content { padding: 18px 16px 96px; }
    .db-backdrop.is-open { display: block; position: fixed; inset: 0; background: rgba(15,20,32,.4); z-index: 55; }

    .db-bottomnav {
        display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
        background: var(--db-surface); border-top: 1px solid var(--db-border);
        padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
        justify-content: space-around; align-items: center;
    }
    .db-bottomnav__item { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--db-text-muted); flex: 1; }
    .db-bottomnav__item svg { width: 21px; height: 21px; }
    .db-bottomnav__item.is-active { color: var(--db-primary); }
    .db-bottomnav__fab { width: 48px; height: 48px; border-radius: 50%; background: var(--db-primary); color: #fff; display: grid; place-items: center; margin-top: -22px; box-shadow: var(--db-shadow-lg); }
    .db-bottomnav__fab svg { width: 24px; height: 24px; }

    .db-page-title { font-size: 22px; }
    .db-chat { height: auto; }
}

@media (max-width: 640px) {
    .db-grid--5, .db-grid--4, .db-grid--3, .db-grid--2 { grid-template-columns: 1fr; }
    .db-moods { grid-template-columns: repeat(5, 1fr); gap: 5px; }
    .db-mood { padding: 10px 4px; font-size: 10px; }
    .db-mood__emoji { font-size: 18px; }
    .db-field__row { grid-template-columns: 1fr; }
    .db-page-head__actions { width: 100%; }
    .db-page-head__actions .db-btn { flex: 1; justify-content: center; }
    /* Turn wide tables into stacked cards on phones */
    .db-table thead { display: none; }
    .db-table, .db-table tbody, .db-table tr, .db-table td { display: block; width: 100%; }
    .db-table tr { border: 1px solid var(--db-border); border-radius: var(--db-radius); margin-bottom: 12px; padding: 6px 4px; }
    .db-table td { border: 0; padding: 8px 14px; }
    .db-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; color: var(--db-text-muted); margin-bottom: 3px; }
}

/* Utilities */
.db-hide-mobile { }
@media (max-width: 1024px) { .db-hide-mobile { display: none !important; } }
.db-only-mobile { display: none; }
@media (max-width: 1024px) { .db-only-mobile { display: block; } }
.db-flex { display: flex; align-items: center; gap: 10px; }
.db-flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.db-gap { gap: 10px; }
.db-wrap { flex-wrap: wrap; }
.db-muted { color: var(--db-text-muted); }
.db-soft { color: var(--db-text-soft); }
.db-fw { font-weight: 700; }
.db-right { margin-left: auto; }
.db-mt-sm { margin-top: 8px; }
.db-mt-md { margin-top: 16px; }

/* ---------- Icon size utilities ---------- */
.db-ic-sm { width:15px; height:15px; }
.db-ic-md { width:18px; height:18px; }
.db-ic-lg { width:22px; height:22px; }
.db-ic-xl { width:24px; height:24px; }
.db-ic-xxl { width:30px; height:30px; }

/* ---------- Width utilities (0-100%) for progress/storage bars ---------- */
.db-w-0 { width: 0%; }
.db-w-1 { width: 1%; }
.db-w-2 { width: 2%; }
.db-w-3 { width: 3%; }
.db-w-4 { width: 4%; }
.db-w-5 { width: 5%; }
.db-w-6 { width: 6%; }
.db-w-7 { width: 7%; }
.db-w-8 { width: 8%; }
.db-w-9 { width: 9%; }
.db-w-10 { width: 10%; }
.db-w-11 { width: 11%; }
.db-w-12 { width: 12%; }
.db-w-13 { width: 13%; }
.db-w-14 { width: 14%; }
.db-w-15 { width: 15%; }
.db-w-16 { width: 16%; }
.db-w-17 { width: 17%; }
.db-w-18 { width: 18%; }
.db-w-19 { width: 19%; }
.db-w-20 { width: 20%; }
.db-w-21 { width: 21%; }
.db-w-22 { width: 22%; }
.db-w-23 { width: 23%; }
.db-w-24 { width: 24%; }
.db-w-25 { width: 25%; }
.db-w-26 { width: 26%; }
.db-w-27 { width: 27%; }
.db-w-28 { width: 28%; }
.db-w-29 { width: 29%; }
.db-w-30 { width: 30%; }
.db-w-31 { width: 31%; }
.db-w-32 { width: 32%; }
.db-w-33 { width: 33%; }
.db-w-34 { width: 34%; }
.db-w-35 { width: 35%; }
.db-w-36 { width: 36%; }
.db-w-37 { width: 37%; }
.db-w-38 { width: 38%; }
.db-w-39 { width: 39%; }
.db-w-40 { width: 40%; }
.db-w-41 { width: 41%; }
.db-w-42 { width: 42%; }
.db-w-43 { width: 43%; }
.db-w-44 { width: 44%; }
.db-w-45 { width: 45%; }
.db-w-46 { width: 46%; }
.db-w-47 { width: 47%; }
.db-w-48 { width: 48%; }
.db-w-49 { width: 49%; }
.db-w-50 { width: 50%; }
.db-w-51 { width: 51%; }
.db-w-52 { width: 52%; }
.db-w-53 { width: 53%; }
.db-w-54 { width: 54%; }
.db-w-55 { width: 55%; }
.db-w-56 { width: 56%; }
.db-w-57 { width: 57%; }
.db-w-58 { width: 58%; }
.db-w-59 { width: 59%; }
.db-w-60 { width: 60%; }
.db-w-61 { width: 61%; }
.db-w-62 { width: 62%; }
.db-w-63 { width: 63%; }
.db-w-64 { width: 64%; }
.db-w-65 { width: 65%; }
.db-w-66 { width: 66%; }
.db-w-67 { width: 67%; }
.db-w-68 { width: 68%; }
.db-w-69 { width: 69%; }
.db-w-70 { width: 70%; }
.db-w-71 { width: 71%; }
.db-w-72 { width: 72%; }
.db-w-73 { width: 73%; }
.db-w-74 { width: 74%; }
.db-w-75 { width: 75%; }
.db-w-76 { width: 76%; }
.db-w-77 { width: 77%; }
.db-w-78 { width: 78%; }
.db-w-79 { width: 79%; }
.db-w-80 { width: 80%; }
.db-w-81 { width: 81%; }
.db-w-82 { width: 82%; }
.db-w-83 { width: 83%; }
.db-w-84 { width: 84%; }
.db-w-85 { width: 85%; }
.db-w-86 { width: 86%; }
.db-w-87 { width: 87%; }
.db-w-88 { width: 88%; }
.db-w-89 { width: 89%; }
.db-w-90 { width: 90%; }
.db-w-91 { width: 91%; }
.db-w-92 { width: 92%; }
.db-w-93 { width: 93%; }
.db-w-94 { width: 94%; }
.db-w-95 { width: 95%; }
.db-w-96 { width: 96%; }
.db-w-97 { width: 97%; }
.db-w-98 { width: 98%; }
.db-w-99 { width: 99%; }
.db-w-100 { width: 100%; }

/* ---------- Avatar placeholder ---------- */
.db-avatar-ph { display: grid; place-items: center; color: var(--db-primary); }
.db-search--mobile { flex: 1; }

/* ---------- Auth pages ---------- */
.db-auth-body { background: var(--db-bg); }
.db-auth { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.db-auth__brand { background: linear-gradient(150deg, var(--db-primary), #4c3fc0 90%); color: #fff; display: grid; place-items: center; padding: 40px; }
.db-auth__brand-inner { max-width: 360px; }
.db-auth__brand .db-brand__logo { width: 60px; height: 60px; border-radius: 16px; background: rgba(255,255,255,.15); margin-bottom: 22px; }
.db-auth__brand-title { font-size: 34px; font-weight: 800; color: #fff; }
.db-auth__brand-sub { margin-top: 10px; font-size: 16px; opacity: .9; }
.db-auth__points { list-style: none; padding: 0; margin: 30px 0 0; display: flex; flex-direction: column; gap: 14px; }
.db-auth__points li { display: flex; align-items: center; gap: 10px; opacity: .95; }
.db-auth__form { display: grid; place-items: center; padding: 40px 24px; }
.db-auth__card { width: 100%; max-width: 400px; }
.db-auth__title { font-size: 26px; font-weight: 800; }
.db-auth__subtitle { color: var(--db-text-soft); margin: 8px 0 24px; }
.db-auth__foot { text-align: center; margin-top: 20px; color: var(--db-text-soft); }
.db-auth__foot a { color: var(--db-primary); font-weight: 600; }
.db-auth__demo { text-align: center; margin-top: 12px; font-size: 12.5px; color: var(--db-text-muted); }

@media (max-width: 860px) {
    .db-auth { grid-template-columns: 1fr; }
    .db-auth__brand { display: none; }
}

/* ---------- Misc view helpers ---------- */
.db-card--narrow { max-width: 640px; }
.db-note-content { line-height: 1.8; color: var(--db-text-soft); white-space: pre-wrap; }
.db-note-content strong, .db-note-content h1, .db-note-content h2, .db-note-content h3 { color: var(--db-text); }
.db-strike { text-decoration: line-through; color: var(--db-text-muted); }
.db-listrow.is-selected { background: var(--db-primary-soft); border-radius: var(--db-radius-sm); }
.db-listrow.is-selected, .db-listrow.is-selected + .db-listrow { border-bottom-color: transparent; }

/* Week strip (journal) */
.db-weekstrip { display: flex; gap: 8px; justify-content: space-between; overflow-x: auto; }
.db-weekday { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 14px; border-radius: var(--db-radius-sm); border: 1px solid var(--db-border); min-width: 60px; }
.db-weekday.is-active { background: var(--db-primary); color: #fff; border-color: var(--db-primary); }
.db-weekday__dow { font-size: 11px; opacity: .8; }
.db-weekday__num { font-size: 17px; font-weight: 700; }

/* ---------- Graph node colours ---------- */
.db-node__circle { color: var(--db-primary); }
.db-node--violet { border-color: var(--db-violet); color: var(--db-violet); background: var(--db-violet-soft); }
.db-node--green { border-color: var(--db-green); color: var(--db-green); background: var(--db-green-soft); }
.db-node--orange { border-color: var(--db-orange); color: var(--db-orange); background: var(--db-orange-soft); }
.db-node--blue { border-color: var(--db-blue); color: var(--db-blue); background: var(--db-blue-soft); }
.db-node--red { border-color: var(--db-red); color: var(--db-red); background: var(--db-red-soft); }
.db-node--amber { border-color: var(--db-amber); color: var(--db-amber); background: var(--db-amber-soft); }

/* ---------- Learning hero ---------- */
.db-hero { background: linear-gradient(120deg, var(--db-primary-soft-2), var(--db-primary-soft)); border-color: transparent; }

/* ---------- Large avatar ---------- */
.db-avatar-lg { width: 64px; height: 64px; }

/* ---------- Pinned categories (dashboard) ---------- */
.db-pincat { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--db-border); border-radius: var(--db-radius-sm); background: var(--db-surface); }
.db-pincat:hover { border-color: var(--db-primary); background: var(--db-primary-soft-2); }
.db-pincat__ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.db-pincat__body { display: flex; flex-direction: column; min-width: 0; }
.db-pincat__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-pincat__count { font-size: 12px; color: var(--db-text-muted); }

/* ---------- Prevent list rows from overflowing their card ---------- */
.db-listrow { min-width: 0; }
.db-listrow .db-badge, .db-listrow__meta { flex-shrink: 0; }
.db-card, .db-stat, .db-itemcard, .db-pincat { max-width: 100%; overflow: hidden; }

/* ---------- Rendered markdown (note view) ---------- */
.db-markdown { color: var(--db-text-soft); line-height: 1.75; }
.db-markdown h1, .db-markdown h2, .db-markdown h3, .db-markdown h4 { color: var(--db-text); margin: 20px 0 10px; line-height: 1.3; }
.db-markdown h1 { font-size: 22px; }
.db-markdown h2 { font-size: 18px; }
.db-markdown h3 { font-size: 16px; }
.db-markdown p { margin: 10px 0; }
.db-markdown ul, .db-markdown ol { margin: 10px 0; padding-left: 22px; }
.db-markdown li { margin: 4px 0; }
.db-markdown a { color: var(--db-primary); font-weight: 600; }
.db-markdown blockquote { margin: 12px 0; padding: 8px 16px; border-left: 3px solid var(--db-primary); background: var(--db-surface-2); border-radius: 0 var(--db-radius-sm) var(--db-radius-sm) 0; }
.db-markdown code { background: var(--db-surface-2); border: 1px solid var(--db-border); border-radius: 6px; padding: 1px 6px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.db-markdown pre { background: #0f1626; border-radius: var(--db-radius-sm); padding: 16px 18px; overflow-x: auto; margin: 14px 0; }
.db-markdown pre code { background: transparent; border: 0; padding: 0; color: #d7def0; }
.db-markdown table { width: 100%; border-collapse: collapse; margin: 14px 0; }
.db-markdown th, .db-markdown td { border: 1px solid var(--db-border); padding: 8px 12px; text-align: left; }

/* ---------- Editor containers (EasyMDE + CodeMirror) ---------- */
.EasyMDEContainer .CodeMirror {
    border: 1px solid var(--db-border-strong);
    border-radius: 0 0 var(--db-radius-sm) var(--db-radius-sm);
    background: var(--db-surface);
    color: var(--db-text);
    font-family: var(--db-font);
}
.editor-toolbar {
    border: 1px solid var(--db-border-strong);
    border-bottom: 0;
    border-radius: var(--db-radius-sm) var(--db-radius-sm) 0 0;
    background: var(--db-surface-2);
}
.editor-toolbar button { color: var(--db-text-soft) !important; }
.editor-toolbar button.active, .editor-toolbar button:hover { background: var(--db-primary-soft); border-color: transparent; }
.editor-statusbar { color: var(--db-text-muted); }
.CodeMirror-scroll { min-height: 220px; }

/* Standalone CodeMirror (snippet code editor) */
.db-field .CodeMirror {
    border: 1px solid var(--db-border-strong);
    border-radius: var(--db-radius-sm);
    height: auto;
    min-height: 240px;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 13px;
}

/* highlight.js block should keep our rounded code look */
pre.db-code code.hljs { background: transparent; padding: 0; color: inherit; }

/* ---------- Images & Files ---------- */
.db-cols--files { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1024px) { .db-cols--files { grid-template-columns: 1fr; } }

.db-file { background: var(--db-surface); border: 1px solid var(--db-border); border-radius: var(--db-radius); box-shadow: var(--db-shadow); overflow: hidden; display: flex; flex-direction: column; }
.db-file__thumb { position: relative; height: 150px; flex: 0 0 150px; display: grid; place-items: center; gap: 6px; overflow: hidden; }
.db-file__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.db-file__ext { font-size: 11px; font-weight: 700; letter-spacing: .5px; }
.db-file__star { position: absolute; top: 8px; right: 8px; background: var(--db-surface); border-radius: 50%; padding: 3px; box-shadow: var(--db-shadow); display: grid; }
.db-file__body { padding: 12px 14px 6px; }
.db-file__name { display: block; font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--db-text); }
.db-file__name:hover { color: var(--db-primary); }
.db-file__thumb { cursor: pointer; }
.db-file__meta { font-size: 12px; color: var(--db-text-muted); margin-top: 3px; }
.db-file__actions { display: flex; align-items: center; gap: 4px; padding: 4px 10px 10px; }

/* ---------- Menu-style lists (folders, quick access) — clean pills, no dividers ---------- */
.db-list--menu .db-listrow { border-bottom: 0; padding: 9px 10px; border-radius: var(--db-radius-sm); }
.db-list--menu .db-listrow:hover { background: var(--db-surface-2); }
.db-list--menu .db-listrow.is-selected { background: var(--db-primary-soft); }
.db-list--menu .db-listrow.is-selected .db-listrow__title { color: var(--db-primary); }
.db-list--menu .db-listrow.is-selected .db-muted { color: var(--db-primary); }

/* ---------- Folder rows with rename/delete actions ---------- */
.db-folderrow { gap: 6px; }
.db-folderrow__link { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; color: inherit; }
.db-folderrow__count { font-size: 11px; flex-shrink: 0; }
.db-folderrow__act { opacity: 0; transition: opacity .15s; flex-shrink: 0; }
.db-folderrow:hover .db-folderrow__act { opacity: 1; }
.db-list--menu .db-folderrow.is-selected .db-folderrow__link .db-listrow__title { color: var(--db-primary); }
@media (max-width: 1024px) { .db-folderrow__act { opacity: 1; } }

/* ---------- Ticket thread ---------- */
.db-thread { display: flex; flex-direction: column; gap: 16px; }
.db-thread__item { display: flex; gap: 12px; }
.db-thread__bubble { flex: 1; min-width: 0; background: var(--db-surface-2); border: 1px solid var(--db-border); border-radius: 14px; padding: 12px 16px; }
.db-thread__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.db-thread__body { color: var(--db-text-soft); white-space: pre-wrap; line-height: 1.7; }

/* ==========================================================================
   ADMIN PANEL  (prefix db-adm / additions reuse the db- design system)
   ========================================================================== */

/* ---- Dark navy sidebar (admin) — stays dark in both themes ---- */
.db-sidebar--admin {
    --db-sidebar: #0f1524;
    background: #0f1524;
    border-right-color: #1c2438;
    color: #aab3c9;
}
.db-sidebar--admin .db-brand__name { color: #fff; }
.db-sidebar--admin .db-brand__sub { color: #7c86a0; }
.db-sidebar--admin .db-nav__title { color: #66708c; }
.db-sidebar--admin .db-nav__item { color: #9aa4bd; }
.db-sidebar--admin .db-nav__item:hover { background: rgba(255,255,255,.06); color: #fff; }
.db-sidebar--admin .db-nav__item.is-active { background: var(--db-primary); color: #fff; }
.db-sidebar--admin .db-nav__badge { color: #66708c; }
.db-sidebar--admin .db-nav__item--soon { opacity: .4; cursor: default; }
.db-sidebar--admin .db-nav__item--soon:hover { background: transparent; color: #9aa4bd; }

.db-adm-exit { margin: 4px 12px; color: #9aa4bd; }
.db-adm-foot {
    display: flex; align-items: center; gap: 10px;
    margin: 6px 14px 16px; padding: 12px;
    background: rgba(255,255,255,.05); border-radius: var(--db-radius);
}
.db-adm-foot__avatar { width: 36px; height: 36px; min-width: 36px; border-radius: 50%; object-fit: cover; background: rgba(255,255,255,.1); flex-shrink: 0; }
.db-adm-foot .db-avatar-ph { color: #cfd5e6; }
.db-adm-foot__main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.db-adm-foot__name { font-size: 13px; font-weight: 700; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-adm-foot__role { font-size: 11.5px; color: #7c86a0; }
.db-adm-foot__status { width: 9px; height: 9px; border-radius: 50%; background: var(--db-green); flex-shrink: 0; box-shadow: 0 0 0 3px rgba(34,181,115,.2); }

/* ---- Stat delta up / down ---- */
.db-stat__delta--down { color: var(--db-red); }
.db-stat__sub { font-size: 11.5px; color: var(--db-text-muted); }

/* ---- Section title row (card header with link) ---- */
.db-adm-section { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.db-adm-section__title { font-size: 17px; font-weight: 800; letter-spacing: -.2px; }

/* ---- System health list ---- */
.db-health { display: flex; flex-direction: column; }
.db-health__row { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--db-border); }
.db-health__row:last-child { border-bottom: 0; }
.db-health__icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.db-health__icon svg { width: 16px; height: 16px; }
.db-health__label { color: var(--db-text-soft); font-weight: 500; }
.db-health__value { margin-left: auto; font-weight: 700; font-size: 13px; }

/* ---- Line / area chart (server-rendered SVG) ---- */
.db-chart { width: 100%; }
.db-chart__svg { width: 100%; height: auto; display: block; overflow: visible; }
.db-chart__grid { stroke: var(--db-border); stroke-width: 1; }
.db-chart__axis { fill: var(--db-text-muted); font-size: 10px; }
.db-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.db-line--violet { stroke: var(--db-violet); }
.db-line--green { stroke: var(--db-green); }
.db-line--orange { stroke: var(--db-orange); }
.db-line--blue { stroke: var(--db-blue); }
.db-line--red { stroke: var(--db-red); }
.db-line--amber { stroke: var(--db-amber); }
.db-chart__legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.db-chart__legend .db-legend__row { flex: 0 0 auto; }

/* ---- Sparkline report tiles ---- */
.db-report { background: var(--db-surface); border: 1px solid var(--db-border); border-radius: var(--db-radius); padding: 16px; box-shadow: var(--db-shadow); display: flex; flex-direction: column; gap: 8px; }
.db-report__label { font-size: 12.5px; color: var(--db-text-soft); font-weight: 600; }
.db-report__value { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.db-report__spark { width: 100%; height: 40px; display: block; overflow: visible; }
.db-spark { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.db-spark--violet { stroke: var(--db-violet); }
.db-spark--green { stroke: var(--db-green); }
.db-spark--blue { stroke: var(--db-blue); }
.db-spark--orange { stroke: var(--db-orange); }
.db-spark--red { stroke: var(--db-red); }
.db-spark--amber { stroke: var(--db-amber); }
.db-sparkarea--violet { fill: var(--db-violet-soft); }
.db-sparkarea--green { fill: var(--db-green-soft); }
.db-sparkarea--blue { fill: var(--db-blue-soft); }
.db-sparkarea--orange { fill: var(--db-orange-soft); }
.db-sparkarea--red { fill: var(--db-red-soft); }
.db-sparkarea--amber { fill: var(--db-amber-soft); }

/* ---- Admin content columns: main + right rail (dashboard) ---- */
.db-adm-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
@media (max-width: 1024px) { .db-adm-cols { grid-template-columns: 1fr; } }
/* Equal-height columns: let the taller side set the row height and the
   shorter card's body fill it, so rows never leave big empty gaps. */
.db-adm-cols > .db-card { display: flex; flex-direction: column; }
.db-adm-cols > .db-card > .db-card__pad,
.db-adm-cols > .db-card > .db-table-wrap { flex: 1 1 auto; }
.db-adm-cols > .db-grid { align-content: stretch; }
.db-adm-cols .db-chart { height: 100%; display: flex; flex-direction: column; justify-content: center; }

/* ---- User cell (tables) ---- */
.db-usercell { display: flex; align-items: center; gap: 10px; }
.db-usercell__avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--db-primary-soft); display: grid; place-items: center; color: var(--db-primary); flex-shrink: 0; }
.db-usercell__name { font-weight: 600; }
.db-usercell__email { font-size: 12px; color: var(--db-text-muted); }

/* ---- Permission checkbox grid (roles) ---- */
.db-permgroup { border: 1px solid var(--db-border); border-radius: var(--db-radius-sm); padding: 14px 16px; margin-bottom: 14px; }
.db-permgroup__title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--db-text-muted); margin-bottom: 10px; }
.db-permgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }

/* ---- Plan cards (subscriptions) ---- */
.db-plan { border: 1px solid var(--db-border); border-radius: var(--db-radius); padding: 20px; background: var(--db-surface); box-shadow: var(--db-shadow); display: flex; flex-direction: column; gap: 12px; }
.db-plan__name { font-size: 16px; font-weight: 800; }
.db-plan__price { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.db-plan__price small { font-size: 13px; font-weight: 600; color: var(--db-text-muted); }
.db-plan__features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.db-plan__features li { display: flex; align-items: center; gap: 8px; color: var(--db-text-soft); font-size: 13px; }
.db-plan__features li svg { width: 15px; height: 15px; color: var(--db-green); flex-shrink: 0; }

@media (max-width: 640px) {
    .db-sidebar--admin { --db-sidebar-w: 246px; }
}

/* ---- Line chart hover tooltip ---- */
.db-chart { position: relative; }
.db-chart__hit { fill: transparent; cursor: crosshair; }
.db-chart__guide { stroke: var(--db-border-strong); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0; }
.db-chart__guide.is-on { opacity: 1; }
.db-chart__dot { opacity: 0; stroke: var(--db-surface); stroke-width: 2; }
.db-chart__dot.is-on { opacity: 1; }
.db-chart__tip {
    position: absolute; z-index: 6; pointer-events: none; opacity: 0; left: 0; top: 0;
    transform: translate(-50%, calc(-100% - 14px));
    background: var(--db-surface); border: 1px solid var(--db-border-strong);
    border-radius: var(--db-radius-sm); box-shadow: var(--db-shadow-lg);
    padding: 10px 12px; min-width: 150px; transition: opacity .1s;
}
.db-chart__tip.is-visible { opacity: 1; }
.db-chart__tip-title { font-weight: 700; font-size: 12.5px; margin-bottom: 7px; }
.db-chart__tip-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 2px 0; }
.db-chart__tip-name { color: var(--db-text-soft); }
.db-chart__tip-val { margin-left: auto; font-weight: 700; }

/* ---- Bar chart ---- */
.db-bar { transition: opacity .1s; }
.db-bar--violet { fill: var(--db-violet); }
.db-bar--green { fill: var(--db-green); }
.db-bar--amber { fill: var(--db-amber); }
.db-bar--blue { fill: var(--db-blue); }
.db-bar--red { fill: var(--db-red); }
.db-bar--orange { fill: var(--db-orange); }
.db-chart__barhi { fill: var(--db-primary); opacity: 0; }
.db-chart__barhi.is-on { opacity: .07; }

/* ---- Uploaded brand logo ---- */
.db-brand__logoimg { width: 38px; height: 38px; border-radius: 11px; object-fit: cover; flex-shrink: 0; background: var(--db-surface-2); }
.db-brand__logoimg--sm { width: 30px; height: 30px; border-radius: 9px; }
.db-settings-logo { max-height: 48px; width: auto; border-radius: var(--db-radius-sm); border: 1px solid var(--db-border); background: var(--db-surface-2); padding: 4px 8px; }
.db-settings-favicon { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--db-border); object-fit: contain; background: var(--db-surface-2); }

/* ---- Maintenance page ---- */
.db-maintenance { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; }
.db-maintenance__inner { max-width: 440px; text-align: center; }
.db-maintenance__inner .db-brand__logo { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 18px; }
.db-maintenance__title { font-size: 26px; font-weight: 800; margin-bottom: 10px; }
.db-maintenance__text { color: var(--db-text-soft); }

/* Staff (support) replies in a ticket thread */
.db-thread__item--staff .db-thread__bubble { background: var(--db-primary-soft-2); border-color: var(--db-primary-soft); }
.db-thread__item--staff .db-msg__avatar { background: var(--db-primary-soft); color: var(--db-primary); }

/* ---- Icon-button notification badge (topbar bell) ---- */
.db-iconbtn { position: relative; }
.db-iconbtn__badge {
    position: absolute; top: 4px; right: 4px;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 8px; background: var(--db-red); color: #fff;
    font-size: 10px; font-weight: 700; line-height: 1;
    display: grid; place-items: center;
}

/* ---- Masonry card layout (admin settings) ----
   Cards keep their natural height and pack tightly into columns, so a short
   card never stretches to fill dead space and no gaps open between cards. */
.db-masonry { columns: 2; column-gap: 18px; }
.db-masonry > .db-card { break-inside: avoid; -webkit-column-break-inside: avoid; width: 100%; margin: 0 0 18px; }
@media (max-width: 1024px) { .db-masonry { columns: 1; } }

/* ---- Styled file inputs (match the design system) ---- */
input[type="file"].db-input { padding: 7px 10px; line-height: 1.5; cursor: pointer; }
input[type="file"].db-input::file-selector-button {
    margin-right: 12px; padding: 7px 14px;
    border-radius: var(--db-radius-sm); border: 1px solid var(--db-border-strong);
    background: var(--db-surface-2); color: var(--db-text);
    font-family: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
input[type="file"].db-input::file-selector-button:hover {
    background: var(--db-primary-soft); border-color: var(--db-primary); color: var(--db-primary);
}
input[type="file"].db-input::-webkit-file-upload-button {
    margin-right: 12px; padding: 7px 14px;
    border-radius: var(--db-radius-sm); border: 1px solid var(--db-border-strong);
    background: var(--db-surface-2); color: var(--db-text);
    font-family: inherit; font-weight: 600; font-size: 13px; cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
input[type="file"].db-input::-webkit-file-upload-button:hover {
    background: var(--db-primary-soft); border-color: var(--db-primary); color: var(--db-primary);
}

/* ---- Header user dropdown ---- */
.db-dropdown { position: relative; }
button.db-user { background: transparent; border: 0; font: inherit; color: inherit; }
.db-dropdown__menu {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; z-index: 60;
    background: var(--db-surface); border: 1px solid var(--db-border);
    border-radius: var(--db-radius); box-shadow: var(--db-shadow-lg);
    padding: 6px; opacity: 0; visibility: hidden; transform: translateY(-4px);
    transition: opacity .12s, transform .12s, visibility .12s;
}
.db-dropdown.is-open .db-dropdown__menu { opacity: 1; visibility: visible; transform: translateY(0); }
.db-dropdown__item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 12px; border-radius: var(--db-radius-sm);
    color: var(--db-text); font-size: 13.5px; font-weight: 500;
    background: transparent; border: 0; text-align: left; cursor: pointer;
}
.db-dropdown__item:hover { background: var(--db-surface-2); }
.db-dropdown__item svg { width: 16px; height: 16px; color: var(--db-text-muted); }
.db-dropdown__divider { height: 1px; background: var(--db-border); margin: 6px 4px; }

/* ---- Stat-card grids stay 2-up on phones (dashboard, analytics, reports) ---- */
@media (max-width: 640px) {
    .db-grid.db-grid--stat2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

/* ---- Title count chip + stat card subtitle ---- */
.db-count-chip {
    display: inline-block; vertical-align: middle; margin-left: 8px;
    padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700;
    background: var(--db-primary-soft); color: var(--db-primary);
}
.db-stat__note { font-size: 12.5px; color: var(--db-text-muted); font-weight: 500; }

/* ---- Admin user list (card rows, demo-style) ---- */
.db-ulist { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.db-ucard {
    display: flex; align-items: center; gap: 14px;
    background: var(--db-surface); border: 1px solid var(--db-border);
    border-radius: var(--db-radius); padding: 14px 16px; box-shadow: var(--db-shadow);
    transition: border-color .15s, box-shadow .15s;
}
.db-ucard:hover { border-color: var(--db-primary); box-shadow: var(--db-shadow-lg); }
.db-ucard__avatar {
    width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center; overflow: hidden;
    background: var(--db-surface-2); color: var(--db-text-muted);
}
.db-ucard__avatar img { width: 100%; height: 100%; object-fit: cover; }
.db-ucard__avatar svg { width: 26px; height: 26px; }
.db-ucard__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: inherit; }
.db-ucard__name { font-weight: 700; color: var(--db-text); font-size: 15px; }
.db-ucard__email { font-size: 13px; color: var(--db-text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-ucard__joined { font-size: 12.5px; color: var(--db-text-muted); }
.db-ucard__meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

/* Status shown as coloured dot + label (not a filled badge) */
.db-statuspill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.db-statuspill--green { color: var(--db-green); }
.db-statuspill--amber { color: var(--db-amber); }
.db-statuspill--blue { color: var(--db-blue); }
.db-statuspill--red { color: var(--db-red); }
.db-statuspill--violet { color: var(--db-violet); }

.db-dropdown__item--danger, .db-dropdown__item--danger svg { color: var(--db-red); }

/* ---- Admin role list (card rows, demo-style) ---- */
.db-rolecard {
    display: flex; align-items: center; gap: 14px;
    background: var(--db-surface); border: 1px solid var(--db-border);
    border-radius: var(--db-radius); padding: 16px; box-shadow: var(--db-shadow);
    color: inherit; transition: border-color .15s, box-shadow .15s;
}
.db-rolecard:hover { border-color: var(--db-primary); box-shadow: var(--db-shadow-lg); }
.db-rolecard__icon { width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0; display: grid; place-items: center; }
.db-rolecard__icon svg { width: 26px; height: 26px; }
.db-rolecard__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.db-rolecard__name { font-weight: 700; color: var(--db-text); font-size: 15px; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.db-rolecard__desc { font-size: 13px; color: var(--db-text-soft); }
.db-rolecard__users { font-size: 12.5px; color: var(--db-text-muted); display: inline-flex; align-items: center; gap: 6px; }
.db-rolecard__perms { flex-shrink: 0; display: flex; flex-direction: column; gap: 2px; text-align: right; }
.db-rolecard__permcount { font-weight: 700; font-size: 14px; color: var(--db-text); }
.db-rolecard__permlabel { font-size: 12px; color: var(--db-text-muted); }
.db-rolecard__end { flex-shrink: 0; display: inline-flex; align-items: center; gap: 10px; }

@media (max-width: 560px) {
    .db-ucard { flex-wrap: wrap; }
    .db-ucard__main { flex: 1 1 calc(100% - 66px); }
    .db-ucard__meta { flex-basis: 100%; justify-content: flex-start; padding-left: 66px; }

    .db-rolecard { flex-wrap: wrap; }
    .db-rolecard__main { flex: 1 1 calc(100% - 66px); }
    .db-rolecard__perms { order: 3; text-align: left; padding-left: 66px; }
    .db-rolecard__end { order: 4; margin-left: auto; }
}

/* ---- Admin subscription list (card rows, demo-style) ---- */
.db-subcard {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: var(--db-surface); border: 1px solid var(--db-border);
    border-radius: var(--db-radius); padding: 16px; box-shadow: var(--db-shadow);
    transition: border-color .15s, box-shadow .15s;
}
.db-subcard:hover { border-color: var(--db-primary); box-shadow: var(--db-shadow-lg); }
.db-subavatar {
    width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
    display: grid; place-items: center; overflow: hidden;
    font-weight: 700; font-size: 18px;
}
.db-subavatar img { width: 100%; height: 100%; object-fit: cover; }
.db-subcard__id { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: inherit; }
.db-subcard__name { font-weight: 700; color: var(--db-text); font-size: 15px; }
.db-subcard__email { font-size: 13px; color: var(--db-text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-subcard__code { font-size: 12px; color: var(--db-text-muted); }
.db-subcard__plan { flex: 0 0 auto; display: flex; flex-direction: column; gap: 2px; min-width: 110px; }
.db-subcard__planname { font-weight: 600; color: var(--db-text); font-size: 13.5px; }
.db-subcard__price { color: var(--db-primary); font-weight: 700; font-size: 15px; }
.db-subcard__price small { font-weight: 500; color: var(--db-text-muted); }
.db-subcard__status { flex: 0 0 auto; display: flex; flex-direction: column; gap: 3px; min-width: 130px; }
.db-subcard__billlabel { font-size: 12px; color: var(--db-text-muted); }
.db-subcard__billdate { font-size: 13px; color: var(--db-text); font-weight: 500; }
.db-subcard__menu { flex: 0 0 auto; }

@media (max-width: 767px) {
    .db-subavatar { order: 0; }
    .db-subcard__id { order: 1; flex: 1 1 calc(100% - 130px); }
    .db-subcard__menu { order: 2; }
    .db-subcard__plan { order: 3; flex: 1 1 45%; padding-left: 66px; }
    .db-subcard__status { order: 4; flex: 1 1 40%; align-items: flex-end; text-align: right; min-width: 0; }
}

/* ---- Admin payment list (card rows, demo-style) ---- */
.db-paycard {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: var(--db-surface); border: 1px solid var(--db-border);
    border-radius: var(--db-radius); padding: 16px; box-shadow: var(--db-shadow);
    transition: border-color .15s, box-shadow .15s;
}
.db-paycard:hover { border-color: var(--db-primary); box-shadow: var(--db-shadow-lg); }
.db-paycard__id { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.db-paycard__name { font-weight: 700; color: var(--db-text); font-size: 15px; }
.db-paycard__email { font-size: 13px; color: var(--db-text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-paycard__meta { font-size: 12px; color: var(--db-text-muted); }
.db-dot-sep { color: var(--db-text-muted); margin: 0 2px; }
.db-paycard__amount { flex: 0 0 auto; display: flex; flex-direction: column; gap: 2px; min-width: 110px; }
.db-paycard__value { font-weight: 700; color: var(--db-text); font-size: 16px; }
.db-paycard__date { font-size: 12.5px; color: var(--db-text-soft); }
.db-paycard__time { font-size: 12px; color: var(--db-text-muted); }
.db-paycard__status { flex: 0 0 auto; display: flex; flex-direction: column; gap: 3px; min-width: 130px; }
.db-paycard__gateway { font-size: 12.5px; color: var(--db-text); font-weight: 600; }
.db-paycard__inv { font-size: 12px; color: var(--db-text-muted); }
.db-paycard__menu { flex: 0 0 auto; }

@media (max-width: 767px) {
    .db-paycard__id { order: 1; flex: 1 1 calc(100% - 130px); }
    .db-paycard__menu { order: 2; }
    .db-paycard__amount { order: 3; flex: 1 1 45%; padding-left: 66px; }
    .db-paycard__status { order: 4; flex: 1 1 40%; align-items: flex-end; text-align: right; min-width: 0; }
}

/* ---- Admin announcement list (card rows, demo-style) ---- */
.db-anncard {
    display: flex; align-items: flex-start; gap: 14px;
    background: var(--db-surface); border: 1px solid var(--db-border);
    border-radius: var(--db-radius); padding: 16px; box-shadow: var(--db-shadow);
    transition: border-color .15s, box-shadow .15s;
}
.db-anncard:hover { border-color: var(--db-primary); box-shadow: var(--db-shadow-lg); }
.db-anncard__icon { width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0; display: grid; place-items: center; }
.db-anncard__icon svg { width: 24px; height: 24px; }
.db-anncard__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; color: inherit; }
.db-anncard__title { font-weight: 700; color: var(--db-text); font-size: 15px; }
.db-anncard__body { font-size: 13px; color: var(--db-text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-anncard__date { font-size: 12.5px; color: var(--db-text-muted); display: inline-flex; align-items: center; gap: 6px; }
.db-anncard__date svg { width: 14px; height: 14px; }
.db-anncard__meta { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.db-anncard__audience { font-size: 12.5px; color: var(--db-text-muted); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.db-anncard__audience svg { width: 14px; height: 14px; }
.db-anncard__menu { flex-shrink: 0; }

@media (max-width: 560px) {
    .db-anncard { flex-wrap: wrap; align-items: center; }
    .db-anncard__icon { order: 0; }
    .db-anncard__main { order: 1; flex: 1 1 calc(100% - 120px); }
    .db-anncard__menu { order: 2; }
    .db-anncard__meta { order: 3; flex-direction: row; align-items: center; flex-basis: 100%; padding-left: 62px; justify-content: flex-start; gap: 12px; }
}

/* ---- Downloadable report rows (Recent Reports) ---- */
.db-filerow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--db-border); }
.db-filerow:last-child { border-bottom: 0; }
.db-filerow__tag { width: 40px; height: 44px; border-radius: 10px; display: grid; place-items: center; font-size: 10px; font-weight: 800; letter-spacing: .5px; flex-shrink: 0; }
.db-filerow__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.db-filerow__name { font-weight: 600; color: var(--db-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-filerow__sub { font-size: 12.5px; color: var(--db-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-filerow__when { font-size: 12.5px; color: var(--db-text-soft); flex-shrink: 0; white-space: nowrap; }
.db-filerow__dl { flex-shrink: 0; }

@media (max-width: 480px) {
    .db-filerow__when { display: none; }
}

/* ---- Admin activity log (card rows, demo-style) ---- */
.db-actrow {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: var(--db-surface); border: 1px solid var(--db-border);
    border-radius: var(--db-radius); padding: 14px 16px; box-shadow: var(--db-shadow);
    transition: border-color .15s, box-shadow .15s;
}
.db-actrow:hover { border-color: var(--db-primary); box-shadow: var(--db-shadow-lg); }
.db-actrow__avatar {
    width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
    display: grid; place-items: center; overflow: hidden;
}
.db-actrow__avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.db-actrow__avatar svg { width: 22px; height: 22px; }
.db-actrow__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.db-actrow__title { font-weight: 700; color: var(--db-text); font-size: 14.5px; display: inline-flex; align-items: center; gap: 8px; }
.db-actrow__detail { font-size: 13px; color: var(--db-text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-actrow__when { flex: 0 0 auto; display: flex; flex-direction: column; gap: 1px; text-align: right; }
.db-actrow__date { font-size: 12.5px; color: var(--db-text); font-weight: 500; }
.db-actrow__time { font-size: 12px; color: var(--db-text-soft); }
.db-actrow__ip { font-size: 11.5px; color: var(--db-text-muted); }
.db-actrow__menu { flex: 0 0 auto; }

@media (max-width: 560px) {
    .db-actrow__main { order: 1; flex: 1 1 calc(100% - 120px); }
    .db-actrow__menu { order: 2; }
    .db-actrow__when { order: 3; flex-basis: 100%; flex-direction: row; align-items: center; gap: 10px; text-align: left; padding-left: 62px; }
}

/* ---- Social login + 2FA + inline code ---- */
.db-auth__or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--db-text-muted); font-size: 12.5px; }
.db-auth__or::before, .db-auth__or::after { content: ""; flex: 1; height: 1px; background: var(--db-border); }
.db-auth__social { display: flex; flex-direction: column; gap: 10px; }
.db-social { border: 1px solid var(--db-border-strong); background: var(--db-surface); color: var(--db-text); }
.db-social:hover { background: var(--db-surface-2); }
.db-social svg { width: 18px; height: 18px; }
.db-input--code { text-align: center; letter-spacing: 8px; font-size: 22px; font-weight: 700; }
.db-hr { height: 1px; background: var(--db-border); margin: 18px 0; }
.db-code--inline { display: inline-block; padding: 6px 10px; font-size: 12.5px; background: var(--db-surface-2); color: var(--db-text); border: 1px solid var(--db-border); border-radius: var(--db-radius-sm); word-break: break-all; }

/* ---- File preview lightbox ---- */
.db-file__thumb { border: 0; width: 100%; padding: 0; font: inherit; }
button.db-file__name { background: transparent; border: 0; padding: 0; text-align: left; width: 100%; cursor: pointer; font: inherit; }
.db-lightbox { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 22, 38, .7); }
.db-lightbox[hidden] { display: none; }
.db-lightbox__panel { background: var(--db-surface); border-radius: var(--db-radius); box-shadow: var(--db-shadow-lg); width: 100%; max-width: 920px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.db-lightbox__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--db-border); }
.db-lightbox__name { font-weight: 700; color: var(--db-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-lightbox__acts { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.db-lightbox__body { flex: 1 1 auto; min-height: 0; overflow: auto; display: grid; place-items: center; background: var(--db-surface-2); padding: 12px; }
.db-lightbox__img { max-width: 100%; max-height: 78vh; object-fit: contain; border-radius: var(--db-radius-sm); }
.db-lightbox__frame { width: 100%; height: 78vh; border: 0; border-radius: var(--db-radius-sm); background: #fff; }
.db-lightbox__ph { padding: 48px 20px; text-align: center; color: var(--db-text-muted); }

/* ---- Admin scheduler / cron steps ---- */
.db-steps { margin: 6px 0 10px 20px; color: var(--db-text-soft); line-height: 1.85; }
.db-steps li { margin: 2px 0; }

/* ---- Reminders ---- */
.db-stat.is-selected { border-color: var(--db-primary); box-shadow: 0 0 0 1px var(--db-primary) inset; }
.db-remtools { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.db-remtools__right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.db-remlist { display: flex; flex-direction: column; }
.db-remrow { display: flex; align-items: center; gap: 14px; padding: 14px 2px; border-bottom: 1px solid var(--db-border); }
.db-remrow:last-child { border-bottom: 0; }
.db-remrow__icon { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center; }
.db-remrow__icon svg { width: 22px; height: 22px; }
.db-remrow__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: inherit; }
.db-remrow__title { font-weight: 700; color: var(--db-text); font-size: 14.5px; }
.db-remrow__desc { font-size: 13px; color: var(--db-text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-remrow__due { flex: 0 0 130px; display: flex; flex-direction: column; gap: 2px; }
.db-remrow__duelabel { font-weight: 600; font-size: 13.5px; color: var(--db-text); }
.db-remrow__duelabel--red { color: var(--db-red); }
.db-remrow__duelabel--amber { color: var(--db-amber); }
.db-remrow__time { font-size: 12.5px; color: var(--db-text-muted); }
.db-remrow__cat { flex: 0 0 150px; }
.db-remrow__acts { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 2px; }
.db-remrow.is-done .db-remrow__title { text-decoration: line-through; color: var(--db-text-muted); }

@media (max-width: 767px) {
    .db-remrow { flex-wrap: wrap; }
    .db-remrow__main { flex: 1 1 calc(100% - 60px); }
    .db-remrow__due { order: 3; flex: 1 1 auto; min-width: 0; padding-left: 58px; }
    .db-remrow__cat { order: 4; flex: 0 0 auto; align-self: center; }
    .db-remrow__acts { order: 5; margin-left: auto; }
}

/* ---- Settings: avatar picker + round cropper + password eye ---- */
.db-avatarpick { display: flex; align-items: center; gap: 16px; }
.db-avatarpick__preview { width: 72px; height: 72px; border-radius: 50%; overflow: hidden; flex-shrink: 0; display: grid; place-items: center; background: var(--db-surface-2); color: var(--db-text-muted); }
.db-avatarpick__preview img { width: 100%; height: 100%; object-fit: cover; }
.db-avatarpick__preview svg { width: 32px; height: 32px; }
.db-avatarpick__body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.db-inputwrap { position: relative; }
.db-inputwrap .db-input { padding-right: 42px; }
.db-inputwrap__eye { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); background: transparent; border: 0; cursor: pointer; color: var(--db-text-muted); display: grid; place-items: center; padding: 6px; }
.db-inputwrap__eye:hover, .db-inputwrap__eye.is-on { color: var(--db-primary); }

.db-cropper { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15, 22, 38, .55); }
.db-cropper[hidden] { display: none; }
.db-cropper__panel { background: var(--db-surface); border-radius: var(--db-radius); box-shadow: var(--db-shadow-lg); padding: 20px; width: 100%; max-width: 340px; }
.db-cropper__title { font-weight: 700; font-size: 16px; margin-bottom: 16px; text-align: center; color: var(--db-text); }
.db-cropper__stage { position: relative; width: 260px; height: 260px; margin: 0 auto; border-radius: 50%; overflow: hidden; background: var(--db-surface-2); cursor: grab; touch-action: none; box-shadow: 0 0 0 2px var(--db-border) inset; }
.db-cropper__stage:active { cursor: grabbing; }
.db-cropper__stage img { position: absolute; top: 0; left: 0; max-width: none; user-select: none; -webkit-user-drag: none; }
.db-cropper__zoomrow { display: flex; align-items: center; gap: 10px; margin: 18px 0; }
.db-cropper__zoom { flex: 1; }
.db-cropper__actions { display: flex; gap: 10px; }
.db-cropper__actions .db-btn { flex: 1; justify-content: center; }

body.db-noscroll { overflow: hidden; }

/* ---- Learning Hub: mobile-only demo layout (desktop unchanged) ---- */
.db-topiccard__body { display: flex; flex-direction: column; }
.db-topiccard__chev { display: none; }
@media (max-width: 640px) {
    /* Compact 4-up stat cards (shared with other pages via .db-statscompact) */
    .db-statscompact .db-stat { padding: 10px 4px; align-items: center; text-align: center; gap: 6px; }
    .db-statscompact .db-stat__top { flex-direction: column; gap: 5px; }
    .db-statscompact .db-stat__icon { width: 34px; height: 34px; }
    .db-statscompact .db-stat__icon svg { width: 18px; height: 18px; }
    .db-statscompact .db-stat__label { font-size: 10px; line-height: 1.2; }
    .db-statscompact .db-stat__value { font-size: 20px; }
    .db-learnstats, .db-tagstats, .db-remstats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }

    /* Popular Topics: horizontal swipe */
    .db-topicscroll { display: flex; grid-template-columns: none; overflow-x: auto; gap: 12px; padding-bottom: 4px; scroll-snap-type: x mandatory; }
    .db-topicscroll .db-topiccard { flex: 0 0 74%; flex-direction: row; align-items: center; gap: 12px; scroll-snap-align: start; }
    .db-topiccard__body { flex: 1 1 auto; min-width: 0; }
    .db-topiccard__chev { display: block; flex-shrink: 0; }
}

/* ---- Tasks & Goals: badges wrap on mobile (desktop unchanged) ---- */
.db-taskrow__tags { display: contents; }
@media (max-width: 640px) {
    /* 5 compact centred stat cards */
    .db-taskstats { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
    .db-taskstats .db-stat { padding: 10px 4px; align-items: center; text-align: center; gap: 6px; }
    .db-taskstats .db-stat__top { flex-direction: column; gap: 5px; }
    .db-taskstats .db-stat__icon { width: 34px; height: 34px; }
    .db-taskstats .db-stat__icon svg { width: 18px; height: 18px; }
    .db-taskstats .db-stat__label { font-size: 10px; line-height: 1.2; }
    .db-taskstats .db-stat__value { font-size: 20px; }

    /* Task rows: toggle + title + delete on row 1, badges wrap to row 2 */
    .db-taskrow { flex-wrap: wrap; }
    .db-taskrow > form { flex: 0 0 auto; }
    .db-taskrow .db-listrow__main { flex: 1 1 0; min-width: 0; }
    .db-taskrow__tags { display: flex; order: 3; flex-basis: 100%; padding-left: 42px; gap: 8px; flex-wrap: wrap; }
}

/* ---- Daily Journal: mobile-only demo extras (desktop unchanged) ---- */
.db-streakbar { justify-content: flex-start; gap: 10px; }
.db-streakbar__chev { margin-left: auto; }
.db-fieldcount { position: relative; }
.db-fieldcount .db-count { position: absolute; bottom: 10px; right: 14px; font-size: 12px; color: var(--db-text-muted); pointer-events: none; }
@media (max-width: 640px) {
    .db-btn--block-mobile { display: flex; width: 100%; }
}

/* ---- Trash: keep the table horizontal on mobile (desktop unchanged) ---- */
.db-trashnote { align-items: center; gap: 8px; color: var(--db-text-muted); font-size: 13px; margin-top: 12px; }
.db-trashnote svg { width: 15px; height: 15px; }
@media (max-width: 1024px) { .db-trashnote { display: inline-flex; } }
@media (max-width: 640px) {
    .db-table--flat { display: table; }
    .db-table--flat thead { display: table-header-group; }
    .db-table--flat tbody { display: table-row-group; }
    .db-table--flat tr { display: table-row; width: auto; border: 0; border-bottom: 1px solid var(--db-border); border-radius: 0; margin: 0; padding: 0; }
    .db-table--flat tr:last-child { border-bottom: 0; }
    .db-table--flat th { display: table-cell; padding: 9px 5px; font-size: 10.5px; }
    .db-table--flat td { display: table-cell; width: auto; border: 0; padding: 10px 5px; font-size: 12px; }
    .db-table--flat td[data-label]::before { content: none; }
    .db-table--flat .db-titlecell { gap: 8px; }
    .db-table--flat .db-titlecell__icon { width: 32px; height: 32px; }
    .db-table--flat .db-rowactions { gap: 2px; }
    .db-table--flat .db-badge { padding: 3px 7px; font-size: 10.5px; }
}

/* ---- Tickets: mobile-only card list (desktop keeps the table) ---- */
.db-tklist { display: flex; flex-direction: column; }
.db-tkrow { display: flex; gap: 12px; padding: 14px 2px; border-bottom: 1px solid var(--db-border); }
.db-tkrow:last-child { border-bottom: 0; }
.db-tkrow__icon { width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center; }
.db-tkrow__icon svg { width: 20px; height: 20px; }
.db-tkrow__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; color: inherit; }
.db-tkrow__subject { font-weight: 700; color: var(--db-text); font-size: 14.5px; line-height: 1.3; }
.db-tkrow__ref { font-size: 12.5px; color: var(--db-text-muted); }
.db-tkrow__replies { font-size: 12.5px; color: var(--db-text-soft); display: inline-flex; align-items: center; gap: 6px; }
.db-tkrow__replies svg { width: 14px; height: 14px; }
.db-tkrow__side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.db-tkrow__top { display: inline-flex; align-items: center; gap: 8px; }
.db-tkrow__chev { color: var(--db-text-muted); display: grid; place-items: center; }
.db-tkrow__bottom { display: inline-flex; align-items: center; gap: 6px; }
.db-tkrow__time { font-size: 12px; color: var(--db-text-muted); white-space: nowrap; }

/* ---- Bookmarks: mobile-only card list (desktop keeps the table) ---- */
.db-bmlist { display: flex; flex-direction: column; }
.db-bmrow { display: flex; gap: 12px; padding: 14px 2px; border-bottom: 1px solid var(--db-border); }
.db-bmrow:last-child { border-bottom: 0; }
.db-bmrow__icon { width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center; }
.db-bmrow__icon svg { width: 20px; height: 20px; }
.db-bmrow__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.db-bmrow__title { font-weight: 700; color: var(--db-text); font-size: 14.5px; line-height: 1.3; }
.db-bmrow__url { font-size: 12.5px; color: var(--db-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-bmrow__badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.db-bmrow__side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.db-bmrow__date { font-size: 12px; color: var(--db-text-muted); white-space: nowrap; }
.db-bmrow__acts { display: inline-flex; align-items: center; gap: 2px; }

/* ---- Images & Files: mobile-only demo layout (desktop unchanged, ≤640px) ---- */
@media (max-width: 640px) {
    /* Stat cards 2-up, storage card full-width with a ring */
    .db-filestats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .db-filestats .db-storagecard { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 16px; }
    .db-storagecard__text { flex: 1 1 auto; min-width: 0; }
    .db-storagecard__ring { flex: 0 0 auto; }
    .db-donut--xs { width: 84px; height: 84px; }
    .db-donut--xs .db-donut__hole { inset: 12px; }
    .db-donut--xs .db-donut__value { font-size: 15px; }

    /* My Folders as a 2-up tile grid, actions hidden */
    .db-foldergrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .db-foldergrid .db-listrow, .db-foldergrid .db-folderrow {
        border: 1px solid var(--db-border); border-radius: var(--db-radius-sm); padding: 12px; margin: 0;
    }
    .db-foldergrid .db-folderrow__act { display: none; }

    /* File cards 2-up */
    .db-filegrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

/* ---- Code snippet rows: mobile-only demo extras (desktop unchanged) ---- */
.db-snip-badge { margin-top: 4px; }
.db-snip-end { display: none; }
@media (max-width: 1024px) {
    .db-snip-end { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }
    .db-snip-end__time { font-size: 12px; color: var(--db-text-muted); white-space: nowrap; }
    .db-snip-end .db-muted { color: var(--db-text-muted); display: grid; place-items: center; }
    .db-snipfoot { text-align: center; padding: 14px 0 4px; }
    .db-snipfoot__q { color: var(--db-text-soft); font-size: 13.5px; }
    .db-snipfoot__cta { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--db-primary); font-weight: 700; font-size: 14px; }
}

/* ---- AI conversation list rows ---- */
.db-convlist2 { display: flex; flex-direction: column; }
.db-convrow { display: flex; align-items: center; gap: 10px; padding: 11px 8px; border-bottom: 1px solid var(--db-border); border-radius: var(--db-radius-sm); }
.db-convrow:last-child { border-bottom: 0; }
.db-convrow.is-active { background: var(--db-primary-soft); border-bottom-color: transparent; }
.db-convrow__link { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: 0; color: inherit; }
.db-convrow__icon { width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center; }
.db-convrow__icon svg { width: 20px; height: 20px; }
.db-convrow__main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.db-convrow__title { font-weight: 700; color: var(--db-text); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-convrow__preview { font-size: 12.5px; color: var(--db-text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-convrow__time { font-size: 12px; color: var(--db-text-muted); white-space: nowrap; flex-shrink: 0; }
.db-convrow__fav, .db-convrow__chev { flex-shrink: 0; }
.db-convrow__chev { color: var(--db-text-muted); display: grid; place-items: center; }
.db-convmore { border-top: 1px solid var(--db-border); }
.db-convmore > summary { list-style: none; cursor: pointer; text-align: center; padding: 12px; color: var(--db-primary); font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 6px; justify-content: center; }
.db-convmore > summary::-webkit-details-marker { display: none; }
.db-convmore__chev { transition: transform .18s; }
.db-convmore[open] > summary .db-convmore__chev { transform: rotate(180deg); }

/* ---- Note cards (All Notes) ---- */
.db-notelist { display: flex; flex-direction: column; gap: 12px; }
.db-notecard {
    display: flex; gap: 14px; padding: 16px;
    background: var(--db-surface); border: 1px solid var(--db-border);
    border-radius: var(--db-radius); box-shadow: var(--db-shadow);
    transition: border-color .15s, box-shadow .15s;
}
.db-notecard:hover { border-color: var(--db-primary); box-shadow: var(--db-shadow-lg); }
.db-notecard__icon { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center; }
.db-notecard__icon svg { width: 22px; height: 22px; }
.db-notecard__body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.db-notecard__head { display: flex; flex-direction: column; gap: 4px; color: inherit; min-width: 0; }
.db-notecard__title { font-weight: 700; color: var(--db-text); font-size: 15px; line-height: 1.35; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.db-notecard__title svg { flex-shrink: 0; }
.db-notecard__excerpt { font-size: 13px; color: var(--db-text-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.db-notecard__shared { font-size: 12.5px; color: var(--db-text-soft); display: inline-flex; align-items: center; gap: 6px; }
.db-notecard__shared svg { width: 14px; height: 14px; }
.db-notecard__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.db-notecard__side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.db-notecard__srow { display: inline-flex; align-items: center; gap: 8px; }
.db-notecard__time { font-size: 12.5px; color: var(--db-text-muted); white-space: nowrap; }

/* ---- User dashboard: greeting banner + quick access + goal ring ---- */
.db-greet {
    background: linear-gradient(120deg, var(--db-primary-soft-2), var(--db-primary-soft));
    border: 1px solid var(--db-border); border-radius: var(--db-radius);
    padding: 22px 24px; box-shadow: var(--db-shadow);
}
.db-greet__title { font-size: 22px; font-weight: 800; letter-spacing: -.4px; color: var(--db-text); }
.db-greet__quote { margin-top: 6px; color: var(--db-text-soft); font-size: 14px; }

.db-qagrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 360px) { .db-qagrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.db-goalwrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.db-goalwrap__list { flex: 1 1 190px; min-width: 0; }
.db-goalwrap__ring { flex: 0 0 auto; margin: 0 auto; }
.db-donut--sm { width: 118px; height: 118px; }
.db-donut--sm .db-donut__hole { inset: 19px; }
.db-donut--sm .db-donut__value { font-size: 17px; }
.db-strike { text-decoration: line-through; color: var(--db-text-muted); }

/* Flat variant — activity rows inside another card (dashboard) */
.db-actlist { display: flex; flex-direction: column; }
.db-actrow--flat { background: transparent; border: 0; border-radius: 0; box-shadow: none; border-bottom: 1px solid var(--db-border); padding: 13px 0; }
.db-actrow--flat:last-child { border-bottom: 0; }
.db-actrow--flat:hover { box-shadow: none; border-color: transparent; border-bottom-color: var(--db-border); }

/* ---- Settings hub (quick tiles + accordion + backup) ---- */
.db-quickgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.db-quicktile {
    display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
    padding: 14px 8px; border: 1px solid var(--db-border); border-radius: var(--db-radius-sm);
    background: var(--db-surface); color: inherit; transition: border-color .15s, background .15s;
}
.db-quicktile:hover { border-color: var(--db-primary); background: var(--db-primary-soft-2); }
.db-quicktile__ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; }
.db-quicktile__ic svg { width: 20px; height: 20px; }
.db-quicktile__name { font-weight: 600; font-size: 13px; color: var(--db-text); }
.db-quicktile__sub { font-size: 11px; color: var(--db-text-muted); }

.db-setlist { display: flex; flex-direction: column; gap: 12px; }
.db-setrow { background: var(--db-surface); border: 1px solid var(--db-border); border-radius: var(--db-radius); box-shadow: var(--db-shadow); overflow: hidden; }
.db-setrow__sum { display: flex; align-items: center; gap: 14px; padding: 16px; cursor: pointer; list-style: none; }
.db-setrow__sum::-webkit-details-marker { display: none; }
.db-setrow__sum:hover { background: var(--db-surface-2); }
.db-setrow__icon { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center; }
.db-setrow__icon svg { width: 22px; height: 22px; }
.db-setrow__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.db-setrow__title { font-weight: 700; color: var(--db-text); font-size: 15px; display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.db-setrow__desc { font-size: 13px; color: var(--db-text-soft); }
.db-setrow__chev { flex-shrink: 0; transition: transform .18s; }
.db-setrow[open] .db-setrow__chev { transform: rotate(90deg); }
.db-setrow__body { padding: 16px; border-top: 1px solid var(--db-border); }

.db-backupcard { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px; }
.db-backupcard__ic { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center; }
.db-backupcard__ic svg { width: 22px; height: 22px; }
.db-backupcard__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.db-backupcard__title { font-weight: 700; color: var(--db-text); }
.db-backupcard__sub { font-size: 12.5px; color: var(--db-text-muted); }

@media (max-width: 400px) {
    .db-quickgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---- System status: core services ---- */
.db-svclist, .db-alertlist { display: flex; flex-direction: column; }
.db-svcrow { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--db-border); }
.db-svcrow:last-child { border-bottom: 0; }
.db-svcrow__icon { width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center; }
.db-svcrow__icon svg { width: 22px; height: 22px; }
.db-svcrow__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.db-svcrow__name { font-weight: 700; color: var(--db-text); font-size: 14.5px; }
.db-svcrow__status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--db-green); }
.db-svcrow__meta { flex: 0 0 auto; display: flex; flex-direction: column; gap: 2px; text-align: right; }
.db-svcrow__metric { font-size: 12.5px; color: var(--db-text-soft); white-space: nowrap; }

@media (max-width: 560px) {
    .db-svcrow__main { flex: 1 1 calc(100% - 60px); }
    .db-svcrow__meta { flex-basis: 100%; flex-direction: row; flex-wrap: wrap; gap: 12px; text-align: left; padding-left: 58px; }
}

/* ---- System status: server info rows ---- */
.db-infolist { display: flex; flex-direction: column; }
.db-inforow { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--db-border); }
.db-inforow:last-child { border-bottom: 0; }
.db-inforow__icon { color: var(--db-text-muted); flex-shrink: 0; display: grid; place-items: center; }
.db-inforow__label { color: var(--db-text-soft); font-size: 13.5px; flex-shrink: 0; }
.db-inforow__value { flex: 1 1 auto; min-width: 0; text-align: right; font-weight: 600; color: var(--db-text); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-inforow__copy { flex-shrink: 0; }

/* ---- Toggle switch ---- */
.db-switch { position: relative; display: inline-flex; flex-shrink: 0; cursor: pointer; }
.db-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.db-switch__track { width: 46px; height: 26px; border-radius: 999px; background: var(--db-border-strong); transition: background .18s; display: inline-flex; align-items: center; padding: 3px; }
.db-switch__knob { width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--db-shadow); transition: transform .18s; }
.db-switch input:checked + .db-switch__track { background: var(--db-green); }
.db-switch input:checked + .db-switch__track .db-switch__knob { transform: translateX(20px); }
.db-switch input:focus-visible + .db-switch__track { outline: 2px solid var(--db-primary); outline-offset: 2px; }

/* ---- Backup file rows ---- */
.db-bklist { display: flex; flex-direction: column; }
.db-bkrow { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--db-border); }
.db-bkrow:last-child { border-bottom: 0; }
.db-bkrow__tag { width: 44px; height: 48px; border-radius: 10px; display: grid; place-items: center; font-size: 10px; font-weight: 800; letter-spacing: .5px; flex-shrink: 0; }
.db-bkrow__main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.db-bkrow__name { font-weight: 700; color: var(--db-text); font-size: 15px; }
.db-bkrow__meta { font-size: 12.5px; color: var(--db-text-soft); }
.db-bkrow__sub { font-size: 12.5px; color: var(--db-text-muted); }
.db-bkrow__side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.db-bkrow__top { display: inline-flex; align-items: center; gap: 8px; }
.db-bkrow__actions { display: inline-flex; align-items: center; gap: 14px; }
.db-linkbtn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--db-text-soft); background: transparent; border: 0; cursor: pointer; padding: 0; }
.db-linkbtn:hover { color: var(--db-primary); }

@media (max-width: 560px) {
    .db-bkrow__side { flex-basis: 100%; align-items: stretch; padding-left: 58px; }
    .db-bkrow__top { justify-content: space-between; }
}

/* ---- Automatic backup info rows ---- */
.db-inforow2 { display: flex; align-items: center; gap: 12px; }
.db-inforow2__ic { width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center; }
.db-inforow2__body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.db-inforow2__label { font-size: 12.5px; color: var(--db-text-muted); }
.db-inforow2__value { font-weight: 600; color: var(--db-text); font-size: 13.5px; }
.db-field--flush { margin: 0; flex: 1 1 auto; min-width: 0; }

/* ---- System status: alert rows ---- */
.db-alertrow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--db-border); }
.db-alertrow:last-child { border-bottom: 0; }
.db-alertrow__icon { width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; display: grid; place-items: center; }
.db-alertrow__icon svg { width: 20px; height: 20px; }
.db-alertrow__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.db-alertrow__title { font-weight: 600; color: var(--db-text); font-size: 14px; }
.db-alertrow__desc { font-size: 12.5px; color: var(--db-text-muted); }
