:root {
    --ink: #0a0a0a;
    --ink-2: #161616;
    --ink-3: #242424;
    --line: #2a2a2a;
    --paper: #fafaf7;
    --paper-2: #f0eee8;
    --cream: #e8e4d8;
    --bone: #ffffff;
    --muted: #6b6b6b;
    --muted-2: #9a9a9a;
    --accent: #d4ff3a;
    --accent-2: #ff4d2e;
    --ok: #00d97e;
    --warn: #ffb020;
    --bad: #ff3b3b;
    --info: #5b9eff;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html,
body {
    height: 100%;
}

body {
    font-family: "Geist", -apple-system, sans-serif;
    background: var(--paper);
    color: var(--ink);
    font-feature-settings: "ss01", "ss02", "cv01", "cv11";
    line-height: 1.5;
    overflow-x: hidden;
}

/* ─────── SVG textured background ─────── */
.bg-texture {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-color: var(--paper);
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
        linear-gradient(to right, rgba(0, 0, 0, 0.025) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(0, 0, 0, 0.025) 1px, transparent 1px);
    background-size: 200px 200px, 56px 56px, 56px 56px;
}

::selection {
    background: var(--ink);
    color: var(--accent);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 0;
    border: 3px solid var(--paper);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.4);
}

.serif {
    font-family: "Instrument Serif", serif;
    font-weight: 400;
    letter-spacing: -0.01em;
}

.mono {
    font-family: "JetBrains Mono", monospace;
}

/* ═══════════════════ LOGIN ═══════════════════ */
.login-screen {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    background: var(--ink);
    color: var(--bone);
    position: relative;
}

.login-left {
    position: relative;
    padding: 48px 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    background:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.04 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"),
        radial-gradient(circle at 20% 10%, rgba(212, 255, 58, 0.08), transparent 50%),
        var(--ink);
}

.login-left::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 64px 64px;
    pointer-events: none;
}

.login-brand {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 14px;
}

.login-brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--bone);
    display: grid;
    place-items: center;
    overflow: hidden;
    box-shadow: 0 0 0 4px rgba(212, 255, 58, 0.15);
    padding: 4px;
}

.login-brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.login-brand-text {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.login-brand-text small {
    display: block;
    font-size: 11px;
    color: var(--muted-2);
    font-weight: 400;
}

/* ─── HERO (centered left with quote) ─── */
.login-hero {
    position: relative;
    z-index: 2;
    margin-top: auto;
    margin-bottom: auto;
    max-width: 560px;
}

.login-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50px;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 36px;
}

.login-hero-eyebrow::before {
    content: "";
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.4;
        transform: scale(1.4);
    }
}

/* ─── QUOTE BLOCK ─── */
.login-quote {
    position: relative;
    padding: 0;
    margin: 0;
}

.login-quote-mark {
    position: absolute;
    top: -70px;
    left: -18px;
    font-family: "Instrument Serif", serif;
    font-size: 220px;
    line-height: 1;
    color: var(--accent);
    opacity: 0.18;
    font-style: italic;
    pointer-events: none;
    user-select: none;
    z-index: 0;
}

.login-quote blockquote {
    position: relative;
    z-index: 1;
    font-family: "Instrument Serif", serif;
    font-size: clamp(38px, 4.8vw, 64px);
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-weight: 400;
    color: var(--bone);
    margin: 0 0 32px 0;
    padding: 0;
}

.login-quote blockquote em {
    color: var(--accent);
    font-style: italic;
}

.login-quote figcaption {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.login-quote-line {
    display: inline-block;
    width: 44px;
    height: 1px;
    background: var(--accent);
    flex-shrink: 0;
}

.login-quote-author {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.login-quote-author strong {
    font-family: "Geist", sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--bone);
    letter-spacing: 0.01em;
}

.login-quote-author small {
    font-family: "JetBrains Mono", monospace;
    font-size: 10.5px;
    color: var(--muted-2);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.login-quote-author sup {
    font-size: 8px;
    vertical-align: super;
    margin: 0 1px;
}

/* ─── RIGHT PANEL (unchanged) ─── */
.login-right {
    background: var(--bone);
    color: var(--ink);
    padding: 48px 56px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.login-right::before {
    content: "MGR/01";
    position: absolute;
    top: 32px;
    right: 32px;
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    color: var(--muted-2);
    letter-spacing: 0.1em;
}

.login-card-wrap {
    max-width: 420px;
    width: 100%;
    margin: 0 auto;
}

.login-card-wrap h2 {
    font-family: "Instrument Serif", serif;
    font-size: 38px;
    line-height: 1;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.login-card-wrap>p {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 36px;
}

.field {
    position: relative;
    margin-bottom: 16px;
}

.field label {
    position: absolute;
    top: -8px;
    left: 14px;
    background: var(--bone);
    padding: 0 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: var(--muted);
    font-family: "JetBrains Mono", monospace;
}

.login-input {
    width: 100%;
    padding: 18px 18px;
    border: 1.5px solid var(--ink);
    border-radius: 0;
    font-size: 14px;
    font-family: "Geist", sans-serif;
    background: var(--bone);
    color: var(--ink);
    outline: none;
    transition: all 0.2s;
}

.login-input:focus {
    background: var(--paper);
    box-shadow: 4px 4px 0 var(--ink);
    transform: translate(-2px, -2px);
}

.login-btn {
    width: 100%;
    padding: 20px;
    border: 1.5px solid var(--ink);
    background: var(--ink);
    color: var(--bone);
    font-family: "Geist", sans-serif;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

.login-btn:hover {
    background: var(--accent);
    color: var(--ink);
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--ink);
}

.login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.login-btn .arrow {
    transition: transform 0.2s;
}

.login-btn:hover .arrow {
    transform: translateX(4px);
}

.login-error {
    background: var(--ink);
    color: var(--accent-2);
    padding: 12px 16px;
    font-size: 12px;
    margin-bottom: 16px;
    display: none;
    border-left: 4px solid var(--accent-2);
    font-family: "JetBrains Mono", monospace;
}

.login-error.show {
    display: block;
    animation: shake 0.3s;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-6px);
    }

    75% {
        transform: translateX(6px);
    }
}

.login-meta {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px dashed var(--ink);
    font-size: 11px;
    color: var(--muted);
    font-family: "JetBrains Mono", monospace;
    display: flex;
    justify-content: space-between;
}

.login-meta strong {
    color: var(--ink);
}

@media (max-width: 900px) {
    .login-screen {
        grid-template-columns: 1fr;
    }

    .login-left {
        display: none;
    }

    .login-right {
        padding: 32px 24px;
        min-height: 100vh;
    }
}

/* ═══════════════════ ADMIN SHELL ═══════════════════ */
.admin {
    display: none;
}

.admin.active {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--ink);
    color: var(--bone);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--line);
}

