/* ==========================================================================
   Sauvegardes — interface
   ========================================================================== */

:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --ink: #0f172a;
    --ink-soft: #334155;
    --muted: #64748b;
    --muted-light: #94a3b8;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --accent: #4f46e5;
    --accent-strong: #4338ca;
    --accent-soft: #eef2ff;
    --success: #047857;
    --success-soft: #ecfdf5;
    --danger: #b91c1c;
    --danger-soft: #fef2f2;
    --warning: #b45309;
    --warning-soft: #fffbeb;
    --radius-sm: 9px;
    --radius: 14px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --shadow: 0 10px 30px -18px rgba(15, 23, 42, 0.22);
    --shadow-lg: 0 30px 80px -30px rgba(15, 23, 42, 0.35);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

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

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

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

a:hover {
    color: var(--accent-strong);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2,
h3 {
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--ink);
}

h1 {
    font-size: clamp(1.75rem, 1.3rem + 1.2vw, 2.3rem);
    margin-bottom: 0.45rem;
}

h2 {
    font-size: 1.12rem;
    margin-bottom: 0.35rem;
}

h3 {
    font-size: 1.02rem;
    margin-bottom: 0.35rem;
}

code {
    font-family: var(--mono);
    font-size: 0.86em;
    background: #eef2f7;
    color: #1e293b;
    padding: 0.14em 0.4em;
    border-radius: 5px;
    overflow-wrap: anywhere;
}

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

.icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    display: inline-block;
    vertical-align: -0.18em;
}

.icon-xs {
    width: 15px;
    height: 15px;
}

.icon-sm {
    width: 17px;
    height: 17px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.86);
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
    backdrop-filter: saturate(180%) blur(16px);
}

.topbar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0.7rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--ink);
    flex: 0 0 auto;
}

.brand:hover {
    color: var(--ink);
}

.brand-mark {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border-radius: 11px;
    color: #fff;
    background: linear-gradient(145deg, #6366f1, #4338ca);
    box-shadow: 0 8px 20px -8px rgba(67, 56, 202, 0.7);
}

.brand-mark .icon {
    width: 21px;
    height: 21px;
}

.brand-mark-lg {
    width: 54px;
    height: 54px;
    border-radius: 16px;
}

.brand-mark-lg .icon {
    width: 28px;
    height: 28px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.12;
}

.brand-text strong {
    font-size: 0.98rem;
    letter-spacing: -0.01em;
}

.brand-text small {
    color: var(--muted);
    font-size: 0.72rem;
    margin-top: 2px;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.22rem;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
}

.main-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.42rem 0.85rem;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 600;
    transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.main-nav a:hover {
    color: var(--ink);
}

.main-nav a.is-active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-weight: 700;
    font-size: 0.85rem;
}

.user-name {
    font-size: 0.86rem;
    font-weight: 600;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-form {
    margin: 0;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.page {
    max-width: 1240px;
    margin: 0 auto;
    padding: 2.1rem 1.5rem 3rem;
}

.site-footer {
    text-align: center;
    color: var(--muted-light);
    font-size: 0.76rem;
    padding: 1rem 1.5rem 2rem;
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.page-head-copy p {
    color: var(--muted);
    margin-bottom: 0;
    max-width: 640px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--accent-strong);
    margin-bottom: 0.55rem;
}

/* --------------------------------------------------------------------------
   Buttons and forms
   -------------------------------------------------------------------------- */

.btn {
    --btn-bg: var(--surface);
    --btn-color: var(--ink-soft);
    --btn-border: var(--line);
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 40px;
    padding: 0.5rem 0.95rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--btn-border);
    background: var(--btn-bg);
    color: var(--btn-color);
    font: inherit;
    font-size: 0.87rem;
    font-weight: 600;
    line-height: 1.15;
    cursor: pointer;
    text-decoration: none;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 100ms ease, box-shadow 150ms ease;
}

.btn:hover {
    color: var(--btn-color);
    border-color: var(--line-strong);
    background: var(--surface-soft);
}

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

.btn:focus-visible,
input:focus-visible,
a:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.28);
    outline-offset: 2px;
}

.btn[disabled] {
    opacity: 0.6;
    pointer-events: none;
}

