/* ─── Design System ─── */
:root {
    /* Palette */
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --surface-soft: #f8fafc;
    --surface-inset: #e2e8f0;

    --line: #e2e8f0;
    --line-strong: #cbd5e1;

    --text: #0f172a;
    --text-secondary: #334155;
    --muted: #64748b;
    --faint: #94a3b8;

    /* Brand */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff6ff;
    --primary-muted: #93c5fd;

    /* Semantic */
    --ok: #059669;
    --ok-soft: #ecfdf5;
    --ok-border: #a7f3d0;
    --warn: #d97706;
    --warn-soft: #fffbeb;
    --warn-border: #fde68a;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --danger-border: #fecaca;
    --info: #0284c7;
    --info-soft: #f0f9ff;
    --info-border: #bae6fd;

    /* Accent for warehouse feel */
    --accent: #f59e0b;
    --accent-soft: #fffbeb;

    /* Depth */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

    /* Shape */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --radius-full: 9999px;

    /* Layout */
    --content: 1200px;
    --nav-height: 64px;

    /* Type */
    --font: 'Inter', 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Fira Code', monospace;
}

/* ─── Reset ─── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.6;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    display: block;
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

ul, ol {
    list-style: none;
}

/* ─── Topbar ─── */
.topbar {
    background: #0f172a;
    color: #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--nav-height);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.topbar__inner {
    width: min(calc(100% - 32px), var(--content));
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand a {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #ffffff;
    white-space: nowrap;
}

.brand__icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.brand__icon svg {
    width: 18px;
    height: 18px;
    color: #ffffff;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: 24px;
    flex: 1;
}

.topnav a {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 150ms ease;
    white-space: nowrap;
}

.topnav a svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.topnav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.topnav a:hover svg {
    opacity: 1;
}

.topnav a.is-current {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-weight: 600;
}

.topnav a.is-current svg {
    opacity: 1;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    font-size: 0.85rem;
    font-weight: 500;
}

.user-pill__avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    display: grid;
    place-items: center;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: #94a3b8;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 150ms ease;
}

.btn-logout:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-logout svg {
    width: 16px;
    height: 16px;
}

/* ─── Shell ─── */
.shell {
    padding: 28px 0 48px;
    min-height: calc(100vh - var(--nav-height));
}

.shell--auth {
    min-height: 100vh;
    display: grid;
    align-items: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}

.page-frame {
    width: min(calc(100% - 32px), var(--content));
    margin: 0 auto;
    display: grid;
    gap: 24px;
}

/* ─── Page Structure ─── */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.page-head h1 {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--text);
}

.page-note {
    color: var(--muted);
    font-size: 0.92rem;
    margin-top: 4px;
}

.page-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.section-head h2 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.section-head a {
    font-size: 0.88rem;
    color: var(--primary);
    font-weight: 500;
}

.section-head a:hover {
    text-decoration: underline;
}

.section-head p {
    color: var(--muted);
    font-size: 0.88rem;
    width: 100%;
}

/* ─── Flash Messages ─── */
.flash-stack {
    display: grid;
    gap: 10px;
}

.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--radius);
    font-size: 0.92rem;
    font-weight: 500;
    border: 1px solid;
}

.flash::before {
    flex-shrink: 0;
    font-size: 1.1rem;
}

.flash--success {
    background: var(--ok-soft);
    border-color: var(--ok-border);
    color: #065f46;
}

.flash--success::before {
    content: '\2713';
    color: var(--ok);
}

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

.flash--error::before {
    content: '\2717';
    color: var(--danger);
}

.flash--info {
    background: var(--info-soft);
    border-color: var(--info-border);
    color: #075985;
}

/* ─── Cards ─── */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

/* ─── Buttons ─── */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms ease;
    white-space: nowrap;
    background: var(--surface);
    color: var(--text);
    border-color: var(--line-strong);
}

.button:hover {
    background: var(--surface-soft);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-sm);
}

.button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.button--primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.button--primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.button--ghost {
    background: transparent;
    border-color: var(--line);
    color: var(--text-secondary);
}

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

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

.button--danger:hover {
    background: #fee2e2;
    border-color: #f87171;
}

.button--ok {
    background: var(--ok-soft);
    border-color: var(--ok-border);
    color: var(--ok);
}