.sidebar-logo {
    padding: 24px 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}

.sidebar-mark {
    width: 40px;
    height: 40px;
    background: var(--bone);
    border-radius: 10px;
    display: grid;
    place-items: center;
    overflow: hidden;
    padding: 3px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.sidebar-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.sidebar-logo h3 {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.1;
}

.sidebar-logo span {
    font-size: 10px;
    color: var(--muted-2);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-family: "JetBrains Mono", monospace;
}

.sidebar-search {
    padding: 16px 16px 8px;
}

.sidebar-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    font-size: 12px;
    color: var(--muted-2);
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-search-box:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
}

.sidebar-search-box .kbd {
    margin-left: auto;
    font-family: "JetBrains Mono", monospace;
    font-size: 10px;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
}

.sidebar-menu {
    padding: 8px 12px 24px;
    flex: 1;
}

.sidebar-section {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted-2);
    padding: 16px 12px 8px;
    font-family: "JetBrains Mono", monospace;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--muted-2);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    border-radius: 8px;
    font-family: inherit;
    transition: all 0.15s ease;
    position: relative;
}

.sidebar-item i {
    width: 18px;
    text-align: center;
    font-size: 13px;
}

.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--bone);
}

.sidebar-item.active {
    background: var(--bone);
    color: var(--ink);
    font-weight: 600;
}

.sidebar-item.active::after {
    content: "→";
    margin-left: auto;
    font-family: "Instrument Serif", serif;
}

.sidebar-item .badge-dot {
    margin-left: auto;
    background: var(--accent-2);
    color: var(--bone);
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-family: "JetBrains Mono", monospace;
}

