/* Blackbox Logs, styled after the Rotorflight Configurator: its design tokens
   (src/css/app.css and main.css in rotorflight-configurator), its graphite
   app chrome, Open Sans and JetBrains Mono. <html data-brand="..."> picks the
   project; the theme follows the system (prefers-color-scheme). */

@font-face {
    font-family: 'Open Sans';
    src: url('/assets/opensans-regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Open Sans';
    src: url('/assets/opensans-semibold.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
}

@font-face {
    font-family: 'Open Sans';
    src: url('/assets/opensans-bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

@font-face {
    font-family: 'JetBrains Mono';
    src: url('/assets/jetbrainsmono-regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

/* ---------------------------------------------------------------------------
   Tokens (light)
   ------------------------------------------------------------------------- */

:root {
    --nh: 208;
    --ns: 9%;
    --ah: 203;
    --as: 100%;

    --neutral-50: hsl(var(--nh), var(--ns), 100%);
    --neutral-100: hsl(var(--nh), var(--ns), 98%);
    --neutral-200: hsl(var(--nh), var(--ns), 95%);
    --neutral-300: hsl(var(--nh), var(--ns), 90%);
    --neutral-400: hsl(var(--nh), var(--ns), 76%);
    --neutral-500: hsl(var(--nh), var(--ns), 55%);
    --neutral-600: hsl(var(--nh), var(--ns), 36%);
    --neutral-700: hsl(var(--nh), var(--ns), 22%);
    --neutral-900: hsl(var(--nh), var(--ns), 8%);

    --accent: hsl(var(--ah), var(--as), 39%);
    --accent-hover: hsl(var(--ah), var(--as), 32%);
    --accent-text: hsl(var(--ah), var(--as), 32%);
    --accent-fg: #fff;
    --accent-soft: hsl(var(--ah) var(--as) 39% / 0.1);
    --focus-ring: hsl(var(--ah) var(--as) 39% / 0.28);

    --bg: var(--neutral-200);
    --surface: var(--neutral-50);
    --surface-sunken: var(--neutral-100);
    --header-bg: var(--neutral-100);
    --header-fg: var(--neutral-700);
    --border: var(--neutral-300);
    --border-control: var(--neutral-400);
    --text: var(--neutral-900);
    --text-soft: var(--neutral-700);
    --text-muted: var(--neutral-600);

    --btn-bg: var(--neutral-300);
    --btn-bg-hover: var(--neutral-400);
    --btn-fg: hsl(var(--nh), var(--ns), 13%);

    --danger: hsl(4, 76%, 44%);
    --danger-soft: hsl(4, 100%, 95%);
    --warning: hsl(36, 100%, 26%);
    --warning-soft: hsl(48, 100%, 91%);
    --success: hsl(145, 63%, 26%);

    /* App chrome: dark in both themes, like the configurator's header. */
    --chrome-bg: hsl(208, 11%, 14%);
    --chrome-bg-raised: hsl(208, 11%, 19%);
    --chrome-border: hsl(208, 10%, 24%);
    --chrome-fg: hsl(208, 14%, 88%);
    --chrome-fg-muted: hsl(208, 8%, 62%);
    --chrome-hover: rgba(255, 255, 255, 0.07);
    --chrome-accent: hsl(203, 100%, 39%);
    --chrome-accent-hover: hsl(203, 100%, 33%);

    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-pill: 999px;

    --shadow-xs: 0 1px 2px rgba(15, 18, 24, 0.06);
    --shadow-sm: 0 1px 2px rgba(15, 18, 24, 0.06), 0 2px 6px -2px rgba(15, 18, 24, 0.08);
    --shadow-md: 0 2px 4px -1px rgba(15, 18, 24, 0.07), 0 8px 20px -6px rgba(15, 18, 24, 0.12);
    --shadow-lg: 0 4px 8px -2px rgba(15, 18, 24, 0.08), 0 18px 40px -12px rgba(15, 18, 24, 0.2);

    --ease: 0.16s cubic-bezier(0.4, 0, 0.2, 1);
    --font-ui: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --content: 880px;
    color-scheme: light;
}

/* Wingflight: the same system with its red accent on cooler neutrals. */
:root[data-brand="wingflight"] {
    --nh: 220;
    --ns: 8%;
    --ah: 0;
    --as: 78%;
    --accent: hsl(0, 78%, 47%);
    --accent-hover: hsl(0, 78%, 41%);
    --accent-text: hsl(0, 78%, 40%);
    --chrome-bg: hsl(220, 9%, 13%);
    --chrome-bg-raised: hsl(220, 9%, 18%);
    --chrome-border: hsl(220, 10%, 22%);
    --chrome-accent: hsl(0, 78%, 47%);
    --chrome-accent-hover: hsl(0, 78%, 41%);
}

/* ---------------------------------------------------------------------------
   Tokens (dark), the configurator's dark theme
   ------------------------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
    :root {
        --neutral-50: hsl(var(--nh), var(--ns), 96%);
        --neutral-100: hsl(var(--nh), var(--ns), 90%);
        --neutral-200: hsl(var(--nh), var(--ns), 82%);
        --neutral-300: hsl(var(--nh), var(--ns), 70%);
        --neutral-400: hsl(var(--nh), var(--ns), 58%);
        --neutral-500: hsl(var(--nh), var(--ns), 45%);
        --neutral-600: hsl(var(--nh), var(--ns), 32%);
        --neutral-700: hsl(var(--nh), var(--ns), 22%);
        --neutral-800: hsl(var(--nh), var(--ns), 16%);
        --neutral-900: hsl(var(--nh), var(--ns), 11%);
        --neutral-950: hsl(var(--nh), var(--ns), 7%);

        --as: 82%;
        --accent: hsl(var(--ah), var(--as), 58%);
        --accent-hover: hsl(var(--ah), var(--as), 66%);
        --accent-text: hsl(var(--ah), var(--as), 66%);
        --accent-fg: hsl(208, 20%, 8%);
        --accent-soft: hsl(var(--ah) var(--as) 58% / 0.16);
        --focus-ring: hsl(var(--ah) var(--as) 58% / 0.35);

        --bg: var(--neutral-950);
        --surface: var(--neutral-900);
        --surface-sunken: var(--neutral-950);
        --header-bg: var(--neutral-800);
        --header-fg: var(--neutral-100);
        --border: var(--neutral-700);
        --border-control: var(--neutral-600);
        --text: var(--neutral-50);
        --text-soft: var(--neutral-100);
        --text-muted: var(--neutral-300);

        --btn-bg: var(--neutral-700);
        --btn-bg-hover: var(--neutral-600);
        --btn-fg: var(--neutral-50);

        --danger: hsl(4, 85%, 68%);
        --danger-soft: hsl(4, 45%, 18%);
        --warning: hsl(45, 90%, 62%);
        --warning-soft: hsl(42, 45%, 16%);
        --success: hsl(145, 50%, 60%);

        --chrome-bg: hsl(208, 11%, 9%);
        --chrome-bg-raised: hsl(208, 11%, 14%);
        --chrome-border: hsl(208, 10%, 19%);

        --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 6px -2px rgba(0, 0, 0, 0.5);
        --shadow-md: 0 2px 4px -1px rgba(0, 0, 0, 0.45), 0 8px 20px -6px rgba(0, 0, 0, 0.6);
        --shadow-lg: 0 4px 8px -2px rgba(0, 0, 0, 0.5), 0 18px 40px -12px rgba(0, 0, 0, 0.7);
        color-scheme: dark;
    }

    :root[data-brand="wingflight"] {
        --as: 72%;
        --accent: hsl(0, 72%, 60%);
        --accent-hover: hsl(0, 72%, 67%);
        --accent-text: hsl(0, 80%, 72%);
        --chrome-bg: hsl(220, 9%, 9%);
        --chrome-bg-raised: hsl(220, 9%, 14%);
        --chrome-border: hsl(220, 10%, 19%);
    }
}

/* ---------------------------------------------------------------------------
   Base
   ------------------------------------------------------------------------- */

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3 {
    margin: 0;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

h1 {
    font-size: 24px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

h2 {
    font-size: 15px;
    font-weight: 600;
}

p {
    margin: 0 0 12px;
}

p:last-child {
    margin-bottom: 0;
}

a {
    color: var(--accent-text);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

code {
    font-family: var(--font-mono);
    font-size: 0.88em;
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 1px 5px;
}

.mono {
    font-family: var(--font-mono);
    font-size: 0.92em;
}

.muted {
    color: var(--text-muted);
}

.small {
    font-size: 12px;
}

.pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.link {
    overflow-wrap: anywhere;
}

.nowrap {
    white-space: nowrap;
}

.icon {
    width: 16px;
    height: 16px;
    flex: none;
    vertical-align: -3px;
}

:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring);
}

[hidden] {
    display: none !important;
}

/* ---------------------------------------------------------------------------
   App chrome: header bar and footer
   ------------------------------------------------------------------------- */

.navbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--chrome-bg);
    border-bottom: 2px solid var(--chrome-accent);
    color: var(--chrome-fg);
}

.navbar-inner,
main,
footer {
    width: 100%;
    max-width: var(--content);
    margin: 0 auto;
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 56px;
    padding: 0 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    color: var(--chrome-fg);
}

.brand:hover {
    text-decoration: none;
}

.logo {
    display: block;
    height: 28px;
    width: auto;
}

.navbar-divider {
    width: 1px;
    height: 24px;
    background: var(--chrome-border);
}

.navbar-title {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.account {
    display: flex;
    align-items: center;
    gap: 8px;
}

.account form {
    margin: 0;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--chrome-border);
    border-radius: var(--radius-sm);
    background: var(--chrome-bg-raised);
    color: var(--chrome-fg);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: background var(--ease), border-color var(--ease);
}

.nav-btn:hover {
    background: hsl(208, 11%, 24%);
    color: #fff;
    text-decoration: none;
}

.nav-btn-primary {
    background: var(--chrome-accent);
    border-color: var(--chrome-accent);
    color: #fff;
}

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

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--chrome-fg-muted);
    cursor: pointer;
    transition: background var(--ease), color var(--ease);
}

.nav-icon:hover {
    background: var(--chrome-hover);
    color: #fff;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px 0 4px;
    border-radius: var(--radius-pill);
    background: var(--chrome-bg-raised);
    border: 1px solid var(--chrome-border);
    font-size: 13px;
    font-weight: 600;
}

.avatar {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-pill);
    display: block;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 28px 16px 40px;
}

footer {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 24px;
    padding: 20px 16px 32px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
}

footer a {
    color: inherit;
}

footer a:hover {
    color: var(--text);
}

/* ---------------------------------------------------------------------------
   Cards (the configurator's gui_box)
   ------------------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--header-bg);
    color: var(--header-fg);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 600;
}

.card-header .icon {
    color: var(--accent-text);
}

.count {
    margin-left: 2px;
    padding: 0 8px;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: 12px;
    line-height: 20px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: var(--surface-sunken);
}

.eyebrow {
    display: inline-block;
    margin-bottom: 6px;
    color: var(--accent-text);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ---------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--accent-fg);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--ease), border-color var(--ease), color var(--ease), box-shadow var(--ease),
        transform var(--ease);
}

.button:hover {
    background: var(--accent-hover);
    text-decoration: none;
}

.button:active {
    transform: translateY(1px);
}

.button:disabled {
    opacity: 0.55;
    cursor: default;
    transform: none;
}

.button-lg {
    height: 44px;
    padding: 0 20px;
    font-size: 15px;
}

.button-small {
    height: 30px;
    padding: 0 10px;
    font-size: 12px;
    gap: 6px;
}

.button-small .icon {
    width: 14px;
    height: 14px;
}

.button-secondary {
    background: var(--btn-bg);
    color: var(--btn-fg);
}

.button-secondary:hover {
    background: var(--btn-bg-hover);
}

.button-danger {
    background: transparent;
    border-color: var(--danger);
    color: var(--danger);
}

.button-danger:hover {
    background: var(--danger-soft);
}

.button-ghost {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.button-ghost:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* ---------------------------------------------------------------------------
   Start page (signed out): hero in the app chrome, feature tiles
   ------------------------------------------------------------------------- */

.hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background:
        radial-gradient(120% 140% at 100% 0%, hsl(var(--ah) 100% 45% / 0.35), transparent 55%),
        radial-gradient(80% 120% at 0% 100%, hsl(var(--ah) 100% 40% / 0.18), transparent 60%),
        var(--chrome-bg);
    border: 1px solid var(--chrome-border);
    box-shadow: var(--shadow-lg);
    color: var(--chrome-fg);
}

/* A faint grid, like a log graph's background. */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(110deg, transparent 20%, #000 75%);
    pointer-events: none;
}

.hero-body {
    position: relative;
    padding: 44px 40px 40px;
    max-width: 640px;
}

.hero .eyebrow {
    color: hsl(var(--ah), 90%, 70%);
}

.hero h1 {
    font-size: 36px;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: #fff;
    margin-bottom: 14px;
}

.lead {
    font-size: 16px;
    color: var(--chrome-fg);
    opacity: 0.9;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 24px 0 18px;
}

.hero-actions .button:not(.button-ghost) {
    background: var(--chrome-accent);
    color: #fff;
}

.hero-actions .button:not(.button-ghost):hover {
    background: var(--chrome-accent-hover);
}

.hero-note {
    color: var(--chrome-fg-muted);
    font-size: 12px;
    max-width: 520px;
}

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.feature {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.feature h2 {
    margin: 14px 0 6px;
}

.feature p {
    color: var(--text-muted);
    font-size: 13px;
}

.feature-icon,
.dropzone-icon,
.message-icon,
.log-row-icon,
.file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--accent-soft);
    color: var(--accent-text);
}

