:root {
    color-scheme: dark;
    --background: 240 10% 3.9%;
    --foreground: 0 0% 98%;
    --card: 240 10% 3.9%;
    --card-foreground: 0 0% 98%;
    --popover: 240 10% 3.9%;
    --popover-foreground: 0 0% 98%;
    --primary: 0 0% 98%;
    --primary-foreground: 240 5.9% 10%;
    --secondary: 240 3.7% 15.9%;
    --secondary-foreground: 0 0% 98%;
    --muted: 240 3.7% 15.9%;
    --muted-foreground: 240 5% 64.9%;
    --accent: 240 3.7% 15.9%;
    --accent-foreground: 0 0% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 0 0% 98%;
    --border: 240 3.7% 15.9%;
    --input: 240 3.7% 15.9%;
    --ring: 240 4.9% 83.9%;
    --radius: 0.5rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border-color: hsl(var(--border));
}

body {
    min-height: 100vh;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body.modal-open {
    overflow: hidden;
}

body.nav-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color 150ms ease;
}

a:hover {
    color: hsl(var(--foreground));
}

textarea,
input,
select,
button {
    font: inherit;
    border: none;
    outline: none;
    background: none;
}

/* Base Shell */
.shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    border-right: 1px solid hsl(var(--border));
    background-color: hsl(var(--background));
}

.brand-block {
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.sidebar-mobile-head,
.mobile-topbar,
.sidebar-backdrop {
    display: none;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: hsl(var(--foreground));
}

.brand-logo {
    display: block;
    width: 1.75rem;
    height: 1.75rem;
    flex: 0 0 1.75rem;
}

.brand-text {
    display: block;
    line-height: 1;
}

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

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: calc(var(--radius) - 2px);
    transition: background-color 150ms ease, color 150ms ease;
}

.nav-link:hover {
    color: hsl(var(--accent-foreground));
    background-color: hsl(var(--accent));
}

.nav-link.is-active {
    color: hsl(var(--foreground));
    background-color: hsl(var(--accent));
}

.nav-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    flex: 0 0 1rem;
    color: currentColor;
    opacity: 0.92;
}

.nav-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.nav-section {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding-left: 0.75rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
    font-weight: 600;
}

.sidebar-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0.5rem 0;
    font-size: 0.875rem;
}

.profile-name {
    color: hsl(var(--foreground));
    font-weight: 500;
    font-size: 0.875rem;
}

.muted {
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
}

.main {
    padding: 2.5rem 3rem;
    max-width: 1200px;
    min-width: 0;
}

.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;
}

/* Headings */
.page-header {
    margin-bottom: 3rem;
}

.page-header h1 {
    font-size: 1.875rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: hsl(var(--foreground));
}

.section-heading {
    margin-bottom: 1.5rem;
}

.section-heading h2 {
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: hsl(var(--foreground));
}