.sidebar-item.active .badge-dot {
    background: var(--ink);
    color: var(--accent);
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 16px 20px;
    border-top: 1px solid var(--line);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--ink);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 12px;
    font-family: "Instrument Serif", serif;
    font-style: italic;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-info strong {
    font-size: 12px;
    display: block;
    color: var(--bone);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-info small {
    font-size: 10px;
    color: var(--muted-2);
    font-family: "JetBrains Mono", monospace;
}

/* ─────── MAIN ─────── */
.admin-main {
    overflow-x: hidden;
}

.admin-topbar {
    background: rgba(250, 250, 247, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--ink);
    padding: 18px 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 20px;
}

.topbar-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-title .pill {
    font-family: "JetBrains Mono", monospace;
    font-size: 10px;
    color: var(--muted);
    background: var(--bone);
    border: 1px solid var(--line);
    padding: 4px 10px;
    border-radius: 50px;
    letter-spacing: 0.06em;
}

.topbar-title h1 {
    font-family: "Instrument Serif", serif;
    font-size: 28px;
    line-height: 1;
    letter-spacing: -0.01em;
}

.topbar-title h1 em {
    color: var(--muted-2);
    font-style: italic;
    font-size: 18px;
    margin-left: 8px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.live-clock {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: "JetBrains Mono", monospace;
    font-size: 12px;
    color: var(--muted);
    padding: 8px 14px;
    background: var(--bone);
    border: 1px solid var(--line);
    border-radius: 50px;
}

.live-clock::before {
    content: "";
    width: 6px;
    height: 6px;
    background: var(--ok);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.icon-btn {
    width: 38px;
    height: 38px;
    background: var(--bone);
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
    display: grid;
    place-items: center;
    color: var(--ink);
    font-size: 14px;
    transition: all 0.15s;
    position: relative;
}

.icon-btn:hover {
    background: var(--ink);
    color: var(--accent);
    border-color: var(--ink);
}

.icon-btn .dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 7px;
    height: 7px;
    background: var(--accent-2);
    border-radius: 50%;
    border: 2px solid var(--bone);
}

.logout-btn {
    padding: 9px 16px;
    background: var(--ink);
    color: var(--bone);
    border: 1px solid var(--ink);
    border-radius: 50px;
    font-family: "Geist", sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logout-btn:hover {
    background: var(--accent-2);
    border-color: var(--accent-2);
}

.admin-content {
    padding: 32px 36px 64px;
    max-width: 1600px;
    margin: 0 auto;
}

/* ═══════════════════ DASHBOARD ═══════════════════ */
.panel-anim {
    animation: panelIn 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-greeting {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
    margin-bottom: 28px;
}

.hero-card {
    background: var(--ink);
    color: var(--bone);
    padding: 36px 36px 32px;
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    min-height: 240px;
}

.hero-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.04 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    pointer-events: none;
    opacity: 0.6;
}

.hero-card-decor {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 240px;
    height: 240px;
    border: 1px solid rgba(212, 255, 58, 0.16);
    border-radius: 50%;
}

.hero-card-decor::after {
    content: "";
    position: absolute;
    inset: 24px;
    border: 1px solid rgba(212, 255, 58, 0.12);
    border-radius: 50%;
}

.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50px;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    font-family: "JetBrains Mono", monospace;
    position: relative;
    z-index: 2;
    margin-bottom: 20px;
}

.hero-eyebrow::before {
    content: "";
    width: 6px;
    height: 6px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.hero-greet {
    font-family: "Instrument Serif", serif;
    font-size: clamp(36px, 4.4vw, 56px);
    line-height: 1;
    letter-spacing: -0.02em;
    position: relative;
    z-index: 2;
    margin-bottom: 14px;
}

.hero-greet em {
    color: var(--accent);
    font-style: italic;
}

.hero-greet .cursor {
    display: inline-block;
    width: 4px;
    height: 0.9em;
    background: var(--accent);
    margin-left: 4px;
    vertical-align: middle;
    animation: blink 1s steps(2) infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.hero-sub {
    color: var(--muted-2);
    font-size: 14px;
    max-width: 480px;
    line-height: 1.6;
    position: relative;
    z-index: 2;
}

.quick-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    flex-wrap: wrap;
    position: relative;
    z-index: 2;
}

.quick-action {
    padding: 9px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--bone);
    border-radius: 50px;
    font-family: "Geist", sans-serif;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 7px;
}

.quick-action:hover {
    background: var(--accent);
    color: var(--ink);
    border-color: var(--accent);
}

/* Mini activity card */
.activity-card {
    background: var(--bone);
    border: 1px solid var(--ink);
    border-radius: 24px;
    padding: 26px 28px;
    position: relative;
    overflow: hidden;
}

.activity-card h4 {
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.activity-card h4::before {
    content: "";
    width: 18px;
    height: 1px;
    background: var(--ink);
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(14, 1fr);
    gap: 4px;
    margin-bottom: 16px;
}

.heat-cell {
    aspect-ratio: 1;
    background: var(--cream);
    border-radius: 3px;
    transition: all 0.2s;
    cursor: pointer;
}

.heat-cell:hover {
    transform: scale(1.4);
    z-index: 2;
    position: relative;
}

.heat-cell[data-lvl="0"] {
    background: #ececea;
}

.heat-cell[data-lvl="1"] {
    background: #c9c9c4;
}

.heat-cell[data-lvl="2"] {
    background: #8a8a85;
}

.heat-cell[data-lvl="3"] {
    background: #3f3f3a;
}

.heat-cell[data-lvl="4"] {
    background: var(--ink);
}

.heatmap-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: "JetBrains Mono", monospace;
    font-size: 10px;
    color: var(--muted);
}

.heatmap-legend .scale {
    display: flex;
    gap: 3px;
}

.heatmap-legend .scale span {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

/* Stats grid */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bone);
    border: 1px solid var(--ink);
    border-radius: 20px;
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 6px 6px 0 var(--ink);
}

.stat-card.dark {
    background: var(--ink);
    color: var(--bone);
}

.stat-card.accent {
    background: var(--accent);
    border-color: var(--ink);
}

.stat-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
}

.stat-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--paper);
    display: grid;
    place-items: center;
    font-size: 14px;
    color: var(--ink);
}

.stat-card.dark .stat-icon-wrap {
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent);
}

.stat-card.accent .stat-icon-wrap {
    background: var(--ink);
    color: var(--accent);
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 50px;
    background: rgba(0, 217, 126, 0.12);
    color: var(--ok);
}

.stat-trend.down {
    background: rgba(255, 59, 59, 0.12);
    color: var(--bad);
}

.stat-card.dark .stat-trend {
    background: rgba(0, 217, 126, 0.18);
}

.stat-card.accent .stat-trend {
    background: var(--ink);
    color: var(--accent);
}

.stat-value {
    font-family: "Instrument Serif", serif;
    font-size: 44px;
    line-height: 1;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.stat-card.accent .stat-value {
    color: var(--ink);
}

.stat-label {
    font-size: 12px;
    color: var(--muted);
    font-family: "JetBrains Mono", monospace;
    letter-spacing: 0.04em;
}

.stat-card.dark .stat-label {
    color: var(--muted-2);
}

.stat-card.accent .stat-label {
    color: var(--ink);
    opacity: 0.7;
}

.stat-sub {
    margin-top: 12px;
    font-size: 11.5px;
    color: var(--muted);
    font-family: "JetBrains Mono", monospace;
    letter-spacing: 0.02em;
    min-height: 16px;
    border-top: 1px dashed var(--line);
    padding-top: 10px;
}

.stat-card.dark .stat-sub {
    color: var(--muted-2);
    border-top-color: rgba(255, 255, 255, 0.08);
}

.stat-card.accent .stat-sub {
    color: var(--ink);
    opacity: 0.75;
    border-top-color: rgba(10, 10, 10, 0.15);
}

/* Charts row */
.charts-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
    margin-bottom: 28px;
}

.chart-card {
    background: var(--bone);
    border: 1px solid var(--ink);
    border-radius: 20px;
    padding: 24px 28px;
    position: relative;
    overflow: hidden;
}