.feature-icon .icon,
.dropzone-icon .icon,
.message-icon .icon {
    width: 20px;
    height: 20px;
}

/* ---------------------------------------------------------------------------
   Forms
   ------------------------------------------------------------------------- */

.form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.field {
    min-width: 0;
}

.field label,
.field legend {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
}

fieldset.field {
    margin: 0;
    padding: 0;
    border: 0;
}

fieldset.field legend {
    padding: 0;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.label-row label {
    margin-bottom: 0;
}

.req,
.opt {
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
    vertical-align: 1px;
}

.req {
    background: var(--accent-soft);
    color: var(--accent-text);
}

.opt {
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

input[type="text"],
input[type="url"],
textarea {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-control);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    transition: border-color var(--ease), box-shadow var(--ease);
}

input[type="text"]:hover,
input[type="url"]:hover,
textarea:hover {
    border-color: var(--neutral-500);
}

input[type="text"]:focus,
input[type="url"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

textarea {
    resize: vertical;
    min-height: 76px;
}

textarea.mono {
    font-size: 12px;
    line-height: 1.5;
}

::placeholder {
    color: var(--text-muted);
    opacity: 0.75;
}

.hint {
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

/* An <input type=file> inside a button-looking label. */
.field .file-button {
    position: relative;
    display: inline-flex;
    overflow: hidden;
    margin: 0;
    font-size: 12px;
}

.file-button input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Retention as a segmented control (radio buttons). */
.segmented {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
}

.segment {
    position: relative;
    margin: 0 !important;
}

.segment input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segment span {
    display: block;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background var(--ease), color var(--ease), box-shadow var(--ease);
}

.segment span:hover {
    color: var(--text);
}

.segment input:checked + span {
    background: var(--surface);
    color: var(--accent-text);
    box-shadow: var(--shadow-sm);
}

.segment input:focus-visible + span {
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* ---------------------------------------------------------------------------
   Drop zone
   ------------------------------------------------------------------------- */

.dropzone {
    position: relative;
    border: 2px dashed var(--border-control);
    border-radius: var(--radius-lg);
    background: var(--surface-sunken);
    transition: border-color var(--ease), background var(--ease), transform var(--ease);
}

.dropzone:hover,
.dropzone.is-over {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.dropzone.is-over {
    transform: scale(1.01);
}

.dropzone:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* The real file input covers the zone, so clicking and dropping work even
   without app.js. */
.dropzone-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.dropzone-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px;
    text-align: center;
    pointer-events: none;
}

.dropzone-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
}

.dropzone-icon .icon {
    width: 24px;
    height: 24px;
}

.dropzone-title {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
}

.dropzone-hint {
    margin: 2px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.dropzone-browse {
    color: var(--accent-text);
    font-weight: 600;
}

.dropzone.has-file {
    border-style: solid;
    border-color: var(--accent);
    background: var(--surface);
}

.dropzone.has-file .dropzone-empty {
    display: none;
}

.dropzone-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}

.dropzone.has-file .dropzone-input {
    /* Keep the input for the form, but let the clear button be clicked. */
    pointer-events: none;
}

.file-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.file-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    color: var(--text-muted);
    font-size: 12px;
}

.file-clear {
    position: relative;
    z-index: 1;
    color: var(--text-muted);
}

.file-clear:hover {
    background: var(--surface-sunken);
    color: var(--text);
}

/* The page-wide drop target app.js shows while a file is dragged in. */
.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: hsl(var(--nh) 11% 8% / 0.55);
    backdrop-filter: blur(4px);
    pointer-events: none;
    animation: fade-in 0.12s ease-out;
}

.drop-overlay-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: min(520px, 100%);
    padding: 48px 32px;
    border: 2px dashed var(--accent);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.drop-overlay-inner .icon {
    width: 36px;
    height: 36px;
    color: var(--accent-text);
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
}

/* Upload button and progress */

.upload-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.upload-progress {
    flex: 1;
    min-width: 160px;
    height: 8px;
    border-radius: var(--radius-pill);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.2s ease;
}

.error {
    color: var(--danger);
    font-weight: 600;
}

/* ---------------------------------------------------------------------------
   Log lists
   ------------------------------------------------------------------------- */

.log-list {
    list-style: none;
    margin: 0;
    padding: 6px;
}

.log-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: inherit;
    transition: background var(--ease);
}