.btn-primary {
    --btn-bg: linear-gradient(145deg, #5b52ea, #4338ca);
    --btn-color: #fff;
    --btn-border: transparent;
    box-shadow: 0 10px 22px -12px rgba(67, 56, 202, 0.75);
}

.btn-primary:hover {
    --btn-bg: linear-gradient(145deg, #5148e3, #3730a3);
    --btn-color: #fff;
    border-color: transparent;
}

.btn-secondary {
    --btn-bg: #f1f5ff;
    --btn-color: var(--accent-strong);
    --btn-border: #dbe3ff;
}

.btn-secondary:hover {
    --btn-bg: #e8edff;
    --btn-color: var(--accent-strong);
    border-color: #c7d2fe;
}

.btn-ghost {
    --btn-bg: transparent;
    --btn-color: var(--muted);
    --btn-border: transparent;
}

.btn-ghost:hover {
    --btn-bg: var(--surface-soft);
    --btn-color: var(--ink);
    border-color: var(--line);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    min-height: 34px;
    padding: 0.38rem 0.7rem;
    font-size: 0.8rem;
}

.btn-icon {
    width: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 9px;
}

.btn-danger-ghost:hover {
    --btn-bg: var(--danger-soft);
    --btn-color: var(--danger);
    border-color: #fecaca;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.38rem;
}

.field label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ink-soft);
}

.field small {
    color: var(--muted);
    font-size: 0.76rem;
}

input[type="text"],
input[type="password"],
input[type="search"] {
    width: 100%;
    min-height: 44px;
    padding: 0.62rem 0.8rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.92rem;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

input::placeholder {
    color: var(--muted-light);
}

input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    outline: none;
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    margin-top: 1rem;
}

.form-status {
    min-height: 1.35rem;
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
    color: var(--muted);
}

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

.form-status.is-success {
    color: var(--success);
    font-weight: 600;
}

.btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.is-loading::after {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    animation: spin 700ms linear infinite;
}

.btn-secondary.is-loading::after,
.btn-ghost.is-loading::after {
    border-color: rgba(79, 70, 229, 0.25);
    border-top-color: var(--accent);
}

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

/* --------------------------------------------------------------------------
   Auth pages
   -------------------------------------------------------------------------- */

body.auth-page {
    background:
        radial-gradient(1000px 600px at 15% -10%, rgba(99, 102, 241, 0.22), transparent 60%),
        radial-gradient(900px 600px at 110% 20%, rgba(14, 165, 233, 0.16), transparent 55%),
        linear-gradient(160deg, #0b1220 0%, #111a2e 55%, #17233c 100%);
    min-height: 100vh;
}

.auth-main {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.25rem;
}

.auth-shell {
    width: 100%;
    display: flex;
    justify-content: center;
}

.auth-card {
    width: 100%;
    max-width: 430px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.2rem 2rem 1.8rem;
}

.auth-card-wide {
    max-width: 540px;
}

.auth-brand {
    margin-bottom: 1.25rem;
}

.auth-card h1 {
    margin-bottom: 0.5rem;
}

.auth-lead {
    color: var(--muted);
    font-size: 0.92rem;
    margin-bottom: 1.5rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form .btn-block {
    min-height: 46px;
}

.auth-points {
    list-style: none;
    margin: 1.5rem 0 0;
    padding: 1.1rem 0 0;
    border-top: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.auth-points li {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.auth-points .icon {
    color: var(--success);
}

.code-block {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 0.9rem 1rem;
    font-family: var(--mono);
    font-size: 0.78rem;
    overflow-x: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   Cards, stats
   -------------------------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.35rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.1rem;
}

.stat-card {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.05rem 1.15rem;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: inline-grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent-strong);
    flex: 0 0 auto;
}

.stat-icon .icon {
    width: 20px;
    height: 20px;
}

.stat-label {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    display: block;
    font-size: 1.55rem;
    letter-spacing: -0.03em;
    line-height: 1.25;
}

.stat-value-sm {
    font-size: 1.18rem;
    line-height: 1.55;
}

.stat-meta {
    display: block;
    color: var(--muted-light);
    font-size: 0.76rem;
}

/* --------------------------------------------------------------------------
   Workspace
   -------------------------------------------------------------------------- */

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1.1rem;
    align-items: start;
}

.two-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 1.1rem;
    align-items: start;
}

.browser-card {
    padding: 0;
    overflow: hidden;
}

.browser-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fbfcff, #ffffff);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-wrap: wrap;
    min-width: 0;
    font-size: 0.84rem;
}