.chart-card.dark {
    background: var(--ink);
    color: var(--bone);
}

.chart-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 22px;
}

.chart-head h3 {
    font-family: "Instrument Serif", serif;
    font-size: 26px;
    letter-spacing: -0.01em;
    line-height: 1;
}

.chart-head h3 em {
    color: var(--muted);
    font-style: italic;
}

.chart-card.dark .chart-head h3 em {
    color: var(--muted-2);
}

.chart-head p {
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
    font-family: "JetBrains Mono", monospace;
}

.chart-tabs {
    display: flex;
    gap: 4px;
    background: var(--paper);
    padding: 3px;
    border-radius: 50px;
    border: 1px solid var(--line);
}

.chart-card.dark .chart-tabs {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.chart-tab {
    padding: 6px 12px;
    border: none;
    background: transparent;
    font-family: "JetBrains Mono", monospace;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.15s;
}

.chart-tab.active {
    background: var(--ink);
    color: var(--accent);
}

.chart-card.dark .chart-tab.active {
    background: var(--accent);
    color: var(--ink);
}

.chart-canvas-wrap {
    position: relative;
    height: 280px;
}

.chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--muted-2);
    font-family: "JetBrains Mono", monospace;
    font-size: 12px;
    letter-spacing: 0.02em;
    text-align: center;
    padding: 20px;
}

.chart-empty i {
    font-size: 28px;
    opacity: 0.35;
}

.chart-empty p {
    color: var(--muted-2);
    margin: 0;
    line-height: 1.5;
}

.chart-card:not(.dark) .chart-empty {
    color: var(--muted);
}

.chart-card:not(.dark) .chart-empty p {
    color: var(--muted);
}

.donut-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 18px;
}

.donut-stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.donut-stat-row .swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.donut-stat-row .name {
    color: var(--muted);
    flex: 1;
}

.chart-card.dark .donut-stat-row .name {
    color: var(--muted-2);
}

.donut-stat-row .val {
    font-weight: 600;
    font-family: "JetBrains Mono", monospace;
    font-size: 12px;
}

/* Ticker / activity feed */
.feed-card {
    background: var(--bone);
    border: 1px solid var(--ink);
    border-radius: 20px;
    padding: 24px 28px;
}

.feed-card h3 {
    font-family: "Instrument Serif", serif;
    font-size: 24px;
    margin-bottom: 16px;
}

.feed-list {
    display: flex;
    flex-direction: column;
}

.feed-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px dashed var(--line);
}

.feed-item:last-child {
    border-bottom: none;
}

.feed-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    flex-shrink: 0;
}

.feed-icon.ok {
    background: rgba(0, 217, 126, 0.14);
    color: var(--ok);
}

.feed-icon.warn {
    background: rgba(255, 176, 32, 0.14);
    color: var(--warn);
}

.feed-icon.info {
    background: rgba(91, 158, 255, 0.14);
    color: var(--info);
}

.feed-icon.bad {
    background: rgba(255, 59, 59, 0.14);
    color: var(--bad);
}

.feed-content {
    flex: 1;
}

.feed-content p {
    font-size: 13px;
    color: var(--ink);
    line-height: 1.4;
}

.feed-content p strong {
    font-weight: 600;
}

.feed-content small {
    font-family: "JetBrains Mono", monospace;
    font-size: 10px;
    color: var(--muted);
    margin-top: 2px;
    display: block;
}

/* ═══════════════════ TABLES ═══════════════════ */
.table-card {
    background: var(--bone);
    border: 1px solid var(--ink);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 24px;
}

.table-head-bar {
    padding: 22px 26px;
    border-bottom: 1px solid var(--ink);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    background: var(--paper);
}

.table-head-bar h3 {
    font-family: "Instrument Serif", serif;
    font-size: 24px;
    line-height: 1;
    letter-spacing: -0.01em;
}

.table-head-bar h3 em {
    color: var(--muted);
    font-style: italic;
    font-size: 16px;
    margin-left: 6px;
}

.table-head-bar .actions {
    display: flex;
    gap: 8px;
}

.pp-table {
    width: 100%;
    border-collapse: collapse;
}

.pp-table th {
    padding: 14px 22px;
    text-align: left;
    font-family: "JetBrains Mono", monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--paper);
    border-bottom: 1px solid var(--ink);
    font-weight: 600;
}