/* Metrics and Cards */
.metric-grid,
.grid-two {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

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

.grid-two {
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}

.metric,
.section-card,
.auth-panel {
    border: 1px solid hsl(var(--border));
    background-color: hsl(var(--card));
    color: hsl(var(--card-foreground));
    border-radius: var(--radius);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.metric {
    padding: 1.75rem;
}

.metric span {
    display: block;
    color: hsl(var(--muted-foreground));
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.metric strong {
    font-size: 1.5rem;
    font-weight: 700;
    color: hsl(var(--foreground));
}

.section-card,
.auth-panel {
    padding: 2rem;
}

.section-card-narrow {
    max-width: 32rem;
}

/* Forms & Inputs */
.stack-form,
.revision-list,
.flash-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

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

.field span {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
}

.inline-form,
.action-stack {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.action-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.action-group-start {
    justify-content: flex-start;
}

input,
select,
textarea {
    display: flex;
    width: 100%;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    transition: border-color 150ms, box-shadow 150ms;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    border-color: hsl(var(--ring));
    box-shadow: 0 0 0 1px hsl(var(--ring));
}

input::placeholder,
textarea::placeholder {
    color: hsl(var(--muted-foreground));
}

textarea {
    font-family: inherit;
    min-height: 80px;
}

.button,
.button-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    height: 2.5rem;
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease;
    white-space: nowrap;
}

.button {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.button:hover {
    background-color: hsl(var(--primary) / 0.9);
}

.button-ghost {
    background-color: transparent;
    color: hsl(var(--foreground));
    border: 1px solid transparent;
}

.button-ghost:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.button-outline {
    background-color: transparent;
    color: hsl(var(--foreground));
    border: 1px solid hsl(var(--input));
}

.button-outline:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.button-danger {
    border-color: hsl(var(--destructive) / 0.45);
    color: hsl(var(--destructive-foreground));
    background-color: hsl(var(--destructive) / 0.16);
}

.button-danger:hover {
    background-color: hsl(var(--destructive) / 0.28);
    color: hsl(var(--destructive-foreground));
}

/* Tables & Lists */
.table-wrap {
    overflow-x: auto;
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
}

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

.table th,
.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid hsl(var(--border));
    text-align: left;
    vertical-align: middle;
}

.table th {
    color: hsl(var(--muted-foreground));
    font-weight: 500;
    height: 2.5rem;
}

.table tr:hover td {
    background-color: hsl(var(--muted) / 0.5);
}

.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8em;
}

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

.list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 0;
    border-bottom: 1px solid hsl(var(--border));
    font-size: 0.875rem;
}

.list-row:last-child {
    border-bottom: none;
}

.detail-row,
.revision-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid hsl(var(--border));
    font-size: 0.875rem;
}

.detail-row:last-child,
.revision-item:last-child {
    border-bottom: none;
}

/* Auth / Compact */
.auth-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
}

.auth-shell {
    width: 100%;
    max-width: 400px;
    padding: 1.5rem;
}

.auth-brand {
    margin-bottom: 2rem;
    text-align: center;
}

.auth-brand .brand {
    justify-content: center;
}

.auth-brand .brand {
    font-size: 1.5rem;
}

.auth-brand .brand-logo {
    width: 2.5rem;
    height: 2.5rem;
    flex-basis: 2.5rem;
}

.auth-meta {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.auth-meta a {
    color: hsl(var(--foreground));
}

.auth-meta a:hover {
    text-decoration: underline;
}

.flash {
    padding: 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: calc(var(--radius) - 2px);
    margin-bottom: 1.5rem;
    border: 1px solid hsl(var(--border));
}

.flash-success {
    background-color: hsl(var(--primary) / 0.1);
    color: hsl(var(--foreground));
    border-color: hsl(var(--primary) / 0.2);
}

.flash-error {
    background-color: hsl(var(--destructive) / 0.1);
    color: hsl(var(--destructive));
    border-color: hsl(var(--destructive) / 0.2);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid hsl(var(--border));
        padding: 1rem;
    }

    .main {
        padding: 1.5rem;
    }
}

/* Simplified Workspace Pass */
body {
    background:
        radial-gradient(circle at top left, rgba(54, 108, 173, 0.12), transparent 28rem),
        hsl(var(--background));
}

.shell {
    grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1.25rem 1rem;
    background-color: rgba(7, 8, 12, 0.96);
    backdrop-filter: blur(10px);
}

.brand-block {
    margin-bottom: 1.5rem;
    padding: 0.25rem 0.5rem 1rem;
}

.brand {
    gap: 0.65rem;
}

.nav {
    gap: 0.2rem;
}

.nav-link {
    padding: 0.7rem 0.85rem;
    border-radius: 0.85rem;
    font-size: 0.92rem;
}

.nav-link.is-active {
    background-color: rgba(255, 255, 255, 0.12);
}

.nav-section {
    margin-top: 1.1rem;
    margin-bottom: 0.35rem;
    padding-left: 0.85rem;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sidebar-footer {
    align-items: flex-end;
    gap: 0.75rem;
    padding: 1rem 0.5rem 0;
}

.main {
    width: 100%;
    max-width: none;
    padding: 2rem 2.5rem 3rem;
}

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

.page-header h1 {
    font-size: 2rem;
}

.page-note {
    margin-top: 0.35rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.92rem;
}

.status-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.9rem 1rem;
    border: 1px solid rgba(255, 196, 87, 0.2);
    border-radius: 0.9rem;
    background-color: rgba(255, 196, 87, 0.08);
    color: hsl(var(--foreground));
    font-size: 0.9rem;
}

