html, body {
    margin: 0;
    height: 100%;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
    background: #0b0c0f;
    color: #e7e9ee;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

/* Header */
.app-header {
    position: sticky; top: 0; z-index: 10;
    background: #0b0c0f; border-bottom: 1px solid #20232b;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    column-gap: 1rem;
    row-gap: 0.75rem;
}
.app-branding { display: flex; flex-direction: column; }
.app-title { margin: 0; font-size: 1.05rem; font-weight: 600; }
.app-subtitle { margin-top: 0.15rem; font-size: 0.85rem; opacity: 0.7; }
.app-auth {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
    position: relative;
}
.auth-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.auth-avatar-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: transparent;
    outline: none;
}
.auth-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #28314a;
    box-shadow: 0 0 0 1px rgba(10, 12, 18, 0.5);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.auth-avatar-trigger:hover .auth-avatar,
.auth-avatar-trigger:focus-visible .auth-avatar,
.auth-avatar-trigger[data-open="true"] .auth-avatar {
    box-shadow: 0 0 0 2px #ffffff;
}
.auth-menu-wrapper {
    position: absolute;
    top: 100%;
    right: 0;
    transform: translateY(0.6rem);
    z-index: 20;
}
.auth-menu {
    position: relative;
    background: rgba(17, 20, 32, 0.98);
    border: 1px solid #28314a;
    border-radius: 0.75rem;
    padding: 0.4rem;
    min-width: 12rem;
    box-shadow: 0 18px 42px rgba(5, 8, 16, 0.45);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.auth-menu[hidden] {
    display: none !important;
}
.auth-menu-item {
    background: transparent;
    border: none;
    border-radius: 0.55rem;
    color: #d5deff;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    padding: 0.55rem 0.75rem;
    text-align: left;
    transition: background-color 0.12s ease, color 0.12s ease;
}
.auth-menu-item:hover,
.auth-menu-item:focus-visible {
    background: rgba(66, 94, 165, 0.25);
    color: #ffffff;
}
.auth-menu-sign-out {
    color: #f2b5b5;
}
.auth-menu-sign-out:hover,
.auth-menu-sign-out:focus-visible {
    background: rgba(138, 52, 52, 0.28);
    color: #ffd6d6;
}
.fullscreen-toggle__label {
    flex: 1 1 auto;
}
.auth-profile-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}
.auth-display-name {
    font-size: 0.82rem;
    font-weight: 600;
}
.auth-status {
    font-size: 0.72rem;
    color: #8ea2d8;
    min-width: 6rem;
}
.auth-button-host {
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-inline-button {
    background: transparent;
    border: 1px solid #28314a;
    border-radius: 999px;
    color: #d5deff;
    cursor: pointer;
    font-size: 0.82rem;
    padding: 0.4rem 0.85rem;
    transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.auth-inline-button:hover,
.auth-inline-button:focus-visible {
    background: rgba(66, 94, 165, 0.22);
    color: #ffffff;
    border-color: rgba(118, 146, 220, 0.7);
}
.fullscreen-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.6rem;
    color: inherit;
    padding: 0.55rem 0.75rem;
}
.fullscreen-toggle__icon {
    width: 1.25rem;
    height: 1.25rem;
    flex: 0 0 auto;
}
.fullscreen-toggle__enter,
.fullscreen-toggle__exit {
    display: none;
}
.fullscreen-toggle__stroke {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.15s ease;
}
.fullscreen-toggle[data-fullscreen-state="enter"] .fullscreen-toggle__enter {
    display: block;
}
.fullscreen-toggle[data-fullscreen-state="exit"] .fullscreen-toggle__exit {
    display: block;
}
.fullscreen-toggle[data-fullscreen-state="exit"]:not(:hover):not(:focus-visible) {
    color: #a5bfff;
}
.app-control-button {
    background: transparent;
    border: 1px solid #28314a;
    border-radius: 6px;
    color: #7aa2ff;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
    transition: border-color 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}
.app-control-button:hover {
    color: #b4c8ff;
    border-color: #3a4b71;
}

/* Containers */
.block-container { display: flex; flex-direction: column; }

/* Both note cards use the same grid skeleton */
.markdown-block {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); /* text | controls (2/3 vs 1/3) */
    align-items: start;
    column-gap: 0.75rem;
    row-gap: 0;
    border: 0;
    border-bottom: 1px solid rgba(58, 68, 94, 0.7);
    padding: 0.6rem 1rem 0.9rem 1rem;
    box-sizing: border-box;
    background: #0b0c0f;
    width: 100%;
}