.pp-table td {
    padding: 16px 22px;
    font-size: 13px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.pp-table td:first-child {
    font-weight: 500;
}

.pp-table tr:last-child td {
    border-bottom: none;
}

.pp-table tbody tr {
    transition: background 0.15s;
}

.pp-table tbody tr:hover {
    background: var(--paper-2);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 500;
    font-family: "JetBrains Mono", monospace;
    border: 1px solid;
}

.badge::before {
    content: "";
    width: 5px;
    height: 5px;
    background: currentColor;
    border-radius: 50%;
}

.badge-green {
    background: rgba(0, 217, 126, 0.08);
    color: var(--ok);
    border-color: rgba(0, 217, 126, 0.3);
}

.badge-orange {
    background: rgba(255, 176, 32, 0.08);
    color: var(--warn);
    border-color: rgba(255, 176, 32, 0.3);
}

.badge-red {
    background: rgba(255, 59, 59, 0.08);
    color: var(--bad);
    border-color: rgba(255, 59, 59, 0.3);
}

.badge-blue {
    background: rgba(91, 158, 255, 0.08);
    color: var(--info);
    border-color: rgba(91, 158, 255, 0.3);
}

.badge-gray {
    background: var(--paper);
    color: var(--muted);
    border-color: var(--line);
}

.badge-print {
    background: var(--accent);
    color: var(--ink);
    border-color: var(--ink);
}

.badge-ebook {
    background: rgba(91, 158, 255, 0.08);
    color: var(--info);
    border-color: rgba(91, 158, 255, 0.3);
}

.badge-audio {
    background: rgba(0, 217, 126, 0.08);
    color: var(--ok);
    border-color: rgba(0, 217, 126, 0.3);
}

.act-btn {
    padding: 7px 14px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--line);
    transition: all 0.15s;
    background: var(--bone);
    color: var(--ink);
    font-family: "Geist", sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.act-btn i {
    font-size: 10px;
}

.act-btn:hover {
    background: var(--ink);
    color: var(--accent);
    border-color: var(--ink);
    transform: translateY(-1px);
}

.act-btn.green {
    border-color: rgba(0, 217, 126, 0.3);
    color: var(--ok);
}

.act-btn.green:hover {
    background: var(--ok);
    color: var(--bone);
    border-color: var(--ok);
}

.act-btn.red {
    border-color: rgba(255, 59, 59, 0.3);
    color: var(--bad);
}

.act-btn.red:hover {
    background: var(--bad);
    color: var(--bone);
    border-color: var(--bad);
}

.act-btn.orange {
    border-color: rgba(255, 176, 32, 0.3);
    color: var(--warn);
}

.act-btn.orange:hover {
    background: var(--warn);
    color: var(--ink);
    border-color: var(--warn);
}

.act-btn.blue {
    border-color: rgba(91, 158, 255, 0.3);
    color: var(--info);
}

.act-btn.blue:hover {
    background: var(--info);
    color: var(--bone);
    border-color: var(--info);
}

.act-btn.primary {
    background: var(--ink);
    color: var(--accent);
    border-color: var(--ink);
}

.act-btn.primary:hover {
    background: var(--accent);
    color: var(--ink);
    border-color: var(--ink);
}

.act-btn.gray {
    background: var(--paper);
}

.pp-table code {
    background: var(--paper);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-family: "JetBrains Mono", monospace;
    color: var(--ink);
    border: 1px solid var(--line);
}

/* ═══════════════════ FORMS ═══════════════════ */
.form-card {
    background: var(--bone);
    border: 1px solid var(--ink);
    border-radius: 20px;
    padding: 32px 36px;
    margin-bottom: 24px;
}

.form-card-head {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--line);
}

.form-card-head h3 {
    font-family: "Instrument Serif", serif;
    font-size: 28px;
    line-height: 1;
    letter-spacing: -0.01em;
    margin-bottom: 6px;
}

.form-card-head p {
    font-size: 13px;
    color: var(--muted);
}

.f-group {
    margin-bottom: 18px;
}

.f-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
    font-family: "JetBrains Mono", monospace;
}

.f-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    font-size: 14px;
    font-family: "Geist", sans-serif;
    background: var(--paper);
    color: var(--ink);
    outline: none;
    transition: all 0.15s;
}

.f-input:focus {
    border-color: var(--ink);
    background: var(--bone);
}

.f-input[readonly] {
    background: var(--cream);
    cursor: not-allowed;
    opacity: 0.8;
}

select.f-input {
    cursor: pointer;
}

textarea.f-input {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.f-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 580px) {
    .f-row {
        grid-template-columns: 1fr;
    }
}

.alert-error {
    background: var(--ink);
    color: var(--bone);
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    border-left: 4px solid var(--accent-2);
    font-family: "JetBrains Mono", monospace;
}

.alert-success {
    background: var(--ink);
    color: var(--bone);
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    border-left: 4px solid var(--accent);
    font-family: inherit;
    line-height: 1.6;
}

.alert-success code,
.alert-success strong {
    color: var(--accent);
}

.info-box {
    background: var(--accent);
    color: var(--ink);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    border: 1px solid var(--ink);
}