.status-banner strong {
    font-size: 0.88rem;
}

.status-banner span {
    color: hsl(var(--muted-foreground));
}

.confirm-modal[hidden] {
    display: none;
}

.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.confirm-modal-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(5, 6, 10, 0.76);
    backdrop-filter: blur(4px);
}

.confirm-modal-card {
    position: relative;
    width: min(100%, 28rem);
    padding: 1.35rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(17, 18, 27, 0.98), rgba(11, 12, 18, 0.98));
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

.confirm-modal-copy {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.confirm-modal-copy h2 {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.confirm-modal-copy p {
    color: hsl(var(--muted-foreground));
    font-size: 0.92rem;
}

.confirm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-top: 1.2rem;
    flex-wrap: wrap;
}

.section-card,
.auth-panel {
    border-radius: 1rem;
    background: linear-gradient(180deg, rgba(15, 16, 23, 0.96), rgba(11, 12, 18, 0.96));
    box-shadow: none;
}

.section-card {
    padding: 1.5rem;
}

.section-card-narrow {
    max-width: 34rem;
}

.section-heading {
    margin-bottom: 1rem;
}

.section-heading-spread {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.section-heading h2 {
    font-size: 1.05rem;
}

.section-count {
    display: inline-flex;
    min-width: 1.9rem;
    height: 1.9rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.06);
    color: hsl(var(--muted-foreground));
    font-size: 0.8rem;
    font-weight: 600;
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.9rem;
    margin-bottom: 1.5rem;
}

.metric-strip-compact {
    margin-bottom: 0;
}

.compact-section {
    margin-bottom: 1.5rem;
}

.metric {
    padding: 1rem 1.1rem;
    border-radius: 0.95rem;
    background: rgba(255, 255, 255, 0.03);
}

.metric span {
    margin-bottom: 0.4rem;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.metric strong {
    font-size: 1.3rem;
}

.panel-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}

.workspace-layout {
    display: grid;
    grid-template-columns: minmax(18rem, 22rem) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.workspace-layout-single {
    grid-template-columns: minmax(0, 1fr);
}

.workspace-side {
    position: sticky;
    top: 1.5rem;
}

.workspace-main {
    min-width: 0;
}

.stack-form,
.revision-list,
.flash-stack {
    gap: 1rem;
}

.mode-switch {
    display: inline-flex;
    gap: 0.35rem;
    padding: 0.3rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.95rem;
    background-color: rgba(255, 255, 255, 0.03);
}

.mode-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 7.5rem;
    height: 2.4rem;
    padding: 0 0.95rem;
    border-radius: 0.75rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.84rem;
    font-weight: 600;
    transition: background-color 150ms ease, color 150ms ease;
}

.mode-button:hover {
    color: hsl(var(--foreground));
    background-color: rgba(255, 255, 255, 0.05);
}

.mode-button.is-active {
    color: hsl(var(--foreground));
    background-color: rgba(255, 255, 255, 0.09);
}

.field span {
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: hsl(var(--muted-foreground));
}

.field-tight {
    gap: 0.35rem;
}

input,
select,
textarea {
    border-radius: 0.8rem;
    padding: 0.7rem 0.9rem;
    background-color: rgba(255, 255, 255, 0.02);
}

textarea {
    min-height: 14rem;
    resize: vertical;
}

input[type="file"] {
    padding: 0.85rem 0.9rem;
}

input[type="file"]::file-selector-button {
    margin-right: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.7rem;
    background-color: rgba(255, 255, 255, 0.06);
    color: hsl(var(--foreground));
    padding: 0.55rem 0.85rem;
    cursor: pointer;
}

.editor-main textarea {
    min-height: 30rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.button,
.button-ghost {
    height: 2.6rem;
    border-radius: 0.8rem;
}

.button-ghost,
.button-outline {
    background-color: rgba(255, 255, 255, 0.03);
}

.button-ghost:hover,
.button-outline:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.button-danger {
    background-color: rgba(113, 21, 21, 0.22);
}

button:disabled,
.button:disabled,
.button-ghost:disabled,
.button-outline:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.table-wrap {
    margin: 0;
    padding: 0;
}

.record-list,
.user-list {
    display: flex;
    flex-direction: column;
}

.record-row,
.user-row {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.record-row:first-child,
.user-row:first-child {
    border-top: none;
    padding-top: 0;
}

.record-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem 0;
}

.record-row-wide {
    grid-template-columns: minmax(0, 1fr) minmax(13rem, 18rem) auto;
}

.record-main {
    min-width: 0;
}

.record-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem;
    font-size: 0.98rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.record-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.45rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.06);
    color: hsl(var(--muted-foreground));
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.record-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 0.35rem;
    color: hsl(var(--muted-foreground));
    font-size: 0.83rem;
}