.breadcrumb a {
    color: var(--muted);
    font-weight: 600;
    padding: 0.18rem 0.25rem;
    border-radius: 5px;
}

.breadcrumb a:hover {
    background: var(--surface-soft);
    color: var(--ink);
}

.breadcrumb-sep {
    color: var(--muted-light);
    display: inline-flex;
}

.breadcrumb-current {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 700;
    color: var(--ink);
    padding: 0.18rem 0.25rem;
}

.search-form {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 1 280px;
}

.search-form input[type="search"] {
    min-height: 38px;
    padding-left: 2.1rem;
    padding-right: 1.9rem;
    font-size: 0.84rem;
    background: var(--surface-soft);
    border-color: var(--line);
}

.search-icon {
    position: absolute;
    left: 0.7rem;
    color: var(--muted-light);
    display: inline-flex;
    pointer-events: none;
}

.search-clear {
    position: absolute;
    right: 0.55rem;
    width: 22px;
    height: 22px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1;
}

.search-clear:hover {
    background: var(--line);
    color: var(--ink);
}

.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.7rem;
    padding: 1rem 1.1rem 0.2rem;
}

.folder-tile {
    display: grid;
    grid-template-columns: 34px 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.6rem;
    align-items: center;
    padding: 0.7rem;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface);
    color: var(--ink);
    transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.folder-tile:hover {
    border-color: #c7d2fe;
    background: #f8faff;
    transform: translateY(-1px);
    color: var(--ink);
}