.royalty-preview-box {
    background: var(--ink);
    color: var(--bone);
    padding: 16px 20px;
    border-radius: 14px;
    margin: 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.royalty-preview-box .label-text {
    font-size: 13px;
    color: var(--muted-2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.royalty-preview-box .amt {
    font-family: "Instrument Serif", serif;
    font-size: 32px;
    color: var(--accent);
    line-height: 1;
}

.selected-author-info {
    background: var(--accent);
    color: var(--ink);
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 18px;
    border: 1px solid var(--ink);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Tabs */
.pp-tabs {
    display: flex;
    gap: 4px;
    background: var(--bone);
    padding: 4px;
    margin-bottom: 22px;
    border: 1px solid var(--ink);
    border-radius: 50px;
    width: fit-content;
    overflow-x: auto;
}

.pp-tab {
    padding: 9px 20px;
    border: none;
    background: transparent;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    color: var(--muted);
    transition: all 0.15s;
    white-space: nowrap;
    font-family: "Geist", sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pp-tab:hover:not(.active) {
    color: var(--ink);
}

.pp-tab.active {
    background: var(--ink);
    color: var(--accent);
}

.admin-panel {
    display: none;
}

.admin-panel.active {
    display: block;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 2px solid var(--cream);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 32px auto;
    display: block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-msg {
    text-align: center;
    padding: 56px 24px;
    color: var(--muted);
    font-size: 14px;
}

.empty-msg::before {
    content: "○";
    display: block;
    font-size: 48px;
    color: var(--cream);
    margin-bottom: 12px;
    font-family: "Instrument Serif", serif;
}

/* ═══════════════════ MODALS ═══════════════════ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.55);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.modal-overlay.show {
    display: flex;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-card {
    background: var(--bone);
    border: 1px solid var(--ink);
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
    box-shadow: 12px 12px 0 var(--ink);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-head {
    padding: 20px 24px;
    border-bottom: 1px dashed var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-head h3 {
    font-family: "Instrument Serif", serif;
    font-size: 22px;
    line-height: 1;
    letter-spacing: -0.01em;
}

.modal-close {
    background: var(--paper);
    border: 1px solid var(--line);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--ink);
    font-size: 18px;
    display: grid;
    place-items: center;
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--ink);
    color: var(--accent);
    border-color: var(--ink);
}

.modal-body {
    padding: 24px;
}

.modal-foot {
    padding: 16px 24px 22px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px dashed var(--line);
}

.royalty-modal-overlay {
    /* alias for backward compat with original code */
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.55);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(8px);
}

.royalty-modal-card {
    background: var(--bone);
    border: 1px solid var(--ink);
    border-radius: 20px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 12px 12px 0 var(--ink);
    animation: modalIn 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.royalty-modal-header {
    padding: 20px 24px;
    border-bottom: 1px dashed var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.royalty-modal-header h3 {
    font-family: "Instrument Serif", serif;
    font-size: 22px;
    line-height: 1;
}

.royalty-modal-close {
    background: var(--paper);
    border: 1px solid var(--line);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--ink);
    font-size: 18px;
    display: grid;
    place-items: center;
    transition: all 0.15s;
    padding: 0;
}

.royalty-modal-close:hover {
    background: var(--ink);
    color: var(--accent);
    border-color: var(--ink);
}

.royalty-modal-body {
    padding: 24px;
}

.royalty-modal-footer {
    padding: 16px 24px 22px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px dashed var(--line);
}

.royalty-input-group {
    margin-bottom: 16px;
}

.royalty-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
    font-family: "JetBrains Mono", monospace;
}

.royalty-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    font-size: 14px;
    font-family: "Geist", sans-serif;
    color: var(--ink);
    background: var(--paper);
    outline: none;
    transition: all 0.15s;
}

.royalty-input:focus {
    border-color: var(--ink);
    background: var(--bone);
}

textarea.royalty-input {
    resize: vertical;
    font-family: inherit;
}

.royalty-info {
    background: var(--accent);
    color: var(--ink);
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    border: 1px solid var(--ink);
}

.royalty-btn {
    padding: 10px 18px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: 1.5px solid var(--ink);
    font-family: "Geist", sans-serif;
}

.royalty-btn-cancel {
    background: var(--bone);
    color: var(--ink);
}

.royalty-btn-cancel:hover {
    background: var(--paper);
}

.royalty-btn-save {
    background: var(--ink);
    color: var(--accent);
}

.royalty-btn-save:hover {
    background: var(--accent);
    color: var(--ink);
}

/* ═══════════════════ COMMAND PALETTE ═══════════════════ */
.cmd-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.4);
    z-index: 9999;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    backdrop-filter: blur(6px);
}

.cmd-overlay.show {
    display: flex;
}

.cmd-box {
    width: 100%;
    max-width: 560px;
    background: var(--bone);
    border: 1px solid var(--ink);
    border-radius: 16px;
    box-shadow: 12px 12px 0 var(--ink);
    overflow: hidden;
    animation: modalIn 0.2s;
}

.cmd-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
}

.cmd-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 16px;
    font-family: "Geist", sans-serif;
    color: var(--ink);
}

.cmd-input::placeholder {
    color: var(--muted-2);
}

.cmd-results {
    padding: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.cmd-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--ink);
    transition: background 0.1s;
}

.cmd-item:hover,
.cmd-item.active {
    background: var(--ink);
    color: var(--accent);
}

.cmd-item i {
    width: 16px;
    text-align: center;
}

.cmd-item small {
    margin-left: auto;
    font-family: "JetBrains Mono", monospace;
    font-size: 10px;
    opacity: 0.6;
}