.record-subtle {
    margin-top: 0.45rem;
    color: hsl(var(--muted-foreground));
}

.record-field,
.record-end {
    color: hsl(var(--muted-foreground));
    font-size: 0.84rem;
}

.record-label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.record-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.empty-state {
    padding: 0.4rem 0 0.2rem;
}

.list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    width: 100%;
}

.search-form input[type="search"] {
    min-width: min(22rem, 100%);
    flex: 1 1 18rem;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-wrap: wrap;
}

.pagination-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.library-divider {
    height: 1px;
    margin: 1.4rem 0;
    background-color: rgba(255, 255, 255, 0.08);
}

.create-modal[hidden] {
    display: none;
}

.create-modal {
    position: fixed;
    inset: 0;
    z-index: 950;
    display: grid;
    place-items: center;
    padding: 1.5rem;
}

.create-modal-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(5, 6, 10, 0.76);
    backdrop-filter: blur(4px);
}

.create-modal-card {
    position: relative;
    width: min(100%, 42rem);
    max-height: calc(100vh - 3rem);
    overflow: auto;
}

.sharing-modal-card {
    width: min(100%, 50rem);
}

.sharing-modal-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(18rem, 21rem);
    gap: 1.5rem;
    align-items: start;
}

.editor-main {
    min-width: 0;
}

.editor-side {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 0.25rem;
}

.editor-toolbar-copy {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 0;
}

.editor-toolbar-note {
    color: hsl(var(--muted-foreground));
    font-size: 0.84rem;
}

.editor-field textarea {
    min-height: 34rem;
}

.meta-card .detail-row {
    padding: 0.65rem 0;
}