.button--ok:hover {
    background: #d1fae5;
    border-color: #6ee7b7;
}

.button--warn {
    background: var(--warn-soft);
    border-color: var(--warn-border);
    color: var(--warn);
}

.button--warn:hover {
    background: #fef3c7;
    border-color: #fbbf24;
}

.button--small {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: var(--radius-xs);
}

.button--block {
    width: 100%;
}

.button--icon-only {
    min-width: 44px;
    padding: 10px;
}

/* ─── Auth Card ─── */
.auth-card {
    width: min(calc(100% - 32px), 440px);
    margin: 0 auto;
    display: grid;
    gap: 24px;
}

.auth-card__intro {
    text-align: center;
    display: grid;
    gap: 10px;
}

.auth-card__intro h1 {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #ffffff;
}

.auth-card__intro p {
    color: #94a3b8;
    font-size: 0.95rem;
}

.auth-card__logo {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.auth-card__logo-icon {
    width: 56px;
    height: 56px;
    background: var(--primary);
    border-radius: 16px;
    display: grid;
    place-items: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.auth-card__logo-icon svg {
    width: 28px;
    height: 28px;
    color: #ffffff;
}

.auth-form {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow-lg);
    display: grid;
    gap: 18px;
}

/* ─── Form Fields ─── */
.field {
    display: grid;
    gap: 6px;
}

.field--grow {
    min-width: 0;
}

.field > span,
.field > label {
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 600;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 46px;
    padding: 11px 14px;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    transition: all 150ms ease;
}

.field input::placeholder,
.field textarea::placeholder {
    color: var(--faint);
}

.field textarea {
    min-height: 100px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.field input[type="file"] {
    padding: 10px 14px;
    border-style: dashed;
    background: var(--surface-soft);
    cursor: pointer;
}

.field input[type="file"]:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.form-grid {
    display: grid;
    gap: 18px;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 4px;
}

/* ─── Grid Layouts ─── */
.grid-two,
.detail-grid,
.metric-grid,
.action-strip {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

.grid-three {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
}

.stack {
    display: grid;
    gap: 16px;
}

.stack--tight {
    gap: 10px;
}

/* ─── Action Cards (Dashboard) ─── */
.action-strip {
    gap: 14px;
}

.action-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
    border-radius: var(--radius);
    border: 2px solid transparent;
    text-decoration: none;
    transition: all 200ms ease;
    box-shadow: var(--shadow);
    min-height: 88px;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.action-card--entry {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
}

.action-card--entry:hover {
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.action-card--withdraw {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #ffffff;
}

.action-card--withdraw:hover {
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.35);
}

.action-card--browse {
    background: linear-gradient(135deg, #059669, #047857);
    color: #ffffff;
}

.action-card--browse:hover {
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.35);
}

.action-card__icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.18);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.action-card__icon svg {
    width: 24px;
    height: 24px;
    color: #ffffff;
}

.action-card__body {
    flex: 1;
    display: grid;
    gap: 2px;
}

.action-card__body strong {
    font-size: 1rem;
    font-weight: 700;
}

.action-card__body span {
    font-size: 0.88rem;
    opacity: 0.85;
}

.action-card__cta {
    flex-shrink: 0;
    font-size: 1.2rem;
    opacity: 0.7;
    transition: transform 200ms ease, opacity 200ms ease;
}

.action-card:hover .action-card__cta {
    transform: translateX(3px);
    opacity: 1;
}

/* ─── Metric Cards ─── */
.metric-grid {
    gap: 14px;
}

.metric-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: grid;
    gap: 4px;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.metric-card--ok::before { background: var(--ok); }
.metric-card--warn::before { background: var(--warn); }
.metric-card--neutral::before { background: var(--muted); }
.metric-card--danger::before { background: var(--danger); }

.metric-card__label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metric-card strong {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

.metric-card--ok strong { color: var(--ok); }
.metric-card--warn strong { color: var(--warn); }
.metric-card--neutral strong { color: var(--muted); }
.metric-card--danger strong { color: var(--danger); }

.metric-card__note {
    font-size: 0.84rem;
    color: var(--faint);
}

/* ─── Filters ─── */
.filters {
    display: grid;
    gap: 14px;
    align-items: end;
}

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

/* ─── Tables ─── */
.table-wrap {
    overflow-x: auto;
    margin: -4px;
    padding: 4px;
}

.table-wrap--desktop {
    display: none;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.table th {
    padding: 10px 12px;
    text-align: left;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 2px solid var(--line);
    background: var(--surface-soft);
}

.table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    font-size: 0.92rem;
}

.table tbody tr {
    transition: background 120ms ease;
}

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

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

.table-link {
    display: grid;
    gap: 2px;
}

.table-link strong {
    color: var(--text);
    font-weight: 600;
}

.table-link span {
    color: var(--faint);
    font-size: 0.82rem;
    font-family: var(--font-mono);
}

.table td small {
    color: var(--faint);
    font-size: 0.82rem;
}

/* ─── Status Badges ─── */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid;
    white-space: nowrap;
}

.status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status--ok {
    background: var(--ok-soft);
    border-color: var(--ok-border);
    color: var(--ok);
}

.status--ok::before { background: var(--ok); }

.status--warn {
    background: var(--warn-soft);
    border-color: var(--warn-border);
    color: var(--warn);
}

.status--warn::before { background: var(--warn); }

.status--danger {
    background: var(--danger-soft);
    border-color: var(--danger-border);
    color: var(--danger);
}

.status--danger::before { background: var(--danger); }

.status--neutral {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: var(--muted);
}

.status--neutral::before { background: var(--faint); }

/* ─── Tags ─── */
.tag-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    padding: 3px 9px;
    border-radius: var(--radius-full);
    background: var(--surface-soft);
    border: 1px solid var(--line);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.chip-button {
    padding: 6px 12px;
    border: 1.5px solid var(--line);
    border-radius: var(--radius-full);
    background: var(--surface);
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 150ms ease;
}

.chip-button:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

.helper-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ─── Material Cards (Mobile) ─── */
.material-cards {
    display: grid;
    gap: 12px;
}

.material-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 150ms ease;
}

.material-card:hover {
    box-shadow: var(--shadow);
}

.material-card__head {
    display: flex;
    justify-content: space-between;
    align-items: start;
    gap: 12px;
    margin-bottom: 14px;
}

.material-card__head a {
    font-weight: 700;
    color: var(--text);
}

.material-card__head p {
    color: var(--faint);
    font-size: 0.82rem;
    font-family: var(--font-mono);
    margin-top: 3px;
}

.material-card dl {
    display: grid;
    gap: 10px;
    margin: 0 0 14px;
}

.material-card dl > div {
    display: grid;
    gap: 2px;
}

.material-card dt {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.material-card dd {
    margin: 0;
    font-weight: 600;
    font-size: 0.92rem;
}

/* ─── Detail Grid (Material Form) ─── */
.detail-grid {
    align-items: start;
}

/* ─── Media Card ─── */
.media-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    padding: 0;
}

.media-card img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    background: var(--surface-soft);
}