/* Mobile */
@media (max-width: 900px) {
    .admin.active {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .admin-content {
        padding: 20px 16px 40px;
    }

    .admin-topbar {
        padding: 14px 16px;
    }

    .topbar-title h1 {
        font-size: 22px;
    }

    .live-clock {
        display: none;
    }

    .hero-greeting {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .pp-table th,
    .pp-table td {
        padding: 10px 14px;
        font-size: 12px;
    }

    .form-card {
        padding: 24px 20px;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }

    .hero-card {
        padding: 24px;
    }
}

/* Author select modal styles (kept from original) */
.author-select-modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.55);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.author-select-card {
    background: var(--bone);
    border: 1px solid var(--ink);
    border-radius: 20px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 12px 12px 0 var(--ink);
}

.author-list {
    max-height: 300px;
    overflow-y: auto;
}

.author-option {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.15s;
}

.author-option:hover {
    background: var(--accent);
    border-color: var(--ink);
}

.me-1 {
    margin-right: 4px;
}

.me-2 {
    margin-right: 8px;
}

/* ═══════════════════ SEARCH BAR & FILTERS ═══════════════════ */
.search-filter-bar {
    padding: 18px 26px;
    border-bottom: 1px solid var(--line);
    background: var(--bone);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-input-wrap {
    flex: 1;
    min-width: 260px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrap i.search-icon {
    position: absolute;
    left: 14px;
    color: var(--muted);
    font-size: 13px;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 11px 14px 11px 38px;
    border: 1.5px solid var(--line);
    border-radius: 50px;
    font-size: 13px;
    font-family: "Geist", sans-serif;
    background: var(--paper);
    color: var(--ink);
    outline: none;
    transition: all 0.15s;
}

.search-input:focus {
    border-color: var(--ink);
    background: var(--bone);
    box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.06);
}

.search-input::placeholder {
    color: var(--muted-2);
}

.search-clear-btn {
    position: absolute;
    right: 10px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: var(--ink);
    color: var(--accent);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.15s;
}

.search-clear-btn.show {
    display: flex;
}

.search-clear-btn:hover {
    background: var(--accent-2);
    color: var(--bone);
}

.filter-select {
    padding: 10px 34px 10px 14px;
    border: 1.5px solid var(--line);
    border-radius: 50px;
    font-size: 12px;
    font-family: "Geist", sans-serif;
    background: var(--paper) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 12px center;
    color: var(--ink);
    outline: none;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
    appearance: none;
    -webkit-appearance: none;
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--ink);
    background-color: var(--bone);
}

.search-meta {
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    color: var(--muted);
    letter-spacing: 0.04em;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-meta strong {
    color: var(--ink);
    font-weight: 600;
}

@media (max-width: 640px) {
    .search-filter-bar {
        padding: 14px 16px;
    }

    .search-input-wrap {
        min-width: 100%;
    }

    .filter-select {
        flex: 1;
    }
}

/* Enhanced modal styling for author info */
#authorInfoModal .modal-card {
    animation: modalIn 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

#authorInfoModal .modal-body::-webkit-scrollbar {
    width: 6px;
}

#authorInfoModal .modal-body::-webkit-scrollbar-track {
    background: var(--cream);
    border-radius: 4px;
}

#authorInfoModal .modal-body::-webkit-scrollbar-thumb {
    background: var(--muted-2);
    border-radius: 4px;
}

/* Smooth transitions */
.act-btn {
    transition: all 0.2s cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Author row info button styling */
.author-info-btn {
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted);
    transition: all 0.2s;
    margin-left: 8px;
    vertical-align: middle;
}

.author-info-btn:hover {
    background: var(--accent);
    border-color: var(--ink);
    color: var(--ink);
    transform: scale(1.05);
}

.author-name-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* StackBIZ Sticky Footer — always visible, types once on load */
.stackbiz-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9998;
    padding: 10px 24px;
    background: rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    color: var(--muted-2, #9a9a9a);
    letter-spacing: 0.04em;
    user-select: none;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
}

/* When admin is active, push footer past the sidebar */
body:has(.admin.active) .stackbiz-footer {
    left: 240px;
}