.log-row:hover {
    background: var(--surface-sunken);
    text-decoration: none;
}

.log-row-icon {
    width: 36px;
    height: 36px;
}

.log-row-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.log-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.log-row:hover .log-title {
    color: var(--accent-text);
}

.log-meta {
    color: var(--text-muted);
    font-size: 12px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    border-radius: var(--radius-pill);
    background: var(--surface-sunken);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge .icon {
    width: 13px;
    height: 13px;
}

.empty {
    text-align: center;
    padding: 28px 20px;
}

/* ---------------------------------------------------------------------------
   Log page
   ------------------------------------------------------------------------- */

.log-card .card-body {
    padding: 28px;
}

.log-card h1 {
    font-size: 26px;
    margin-bottom: 10px;
}

.description {
    font-size: 15px;
    color: var(--text-soft);
    margin-bottom: 0;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 22px 0 24px;
}

.actions form {
    margin: 0;
}

.push-right {
    margin-left: auto !important;
}

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.tile {
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
}

.tile-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tile-label .icon {
    width: 14px;
    height: 14px;
}

.tile-value {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.tile-sub {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
}

.user {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.section h2 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.section h2 .icon {
    color: var(--accent-text);
}

.cli-dump summary {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    list-style: none;
}

.cli-dump summary::-webkit-details-marker {
    display: none;
}

.cli-dump summary h2 {
    margin: 0;
}

.cli-dump summary h2::after {
    content: '';
    width: 7px;
    height: 7px;
    margin-left: 4px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform var(--ease);
    opacity: 0.6;
}

.cli-dump[open] summary h2::after {
    transform: rotate(45deg);
}

.cli-raw {
    margin-left: auto;
    font-size: 13px;
    font-weight: 600;
}

.cli-dump pre {
    max-height: 520px;
    overflow: auto;
    margin: 14px 0 0;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--chrome-bg);
    color: var(--chrome-fg);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
}

/* Error and message pages */

.message-card .card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 44px 24px;
    text-align: center;
}

.message-card .button {
    margin-top: 8px;
}

/* ---------------------------------------------------------------------------
   Admin page
   ------------------------------------------------------------------------- */

body:has(.wide) .navbar-inner,
body:has(.wide) main,
body:has(.wide) footer {
    max-width: 1120px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat {
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-sunken);
}

.stat-label {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.stat-value {
    margin: 2px 0 6px;
    font-size: 26px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.stat-note {
    color: var(--text-muted);
    font-size: 12px;
}

progress {
    appearance: none;
    width: 100%;
    height: 8px;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--border);
    overflow: hidden;
}

progress::-webkit-progress-bar {
    background: var(--border);
    border-radius: var(--radius-pill);
}

progress::-webkit-progress-value {
    background: var(--accent);
    border-radius: var(--radius-pill);
}

progress::-moz-progress-bar {
    background: var(--accent);
    border-radius: var(--radius-pill);
}

.warning {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--warning);
    border-radius: var(--radius-sm);
    background: var(--warning-soft);
    color: var(--text);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding-top: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.table-wrap {
    overflow-x: auto;
}

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

.table th {
    text-align: left;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
    background: var(--surface-sunken);
}

.table th,
.table td {
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.table tbody tr {
    transition: background var(--ease);
}

.table tbody tr:hover {
    background: var(--surface-sunken);
}

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

.table td:first-child {
    min-width: 220px;
    overflow-wrap: anywhere;
}

.table.compact {
    width: auto;
    min-width: 320px;
}

.table.compact th {
    background: none;
}

.table.compact td,
.table.compact th {
    padding: 4px 24px 4px 0;
}

.table.compact td:first-child {
    min-width: 0;
}

.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

form.inline {
    margin: 0;
}

/* ---------------------------------------------------------------------------
   Small screens
   ------------------------------------------------------------------------- */

@media (max-width: 720px) {
    .features {
        grid-template-columns: 1fr;
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

    .hero-body {
        padding: 32px 22px 28px;
    }

    .hero h1 {
        font-size: 28px;
    }

    .push-right {
        margin-left: 0 !important;
    }
}

@media (max-width: 560px) {
    main {
        padding: 16px 12px 32px;
        gap: 14px;
    }

    .navbar-inner {
        height: 52px;
        padding: 0 12px;
    }

    .logo {
        height: 22px;
    }

    .navbar-divider,
    .navbar-title,
    .wide-only,
    .user-chip .login {
        display: none;
    }

    .user-chip {
        padding: 0 4px;
    }

    .card-body,
    .log-card .card-body {
        padding: 16px;
    }

    .card-header {
        padding: 12px 16px;
    }

    .log-card h1 {
        font-size: 21px;
    }

    .actions .button {
        flex: 1 1 auto;
    }

    .log-row .badge {
        display: none;
    }

    .segmented {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        width: 100%;
    }

    .segment span {
        padding: 6px 2px;
        text-align: center;
        font-size: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