.folder-tile-icon {
    grid-row: 1 / span 2;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: inline-grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.folder-tile-name {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-tile-meta {
    font-size: 0.73rem;
    color: var(--muted-light);
}

/* --------------------------------------------------------------------------
   File table
   -------------------------------------------------------------------------- */

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

.file-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

.file-table th {
    text-align: left;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    font-weight: 700;
    padding: 0.7rem 1.1rem;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.file-table td {
    padding: 0.8rem 1.1rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

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

.file-table tbody tr:hover {
    background: #fbfcff;
}

.file-cell {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    min-width: 0;
}

.file-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
}

.file-icon-file {
    background: #f1f5f9;
    color: #475569;
}

.file-icon-folder {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

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

.file-name {
    font-weight: 600;
    color: var(--ink);
    overflow-wrap: anywhere;
}

a.file-name:hover {
    color: var(--accent-strong);
}

.file-meta {
    font-size: 0.72rem;
    color: var(--muted-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.col-size,
.col-date {
    color: var(--muted);
    white-space: nowrap;
}

.col-actions {
    width: 1%;
    white-space: nowrap;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    justify-content: flex-end;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.1rem;
    border-top: 1px solid var(--line);
    background: var(--surface-soft);
}

/* --------------------------------------------------------------------------
   Empty states, alerts, sidebar
   -------------------------------------------------------------------------- */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-icon {
    width: 58px;
    height: 58px;
    margin: 0 auto 0.9rem;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.empty-icon .icon {
    width: 27px;
    height: 27px;
}

.empty-state h3 {
    margin-bottom: 0.25rem;
}

.empty-state p {
    color: var(--muted);
    font-size: 0.87rem;
    margin-bottom: 0;
}

.setup-card {
    max-width: 760px;
}

.setup-card .empty-icon {
    margin-left: 0;
}

.config-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin: 1.2rem 0;
}

.config-list div {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-soft);
}

.config-list span {
    color: var(--muted);
    font-size: 0.8rem;
}

.alert {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.95rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    margin-bottom: 1.1rem;
    font-size: 0.88rem;
}

.alert p {
    margin: 0.2rem 0 0;
    color: var(--muted);
}

.alert-error {
    background: var(--danger-soft);
    border-color: #fecaca;
    color: var(--danger);
}

.alert-error .icon {
    color: var(--danger);
}

.alert-error a {
    display: inline-block;
    margin-top: 0.4rem;
    font-weight: 600;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.side-card {
    padding: 1.1rem;
}

.side-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.86rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 0.8rem;
}

.quota-value {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.quota-meta {
    color: var(--muted);
    font-size: 0.78rem;
    margin: 0.1rem 0 0.6rem;
}

.quota-bar {
    width: 100%;
    height: 8px;
    appearance: none;
    border: 0;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
}

.quota-bar::-webkit-progress-bar {
    background: var(--line);
    border-radius: 999px;
}

.quota-bar::-webkit-progress-value {
    background: linear-gradient(90deg, #6366f1, #4338ca);
    border-radius: 999px;
}

.quota-bar::-moz-progress-bar {
    background: linear-gradient(90deg, #6366f1, #4338ca);
    border-radius: 999px;
}

.activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.activity-list li {
    display: flex;
    gap: 0.55rem;
    align-items: flex-start;
}

.activity-icon {
    width: 27px;
    height: 27px;
    border-radius: 8px;
    display: inline-grid;
    place-items: center;
    background: var(--success-soft);
    color: var(--success);
    flex: 0 0 auto;
}

.activity-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.activity-name {
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-meta {
    font-size: 0.73rem;
    color: var(--muted-light);
}

.side-empty {
    color: var(--muted-light);
    font-size: 0.82rem;
    margin: 0;
}

.side-note {
    background: linear-gradient(150deg, #f8faff, #eef2ff);
    border-color: #e0e7ff;
    color: var(--ink-soft);
    font-size: 0.82rem;
}

.side-note .icon {
    color: var(--accent);
    margin-bottom: 0.45rem;
}

.side-note p {
    margin: 0;
}

/* --------------------------------------------------------------------------
   Passkeys
   -------------------------------------------------------------------------- */

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: 0.4rem;
}

.card-head p {
    margin-bottom: 0;
    font-size: 0.84rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.badge-neutral {
    background: var(--surface-soft);
    color: var(--muted);
    border: 1px solid var(--line);
}

.passkey-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.passkey-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.95rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.passkey-item:last-child {
    border-bottom: 0;
}

.passkey-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: inline-grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent-strong);
    flex: 0 0 auto;
}

.passkey-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.passkey-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.passkey-meta {
    font-size: 0.78rem;
    color: var(--muted);
}

.passkey-aaguid {
    font-family: var(--mono);
    font-size: 0.68rem;
    color: var(--muted-light);
    margin-top: 0.1rem;
}

.passkey-delete {
    margin: 0;
}

/* --------------------------------------------------------------------------
   Flash messages
   -------------------------------------------------------------------------- */

.flash-stack {
    max-width: 1240px;
    margin: 0 auto 1rem;
}

.flash-message {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    font-size: 0.86rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.flash-message.success {
    background: var(--success-soft);
    border-color: #a7f3d0;
    color: var(--success);
}

.flash-message.error {
    background: var(--danger-soft);
    border-color: #fecaca;
    color: var(--danger);
}

.flash-message.warning {
    background: var(--warning-soft);
    border-color: #fde68a;
    color: var(--warning);
}

.flash-message.info {
    background: var(--accent-soft);
    border-color: #c7d2fe;
    color: var(--accent-strong);
}

/* --------------------------------------------------------------------------
   Deployments
   -------------------------------------------------------------------------- */

[hidden] {
    display: none !important;
}

select {
    width: 100%;
    min-height: 44px;
    padding: 0.62rem 2.1rem 0.62rem 0.8rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background-color: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.92rem;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
        linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
}

select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    outline: none;
}

textarea {
    width: 100%;
    min-height: 120px;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--mono);
    font-size: 0.85rem;
    line-height: 1.5;
    resize: vertical;
}

textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    outline: none;
}

.deploy-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 1.1rem;
    align-items: start;
}

.deploy-main {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
    min-width: 0;
}

.deploy-form-card .card-head {
    margin-bottom: 1rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem;
}

.deploy-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.7rem;
    margin-top: 1rem;
}

.checkbox-field {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
    cursor: pointer;
}

.checkbox-field input {
    width: 18px;
    height: 18px;
    margin-top: 0.15rem;
    accent-color: var(--accent);
    flex: 0 0 auto;
}

.checkbox-field span {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.checkbox-field strong {
    font-size: 0.84rem;
    color: var(--ink);
}

.checkbox-field small {
    color: var(--muted);
    font-size: 0.76rem;
}

.checkbox-field:has(input:checked) {
    border-color: #c7d2fe;
    background: #f5f7ff;
}

.deploy-submit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.deploy-submit .muted {
    font-size: 0.78rem;
}

.jobs-card {
    padding-bottom: 0.6rem;
}

.job-list {
    list-style: none;
    margin: 0.4rem 0 0;
    padding: 0;
}

.job-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 0;
    border-bottom: 1px solid #f1f5f9;
}

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

.job-main {
    min-width: 0;
    flex: 1 1 auto;
}

.job-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.job-title {
    font-weight: 700;
    color: var(--ink);
}

.job-id {
    color: var(--muted-light);
    font-size: 0.75rem;
    font-family: var(--mono);
}

.job-message {
    margin: 0.3rem 0 0;
    font-size: 0.83rem;
    color: var(--ink-soft);
    overflow-wrap: anywhere;
}

.job-progress-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: 0.5rem;
}

.job-progress {
    flex: 1 1 auto;
    height: 8px;
    appearance: none;
    border: none;
    border-radius: 999px;
    background: #eef2f7;
    overflow: hidden;
}

.job-progress::-webkit-progress-bar {
    background: #eef2f7;
    border-radius: 999px;
}

.job-progress::-webkit-progress-value {
    background: linear-gradient(90deg, #6366f1, #4338ca);
    border-radius: 999px;
}

.job-progress::-moz-progress-bar {
    background: linear-gradient(90deg, #6366f1, #4338ca);
    border-radius: 999px;
}

.job-progress-lg {
    height: 12px;
    margin: 0.7rem 0 0.6rem;
}

.job-percent {
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink-soft);
    min-width: 3.2rem;
    text-align: right;
}

.job-meta {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: var(--muted-light);
}

.job-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 0 0 auto;
}

.badge-success {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid #a7f3d0;
}

.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.badge-warning {
    background: var(--warning-soft);
    color: var(--warning);
    border: 1px solid #fde68a;
}

.badge-accent {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border: 1px solid #c7d2fe;
}

.alert-warning {
    background: var(--warning-soft);
    border: 1px solid #fde68a;
    color: #78350f;
}

.alert-warning .icon {
    color: var(--warning);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--muted);
}

.back-link:hover {
    color: var(--ink);
}

.page-head h1 .badge {
    vertical-align: middle;
    margin-left: 0.45rem;
    font-size: 0.72rem;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.deploy-progress-card {
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(79, 70, 229, 0.08), transparent 55%),
        var(--surface);
}

.deploy-progress-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.deploy-progress-head h2 {
    margin: 0.1rem 0 0;
    font-size: 2rem;
}

.deploy-state {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.deploy-message {
    margin: 0.35rem 0 0;
    color: var(--ink-soft);
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.deploy-bytes {
    margin: 0.25rem 0 0;
    font-family: var(--mono);
    font-size: 0.78rem;
}

.deploy-log {
    margin: 0.6rem 0 0;
    padding: 0.9rem 1rem;
    max-height: 420px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #0f172a;
    color: #e2e8f0;
    font-family: var(--mono);
    font-size: 0.78rem;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.detail-list {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.45rem 0.8rem;
    margin: 0.8rem 0 0;
    font-size: 0.82rem;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 600;
}

.detail-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.mono {
    font-family: var(--mono);
    font-size: 0.78rem;
}

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

.plain-list {
    margin: 0.7rem 0 0;
    padding-left: 1.1rem;
    color: var(--ink-soft);
    font-size: 0.84rem;
}

.plain-list li {
    margin-bottom: 0.45rem;
}

.deploy-side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1040px) {
    .workspace-grid,
    .two-column,
    .deploy-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .sidebar {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

@media (max-width: 760px) {
    .topbar-inner {
        gap: 0.75rem;
        padding: 0.6rem 1rem;
        flex-wrap: wrap;
    }

    .brand-text small,
    .user-name {
        display: none;
    }

    .main-nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    .topbar-user {
        gap: 0.35rem;
    }

    .page {
        padding: 1.5rem 1rem 2rem;
    }

    .page-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.9rem;
    }

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

    .browser-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-form {
        flex-basis: auto;
    }

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

    .col-size,
    .col-date {
        display: none;
    }

    .file-table th,
    .file-table td {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .row-actions .btn span {
        display: none;
    }

    .row-actions .btn {
        width: 34px;
        padding: 0;
    }

    .pagination {
        flex-direction: column;
        align-items: stretch;
    }

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

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

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