.detail-value-wrap {
    max-width: 100%;
    overflow-wrap: anywhere;
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.user-row {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(12rem, 1fr) minmax(7rem, 0.7fr) minmax(8rem, 0.8fr) minmax(11rem, 1fr) auto;
    gap: 1rem;
    align-items: end;
    padding: 1rem 0;
}

.user-summary strong {
    display: block;
    font-size: 0.98rem;
}

.user-stats {
    color: hsl(var(--muted-foreground));
    font-size: 0.84rem;
    line-height: 1.55;
}

.user-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.record-value-wrap {
    overflow-wrap: anywhere;
}

.sharing-group {
    margin-top: 1.2rem;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sharing-heading,
.sharing-heading-row .sharing-heading {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: hsl(var(--muted-foreground));
}

.select-compact {
    min-width: 7.5rem;
}

.auth-shell {
    max-width: 26rem;
}

.auth-panel {
    padding: 2rem;
}

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

@media (max-width: 1024px) {
    .mobile-topbar {
        position: sticky;
        top: 0;
        z-index: 120;
        display: flex;
        align-items: center;
        gap: 0.85rem;
        min-height: 4rem;
        padding: 0.85rem 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        background-color: rgba(7, 8, 12, 0.96);
        backdrop-filter: blur(12px);
    }

    .mobile-brand {
        min-width: 0;
    }

    .mobile-menu-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.8rem;
        height: 2.8rem;
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 0.9rem;
        background-color: rgba(255, 255, 255, 0.04);
        color: hsl(var(--foreground));
        cursor: pointer;
    }

    .mobile-menu-icon {
        display: inline-flex;
        width: 1.15rem;
        height: 1.15rem;
    }

    .mobile-menu-icon svg {
        display: block;
        width: 100%;
        height: 100%;
    }

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

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 220;
        width: min(20rem, calc(100vw - 1.5rem));
        height: 100svh;
        border-right: 1px solid rgba(255, 255, 255, 0.08);
        transform: translateX(calc(-100% - 1.5rem));
        transition: transform 180ms ease;
        box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-mobile-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.2rem 0.5rem 1rem;
    }

    .mobile-menu-close {
        flex: 0 0 auto;
    }

    .brand-block {
        display: none;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 210;
        display: block;
        border: 0;
        background: rgba(5, 6, 10, 0.66);
        opacity: 0;
        pointer-events: none;
        transition: opacity 180ms ease;
    }

    body.nav-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-footer {
        align-items: stretch;
        flex-direction: column;
        padding-top: 1rem;
    }

    .sidebar-footer .button {
        width: 100%;
    }

    .main {
        padding: 1.5rem 1.25rem 2rem;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
        margin-bottom: 1.15rem;
    }

    .page-header .action-group {
        width: 100%;
        justify-content: flex-start;
    }

    .panel-grid,
    .metric-strip,
    .workspace-layout,
    .editor-layout,
    .record-row-wide {
        grid-template-columns: 1fr;
    }

    .workspace-side {
        position: static;
    }

    .editor-side,
    .workspace-main,
    .workspace-side {
        min-width: 0;
    }

    .record-actions,
    .user-actions,
    .action-group {
        justify-content: flex-start;
    }

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

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

    .editor-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 1180px) {
    .panel-grid,
    .metric-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workspace-layout,
    .editor-layout,
    .user-row,
    .record-row-wide {
        grid-template-columns: 1fr;
    }

    .workspace-side {
        position: static;
    }

    .record-actions,
    .user-actions,
    .action-group {
        justify-content: flex-start;
    }

    .editor-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .main {
        padding: 1.25rem;
    }

    .panel-grid,
    .metric-strip {
        grid-template-columns: 1fr;
    }

    .editor-toolbar-copy {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.45rem;
    }

    .metric {
        padding: 0.95rem 1rem;
    }

    .section-card {
        padding: 1.1rem;
    }

    .page-header h1 {
        font-size: 1.75rem;
    }

    .record-row,
    .record-row-wide,
    .user-row {
        gap: 0.9rem;
    }

    .record-meta {
        gap: 0.5rem 0.7rem;
    }

    .record-end {
        width: 100%;
    }

    .detail-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.28rem;
    }

    .meta-card .detail-row strong,
    .meta-card .detail-row span {
        width: 100%;
    }

    .sharing-group .record-row,
    .history-list .record-row {
        padding: 0.9rem 0;
    }

    .create-modal {
        padding: 0;
        align-items: end;
    }

    .create-modal-card {
        width: 100%;
        max-height: min(100svh, 48rem);
        border-radius: 1.2rem 1.2rem 0 0;
    }

    .record-list > .record-row,
    .user-list > .user-row {
        padding: 1rem;
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 1rem;
        background: rgba(255, 255, 255, 0.03);
    }

    .record-list > .record-row + .record-row,
    .user-list > .user-row + .user-row {
        margin-top: 0.85rem;
    }

    .record-list > .record-row:first-child,
    .user-list > .user-row:first-child {
        padding-top: 1rem;
    }

    .record-row,
    .record-row-wide,
    .user-row {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        border-top: none;
    }

    .record-actions,
    .user-actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .pagination-links,
    .pagination-links .button,
    .search-form .button,
    .search-form .button-ghost,
    .search-form a.button {
        width: 100%;
    }

    .record-actions .inline-form,
    .user-actions .inline-form {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
        gap: 0.6rem;
    }

    .record-actions .button,
    .user-actions .button,
    .record-actions .button-ghost,
    .user-actions .button-ghost,
    .record-actions .button-outline,
    .user-actions .button-outline,
    .record-actions a.button,
    .user-actions a.button {
        width: 100%;
    }

    .user-row .field {
        width: 100%;
    }

    .select-compact {
        width: 100%;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    .mobile-topbar {
        padding-inline: 0.85rem;
    }

    .main {
        padding: 1rem 0.85rem 1.4rem;
    }

    .page-header h1 {
        font-size: 1.55rem;
    }

    .action-group,
    .action-group .inline-form {
        width: 100%;
    }

    .action-group .button,
    .action-group .button-ghost,
    .action-group .button-outline,
    .action-group a.button {
        width: 100%;
    }

    .section-card,
    .confirm-modal-card {
        padding: 1rem;
    }

    .confirm-modal {
        padding: 0.9rem;
    }

    .editor-field textarea,
    .editor-main textarea {
        min-height: 22rem;
    }

    .record-title {
        font-size: 0.93rem;
    }

    .record-meta,
    .muted,
    .page-note {
        font-size: 0.82rem;
    }
}