/* Content column */
.markdown-content,
.markdown-editor,
.note-badges { grid-column: 1; }

.card-content {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    align-self: stretch;
}

.card-content .note-html-view,
.card-content .markdown-editor {
    grid-column: auto;
}

.note-badges:not(:empty) {
    margin-bottom: 0.35rem;
}

.card--has-badges .card-controls {
    margin-top: 0.35rem;
}

.meta-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    text-align: right;
    gap: 0.35rem;
    margin: 0;
    align-self: stretch;
}
.meta-chip {
    font-size: 0.72rem; padding: 0.18rem 0.4rem; border-radius: 0.35rem;
    background: #121420; border: 1px solid #1f2333; color: #cfd7ff;
}
.meta-chip--privacy { border-color: #3a2d3f; color: #f2c8ff; }
.meta-chip--status  { border-color: #234630; color: #c7ffd9; }
.meta-chip--cat     { border-color: #293a63; color: #c9dbff; }

.note-badges {
    grid-column: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.72rem;
    color: #aebcf3;
}

.note-badge {
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(48, 58, 92, 0.35);
    border: 1px solid rgba(65, 80, 120, 0.65);
    line-height: 1.25;
    letter-spacing: 0.01em;
}

.note-badge--code {
    background: rgba(42, 67, 58, 0.45);
    border-color: rgba(86, 123, 104, 0.65);
    color: #a9f3c6;
}

.note-html-view {
    position: relative;
    grid-column: 1;
    max-height: 18vh;
    overflow: hidden;
    border-radius: 0.5rem;
}

.note-html-view.note-html-view--toggle-hover {
    cursor: pointer;
}

.note-html-view::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3.5rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.16s ease;
    background: linear-gradient(180deg, rgba(11, 12, 15, 0) 0%, rgba(11, 12, 15, 0.85) 65%, rgba(11, 12, 15, 1) 100%);
}

.note-html-view.note-html-view--overflow::after {
    opacity: 1;
}

.note-html-view.note-html-view--expanded {
    max-height: none;
    overflow: visible;
}

.note-html-view.note-html-view--expanded::after {
    opacity: 0;
}

.note-expand-toggle {
    position: absolute;
    left: 50%;
    bottom: 0.35rem;
    transform: translateX(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    width: 2.1rem;
    height: 2.1rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.note-expand-toggle__icon {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background-color: rgba(14, 18, 30, 0.9);
    box-shadow: 0 0 6px rgba(10, 12, 18, 0.85);
    transition: background-color 0.18s ease;
    display: block;
}

.note-expand-toggle__ring {
    fill: none;
    stroke: #d8e4ff;
    stroke-width: 1.4;
    opacity: 0.88;
    transition: stroke 0.12s ease, opacity 0.12s ease;
}

.note-expand-toggle__arrow {
    fill: none;
    stroke: #d8e4ff;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform-origin: 12px 12px;
    transition: transform 0.18s ease, stroke 0.12s ease;
}

.note-expand-toggle:hover .note-expand-toggle__icon {
    background-color: rgba(21, 27, 43, 0.95);
}

.note-expand-toggle:hover .note-expand-toggle__ring,
.note-expand-toggle:hover .note-expand-toggle__arrow {
    stroke: #ffffff;
    opacity: 1;
}

.note-expand-toggle[aria-expanded="true"] .note-expand-toggle__arrow {
    transform: rotate(180deg);
}

.note-task-checkbox {
    margin-right: 0.4rem;
    cursor: pointer;
}

/* HTML VIEW (rendered markdown) */
.markdown-content {
    white-space: normal;                /* let HTML decide layout */
    line-height: 1.35;
    font-size: 1rem;
    padding: 0.25rem 0;
    margin: 0;
    min-height: 2.2rem;                 /* matches editor baseline so no jump */
}
.markdown-content p { margin: 0; }    /* kill default p margins to stabilize height */
.markdown-content p + p {
    margin-top: 0.6rem;
}
.markdown-content ul,
.markdown-content ol { margin: 0.25rem 0 0.25rem 1.2rem; }

.markdown-content img {
    display: block;
    max-width: min(100%, 70vw);
    max-height: 60vh;
    width: auto;
    height: auto;
    margin: 0.35rem 0;
    object-fit: contain;
    object-position: top left;
}

.note-html-view .markdown-content {
    padding-right: 0.25rem;
}



.note-html-view--placeholder {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: rgba(191, 202, 245, 0.8);
    font-size: 0.95rem;
}
.note-html-view--placeholder .note-html-view__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(96, 122, 194, 0.35);
    color: #d5deff;
    font-size: 1.1rem;
}

/* Tables */
.markdown-content table {
    display: inline-table;
    width: auto;
    max-width: 100%;
    border-collapse: collapse;
    margin: 0.25rem 0;
}
.markdown-content th, .markdown-content td {
    border: 1px solid #2a2f3a;
    padding: 0.4rem 0.6rem;
}
.markdown-content th {
    background: #141820;
    font-weight: 600;
}

/* EDITOR */
.markdown-editor {
    display: none;
    width: 100%;
    border: none;
    outline: none;
    font: inherit;
    background: transparent;
    color: #e7e9ee;
    caret-color: #e7e9ee;
    resize: none;
    overflow: hidden;
    white-space: pre-wrap;

    /* baseline so the caret shows up before first input */
    min-height: 2.2rem;
    line-height: 1.35;
    padding: 0.25rem 0; /* match html view padding */
}

.markdown-editor--enhanced {
    opacity: 0;
    color: transparent;
    caret-color: transparent;
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(100%);
}

/* Mode toggles */
.edit-mode .markdown-content,
.editing-in-place .markdown-content,
.markdown-editor-host--edit .markdown-content { display: none; }
.edit-mode .markdown-editor,
.editing-in-place .markdown-editor,
.markdown-editor-host--edit .markdown-editor { display: block; }

.markdown-editor-host--view .markdown-editor,
.markdown-editor-host--view .CodeMirror { display: none; }
.markdown-editor-host--view .markdown-content { display: block; }
.markdown-editor-host--edit .CodeMirror { display: block; }

/* Actions column (cards only) */
.card-controls {
    grid-column: 2;
    grid-row: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    justify-self: stretch;
    align-self: start;
    text-align: right;
}
.actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    align-items: stretch;
    align-self: flex-end;
    width: min(16rem, 100%);
    min-width: 6.5rem;
}
.action-group { display: flex; flex-direction: column; gap: 0.35rem; }
.action-group--row { flex-direction: row; gap: 0.25rem; }
.action-button {
    background: transparent; border: 1px solid #28314a; border-radius: 6px;
    cursor: pointer; user-select: none; font-size: 0.9rem; color: #7aa2ff;
    padding: 0.24rem 0.35rem; line-height: 1.05; text-align: center; box-sizing: border-box;
    opacity: .5; transition: border-color .12s ease, color .12s ease, opacity .12s ease;
}
.action-group--row .action-button { flex: 1; }

.markdown-block { position: relative; }
.markdown-block--pinned {
    position: sticky;
    top: var(--pinned-top-offset, 120px);
    z-index: 4;
    background: #0b0c0f;
    border-bottom: 1px solid rgba(122, 162, 255, 0.85);
    box-shadow: 0 1px 0 rgba(122, 162, 255, 0.4);
}
.markdown-block.top-editor {
    position: sticky;
    top: 64px;
    z-index: 5;
    grid-template-columns: 1fr;
    padding: 0;
    border-bottom: 1px solid rgba(58, 68, 94, 0.7);
    background: transparent;
}

.markdown-block.top-editor .markdown-content,
.markdown-block.top-editor .markdown-editor {
    font-size: 0.95rem;
    line-height: 1.05;
    min-height: 1rem;
    padding: 0;
}

.markdown-block.top-editor .EasyMDEContainer .editor-preview,
.markdown-block.top-editor .EasyMDEContainer .editor-preview-side {
    display: none !important;
    width: 0 !important;
    max-width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}

.action-button--compact { font-size: 0.72rem; padding: 0.16rem 0.3rem; }
.action-button--icon {
    font-size: 0.7rem;
    padding: 0.16rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.action-button--pin {
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    border-radius: 999px;
    position: relative;
}
.action-button--pin::before {
    content: "";
    display: block;
    width: 0.9rem;
    height: 0.9rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237aa2ff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 3h12a1 1 0 0 1 1 1v16.5l-7-3.5-7 3.5V4a1 1 0 0 1 1-1z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    margin: 0 auto;
    transition: filter 0.2s ease, opacity 0.2s ease;
    opacity: 0.7;
}
.action-button--pressed.action-button--pin::before,
.action-button--pin[aria-pressed="true"]::before {
    filter: drop-shadow(0 0 3px rgba(122, 162, 255, 0.75));
    opacity: 1;
}
.action-button--toggle {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 9999px;
    align-self: flex-end;
}
.action-button--pressed,
.action-button--toggle[aria-pressed="true"] {
    background: rgba(122, 162, 255, 0.12);
    border-color: #7aa2ff;
    color: #c6d7ff;
    opacity: 1;
}
.action-group--row .action-button--icon {
    flex: 0 0 auto;
}
.markdown-block:hover .action-button,
.markdown-block.edit-mode .action-button,
.markdown-block.editing-in-place .action-button { opacity: 1; }
.action-button:hover { color: #b4c8ff; border-color: #3a4b71; }

.clipboard-feedback {
    align-self: flex-start;
    background: rgba(30, 81, 50, 0.9);
    border: 1px solid #3b9a5f;
    border-radius: 4px;
    color: #9df6b9;
    font-size: 0.72rem;
    padding: 0.18rem 0.4rem;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(-4px);
    margin-top: -0.1rem;
}

.clipboard-feedback--visible {
    opacity: 1;
    transform: translateY(0);
}

/* Editor toolbar */
.editor-mode-toolbar {
    grid-column: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.editor-mode-toggle-group,
.editor-mode-utility-group {
    display: inline-flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.editor-mode-utility-group { margin-left: auto; }

.editor-button {
    background: transparent;
    border: 1px solid #28314a;
    border-radius: 6px;
    color: #9db7ff;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    line-height: 1.2;
    transition: border-color 0.12s ease, color 0.12s ease, background-color 0.12s ease;
}

.editor-button:hover {
    border-color: #3a4b71;
    color: #c4d4ff;
}

.editor-mode-toggle.is-active {
    background: #1a2237;
    border-color: #3a4b71;
    color: #d6e2ff;
}

.markdown-editor-host--view .editor-mode-toggle[aria-pressed="true"] {
    background: #121420;
}

.markdown-editor-host--edit .editor-mode-toggle[aria-pressed="true"] {
    background: #1f2840;
}

/* EasyMDE skin tweaks */
.EasyMDEContainer {
    grid-column: 1;
    width: 100%;
    background: transparent !important;
}

.CodeMirror {
    grid-column: 1;
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: auto !important;
    background: transparent !important;
    color: #e7e9ee;
    border: none !important;
    border-radius: 0;
    box-shadow: none;
    padding: 0 !important;
    line-height: 1.35;
    min-height: 2.2rem;
}

.CodeMirror-cursor {
    border-left: 1px solid #e7e9ee;
}

.CodeMirror-lines {
    padding: 0.25rem 0.25rem 0.25rem 0;
}

.CodeMirror pre {
    padding: 0;
    color: inherit;
    background: transparent;
}

.CodeMirror-scroll {
    width: 100%;
    height: auto !important;
    min-height: 2.2rem !important;
    box-sizing: border-box;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
}

.CodeMirror-hscrollbar,
.CodeMirror-scrollbar-filler,
.CodeMirror-gutter-filler {
    display: none !important;
}

.markdown-block.top-editor .CodeMirror {
    height: auto !important;
}

.cm-header { color: #9db7ff; }
.cm-strong { color: #f9d67a; }
.cm-em { color: #f5a7ff; }
.cm-link { color: #7ad4ff; }
.cm-quote { color: #8adca1; }

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

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translate(-50%, 0.75rem);
    background: rgba(36, 62, 48, 0.92);
    border: 1px solid rgba(63, 124, 82, 0.9);
    border-radius: 999px;
    padding: 0.45rem 1.1rem;
    color: #c8fad9;
    font-size: 0.85rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 120;
}

.toast--visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast[hidden] {
    display: none;
}

/* Keyboard shortcuts modal */
.keyboard-shortcuts-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(8, 12, 22, 0.78);
    z-index: 1200;
}

.keyboard-shortcuts-overlay[hidden] { display: none; }

.keyboard-shortcuts-modal {
    position: relative;
    width: min(520px, 100%);
    background: #111723;
    border: 1px solid #27324a;
    border-radius: 14px;
    padding: 1.75rem 1.6rem;
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.45);
    color: #e7e9ee;
}

.keyboard-shortcuts-title {
    margin: 0 0 1.2rem;
    font-size: 1.4rem;
    font-weight: 600;
    color: #dbe3ff;
}

.keyboard-shortcuts-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: #98a6cd;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
}

.keyboard-shortcuts-close:hover,
.keyboard-shortcuts-close:focus {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    outline: none;
}

.keyboard-shortcuts-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.keyboard-shortcut {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.keyboard-shortcut-description {
    margin: 0;
    font-size: 0.95rem;
    color: #c7d2f2;
    flex: 1;
}

.keyboard-shortcut-keys {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
}

.keyboard-shortcut-keys-group {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.keyboard-shortcut-keys kbd {
    background: #1c2333;
    border: 1px solid #36405a;
    border-radius: 6px;
    padding: 0.28rem 0.6rem;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85rem;
    color: #f4f6ff;
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.28);
    min-width: 2.1rem;
    text-align: center;
}

.keyboard-shortcut-keys-plus {
    color: #6e7793;
    font-size: 0.85rem;
}

body.keyboard-shortcuts-open {
    overflow: hidden;
}

.app-footer {
    margin: 1.5rem auto 1rem;
    text-align: center;
}

.app-legal-link {
    color: #a0a7b8;
    font-size: 0.75rem;
    text-decoration: none;
}

.app-legal-link:focus,
.app-legal-link:hover {
    text-decoration: underline;
}

@media (max-width: 640px) {
    .markdown-block {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "controls"
            "content";
        row-gap: 0.65rem;
    }
    .card-content {
        grid-area: content;
        grid-column: 1;
    }
    .card-controls {
        grid-area: controls;
        grid-column: 1;
        grid-row: auto;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        gap: 0.5rem;
    }
    .card-controls .meta-chips {
        order: 1;
        align-items: flex-start;
        justify-content: flex-start;
    }
    .card-controls .actions {
        order: 2;
        flex-direction: row;
        gap: 0.4rem;
        width: auto;
        min-width: 0;
    }
    .card-controls .action-group { flex-direction: row; gap: 0.4rem; }
    .card-controls .action-group--row { gap: 0.4rem; }
    .action-button { flex: 1 1 auto; min-width: 0; }
    .app-header { align-items: stretch; }
}

@media (max-width: 480px) {
    .action-button { font-size: 0.85rem; padding: 0.2rem 0.3rem; }
}