.stackbiz-footer .sb-prompt {
    color: var(--accent, #d4ff3a);
    font-weight: 600;
    flex-shrink: 0;
}

/* One-time typing reveal — runs once, stays visible */
.stackbiz-footer .sb-typed {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
    max-width: 0;
    animation: sb-type 2.8s steps(44, end) 0.5s forwards;
}

@keyframes sb-type {
    from {
        max-width: 0;
    }

    to {
        max-width: 500px;
    }
}

.stackbiz-footer .sb-heart {
    display: inline-block;
    color: var(--accent-2, #ff4d2e);
    animation: sb-beat 1.4s ease-in-out infinite;
    font-size: 12px;
    flex-shrink: 0;
}

.stackbiz-footer .sb-brand {
    pointer-events: auto;
    font-family: "Geist", sans-serif;
    font-weight: 600;
    color: var(--ink, #0a0a0a);
    background: var(--accent, #d4ff3a);
    padding: 3px 10px;
    border-radius: 50px;
    border: 1px solid var(--accent, #d4ff3a);
    font-size: 10.5px;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
    cursor: default;
    flex-shrink: 0;
}

.stackbiz-footer .sb-brand:hover {
    background: transparent;
    color: var(--accent, #d4ff3a);
    border-color: var(--accent, #d4ff3a);
}

/* Cursor blinks during typing, then fades out gracefully */
.stackbiz-footer .sb-cursor {
    display: inline-block;
    width: 7px;
    height: 12px;
    background: var(--accent, #d4ff3a);
    margin-left: 2px;
    vertical-align: middle;
    flex-shrink: 0;
    animation: sb-blink 1s steps(2) infinite,
        sb-cursor-fade 0.6s ease-out 4s forwards;
}

@keyframes sb-beat {

    0%,
    100% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.25);
    }

    50% {
        transform: scale(1);
    }

    75% {
        transform: scale(1.15);
    }
}

@keyframes sb-blink {
    50% {
        opacity: 0;
    }
}

@keyframes sb-cursor-fade {
    to {
        opacity: 0;
        width: 0;
        margin-left: 0;
    }
}

/* Push content up so footer never overlaps */
.admin-content {
    padding-bottom: 80px !important;
}

.login-right {
    padding-bottom: 80px !important;
}

/* Mobile */
@media (max-width: 900px) {
    body:has(.admin.active) .stackbiz-footer {
        left: 0;
    }

    .stackbiz-footer {
        padding: 9px 14px;
        font-size: 10px;
        gap: 5px;
    }

    .stackbiz-footer .sb-brand {
        font-size: 10px;
        padding: 2px 8px;
    }
}

@media (max-width: 480px) {
    .stackbiz-footer .sb-cmd-text {
        display: none;
    }
}

/* ══════════ INVOICE TEMPLATE ══════════ */
.tinv-page {
    position: relative;
    background: #fff;
    color: #1a1a1a;
    font-family: Arial, Helvetica, sans-serif;
    box-sizing: border-box;
    box-shadow: 0 2px 18px rgba(0, 0, 0, 0.15);
}

.tinv-size-a4 {
    width: 210mm;
    min-height: 297mm;
    padding: 14mm 16mm;
    font-size: 12.5px;
}

.tinv-size-letter {
    width: 215.9mm;
    min-height: 279.4mm;
    padding: 14mm 16mm;
    font-size: 12.5px;
}

.tinv-size-pocket {
    width: 148mm;
    min-height: 210mm;
    padding: 9mm 10mm;
    font-size: 10px;
}

.tinv-watermark {
    position: absolute !important;
    top: 50%;
    left: 50%;
    width: 55%;
    max-width: 420px;
    height: 55%;
    max-height: 420px;
    transform: translate(-50%, -50%);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.05;
    z-index: 0 !important;
    pointer-events: none;
}

.tinv-page>*:not(.tinv-watermark) {
    position: relative;
    z-index: 1;
}

.tinv-toprow {
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #333;
    font-weight: 700;
    margin-bottom: 6px;
}

.tinv-companyrow {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #1a1a1a;
    padding-bottom: 10px;
    margin-bottom: 12px;
}

.tinv-company-name {
    font-size: 1.5em;
    font-weight: 800;
    margin: 0 0 4px;
}

.tinv-gstin {
    font-weight: 700;
    font-size: 0.95em;
    margin-bottom: 2px;
}

.tinv-address {
    font-size: 0.85em;
    line-height: 1.45;
    color: #333;
    max-width: 380px;
}

.tinv-logo {
    width: 62px;
    height: auto;
}

.tinv-metabar {
    display: flex;
    gap: 30px;
    font-size: 0.9em;
    margin-bottom: 14px;
}

.tinv-metabar b {
    font-weight: 700;
}

.tinv-twocol {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    font-size: 0.85em;
    margin-bottom: 10px;
}

.tinv-twocol>div {
    flex: 1;
}

.tinv-sectitle {
    font-weight: 700;
    margin-bottom: 4px;
}

.tinv-bold {
    font-weight: 700;
}

.tinv-table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0 4px;
    font-size: 0.85em;
}

.tinv-table th {
    text-align: left;
    border-bottom: 1.5px solid #1a1a1a;
    padding: 6px 5px;
    font-weight: 700;
}

.tinv-table td {
    padding: 8px 5px;
    border-bottom: 1px solid #ddd;
}

.tinv-table th:not(:first-child):not(:nth-child(2)),
.tinv-table td:not(:first-child):not(:nth-child(2)) {
    text-align: right;
}

.tinv-footrow {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed #999;
    font-size: 0.85em;
}

.tinv-totalsblock {
    width: 260px;
}

.tinv-totalsblock div {
    display: flex;
    justify-content: space-between;
    padding: 2px 0;
}

.tinv-grandtotal {
    font-weight: 800;
    font-size: 1.25em;
    border-top: 2px solid #1a1a1a;
    margin-top: 4px;
    padding-top: 6px !important;
}

.tinv-wordsrow {
    display: flex;
    justify-content: space-between;
    font-size: 0.85em;
    margin-top: 8px;
    border-bottom: 1px solid #ccc;
    padding-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.tinv-payable b {
    font-size: 1.05em;
}

.tinv-bottomrow {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    font-size: 0.85em;
}

.tinv-bank-table td {
    padding: 2px 8px 2px 0;
}

.tinv-bank-table td:first-child {
    color: #555;
}

.tinv-signatory {
    text-align: right;
}

.tinv-sigspace {
    height: 46px;
}

.tinv-pagefooter {
    display: flex;
    justify-content: space-between;
    font-size: 0.72em;
    color: #777;
    margin-top: 30px;
    border-top: 1px solid #eee;
    padding-top: 8px;
    flex-wrap: wrap;
    gap: 6px;
}

/* POS / 80mm thermal receipt */
.tinv-pos {
    width: 80mm;
    background: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    padding: 6mm 4mm;
    color: #000;
    box-shadow: 0 2px 18px rgba(0, 0, 0, 0.15);
}

.tinv-pos-center {
    text-align: center;
}

.tinv-pos hr {
    border: none;
    border-top: 1px dashed #000;
    margin: 6px 0;
}

.tinv-pos table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10.5px;
}

.tinv-pos td {
    padding: 2px 0;
}

.tinv-pos .r {
    text-align: right;
}

.tinv-pos .grand {
    font-weight: 700;
    font-size: 13px;
}

/* Print isolation: only #invoicePrintFrame's content ever reaches paper */
@media print {
    body * {
        visibility: hidden;
    }

    #invoicePrintFrame,
    #invoicePrintFrame * {
        visibility: visible;
    }
}

/* Print styles for invoice */
@media print {
    body * {
        visibility: hidden;
    }
    
    .tinv-page, .tinv-page *,
    .tinv-pos, .tinv-pos * {
        visibility: visible !important;
    }
    
    .tinv-page, .tinv-pos {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 10mm !important;
        box-shadow: none !important;
    }
    
    /* Hide interactive elements */
    button, .act-btn, .royalty-btn, 
    .modal-overlay, .modal-close,
    .no-print {
        display: none !important;
    }
    
    /* Ensure tables print properly */
    .tinv-table {
        page-break-inside: auto;
    }
    .tinv-table tr {
        page-break-inside: avoid;
        page-break-after: auto;
    }
    .tinv-table td, .tinv-table th {
        border: 1px solid #ddd !important;
    }
}