/* Nade Locations */
.public-body {
    background:
        radial-gradient(circle at top left, rgba(54, 108, 173, 0.1), transparent 26rem),
        hsl(var(--background));
}

.public-shell {
    max-width: 56rem;
}

.public-panel {
    width: 100%;
}

.public-location-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.public-location-card h1 {
    font-size: 1.95rem;
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.share-link-box,
.nade-location-preview {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.95rem;
    background-color: rgba(255, 255, 255, 0.03);
}

.share-link-box {
    padding: 0.95rem 1rem;
    overflow-wrap: anywhere;
}

.nade-location-preview {
    margin: 0;
    padding: 1rem 1.05rem;
    min-height: 20rem;
    color: hsl(var(--foreground));
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.88rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

.nade-location-preview-public {
    min-height: 24rem;
}

@media (max-width: 768px) {
    .public-location-card h1 {
        font-size: 1.6rem;
    }

    .nade-location-preview,
    .nade-location-preview-public {
        min-height: 16rem;
    }
}

/* Error Pages */
.error-body {
    background:
        radial-gradient(circle at top left, rgba(54, 108, 173, 0.1), transparent 24rem),
        hsl(var(--background));
}

.error-shell,
.error-main,
.error-brand,
.error-page,
.error-card,
.error-head,
.error-actions,
.error-actions .button {
    transition: all 0.5s ease;
}

.error-shell {
    width: 100%;
    max-width: 28rem;
}

.error-brand {
    justify-content: center;
    margin-bottom: 1rem;
}

.error-main {
    width: 100%;
}

.error-page {
    width: 100%;
}

.error-card {
    width: 100%;
    animation: error-card-enter 0.5s ease both;
    text-align: left;
}

.error-card:hover {
    transform: translateY(-0.12rem);
}

.error-head {
    margin-bottom: 0.85rem;
}

.error-head .record-badge {
    min-height: 1.55rem;
    padding: 0.12rem 0.55rem;
    font-size: 0.72rem;
}

.error-card h1 {
    font-size: 1.55rem;
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.error-copy {
    margin-top: 0.4rem;
    font-size: 0.9rem;
}

.error-debug {
    margin-top: 1.2rem;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    background-color: rgba(255, 255, 255, 0.03);
    color: hsl(var(--muted-foreground));
    font-size: 0.82rem;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.error-actions {
    margin-top: 1.1rem;
}

.error-actions .button {
    width: 100%;
}

.error-actions .button:hover {
    transform: translateY(-0.08rem);
}

@keyframes error-card-enter {
    from {
        opacity: 0;
        transform: translateY(1.2rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 900px) {
    .error-body {
        padding: 1.25rem;
    }

    .error-card {
        padding: 1.2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .error-shell,
    .error-main,
    .error-brand,
    .error-page,
    .error-card,
    .error-head,
    .error-actions,
    .error-actions .button {
        transition: none;
        animation: none;
    }
}