.media-card__empty {
    display: grid;
    place-items: center;
    aspect-ratio: 4/3;
    color: var(--faint);
    background: var(--surface-soft);
    font-size: 0.92rem;
}

/* ─── Info List ─── */
.info-list {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.info-list h2 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

.info-list dl {
    display: grid;
    gap: 14px;
    margin: 0;
}

.info-list dl > div {
    display: grid;
    gap: 3px;
}

.info-list dt {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.info-list dd {
    margin: 0;
    font-weight: 600;
}

/* ─── Timeline ─── */
.timeline {
    display: grid;
    gap: 0;
}

.timeline li {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    position: relative;
}

.timeline li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.timeline li > div:first-child strong {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
}

.timeline li p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.timeline__meta {
    text-align: right;
    display: grid;
    gap: 2px;
    flex-shrink: 0;
}

.timeline__meta span {
    color: var(--muted);
    font-size: 0.82rem;
}

.timeline__meta small {
    color: var(--faint);
    font-size: 0.8rem;
}

/* ─── Linked List ─── */
.linked-list {
    display: grid;
    gap: 0;
}

.linked-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.linked-list li:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.linked-list li a {
    font-weight: 600;
    color: var(--primary);
}

.linked-list li a:hover {
    text-decoration: underline;
}

.relation-line {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.92rem;
}

.relation-line a {
    font-weight: 600;
    color: var(--primary);
}

/* ─── Block List (Settings) ─── */
.block-list {
    display: grid;
    gap: 10px;
}

.block-item {
    display: flex;
    gap: 14px;
    align-items: stretch;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 150ms ease;
}

.block-item:hover {
    box-shadow: var(--shadow);
}

.block-item.is-dragging {
    opacity: 0.5;
    box-shadow: var(--shadow-md);
}

.block-item__drag {
    color: var(--faint);
    display: grid;
    place-items: center;
    cursor: grab;
    min-width: 24px;
    font-size: 1.1rem;
    user-select: none;
}

.block-item__drag:active {
    cursor: grabbing;
}

.block-item__body {
    flex: 1;
    display: grid;
    gap: 10px;
}

.block-item__form {
    display: grid;
    gap: 10px;
}

.block-item__form input {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1.5px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    transition: all 150ms ease;
}

.block-item__form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.block-item__meta {
    display: flex;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

/* ─── Dialogs ─── */
.dialog {
    width: min(calc(100% - 32px), 480px);
    border: none;
    border-radius: var(--radius);
    padding: 0;
    background: transparent;
    box-shadow: var(--shadow-lg);
}

.dialog::backdrop {
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

.dialog form {
    padding: 24px;
    background: var(--surface);
    border-radius: var(--radius);
    display: grid;
    gap: 16px;
}

/* ─── Empty State ─── */
.empty-state {
    padding: 24px 8px;
    color: var(--muted);
    text-align: center;
    font-size: 0.92rem;
}

/* ─── Section Card ─── */
.section-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.section-card__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: var(--surface-soft);
    border-bottom: 1px solid var(--line);
}

.section-card__header-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.section-card__header-icon svg {
    width: 18px;
    height: 18px;
}

.section-card__header-icon--blue {
    background: var(--primary-soft);
    color: var(--primary);
}

.section-card__header-icon--amber {
    background: var(--warn-soft);
    color: var(--warn);
}

.section-card__header-icon--green {
    background: var(--ok-soft);
    color: var(--ok);
}

.section-card__header-icon--red {
    background: var(--danger-soft);
    color: var(--danger);
}

.section-card__header h2 {
    font-size: 1rem;
    font-weight: 700;
}

.section-card__header p {
    color: var(--muted);
    font-size: 0.85rem;
}

.section-card__body {
    padding: 24px;
}

/* ─── Lifecycle Flow (Dashboard) ─── */
.lifecycle {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 20px 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.lifecycle__step {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.lifecycle__step--active {
    background: var(--primary-soft);
    color: var(--primary);
}

.lifecycle__step svg {
    width: 18px;
    height: 18px;
}

.lifecycle__arrow {
    flex-shrink: 0;
    color: var(--faint);
    padding: 0 4px;
    font-size: 1rem;
}

/* ─── Utility ─── */
[hidden] {
    display: none !important;
}

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

.text-small {
    font-size: 0.88rem;
}

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

/* ─── Responsive ─── */
@media (min-width: 768px) {
    .page-head {
        flex-wrap: nowrap;
    }

    .filters {
        grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(130px, 1fr)) auto;
    }

    .grid-two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .grid-three {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .action-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .metric-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .detail-grid {
        grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.95fr);
    }

    .block-item__form {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .material-cards {
        display: none;
    }

    .table-wrap--desktop {
        display: block;
    }
}

@media (max-width: 767px) {
    :root {
        --nav-height: auto;
    }

    .topbar {
        height: auto;
    }

    .topbar__inner {
        flex-wrap: wrap;
        padding: 12px 0;
        gap: 10px;
    }

    .topnav {
        width: 100%;
        margin-left: 0;
        overflow-x: auto;
        gap: 2px;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
    }

    .topnav a {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .topnav a .nav-label {
        display: none;
    }

    .topbar__actions {
        width: 100%;
        justify-content: space-between;
        order: -1;
    }

    .action-card {
        min-height: auto;
        padding: 16px 18px;
    }

    .action-card__icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }

    .action-card__icon svg {
        width: 20px;
        height: 20px;
    }

    .lifecycle {
        padding: 16px;
    }

    .lifecycle__step {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .card {
        padding: 18px;
    }
}
