:root {
    --notes-bg: #0b1220;
    --notes-bg-soft: #0f172a;
    --notes-surface: #0f1b2d;
    --notes-border: rgba(148, 163, 184, 0.18);
    --notes-text: #f8fafc;
    --notes-muted: rgba(248, 250, 252, 0.68);
    --notes-accent: #2dd4bf;
    --notes-accent-strong: #38bdf8;
    --notes-danger: #f87171;
    --notes-success: #22c55e;
    --notes-shadow: 0 18px 40px rgba(3, 7, 18, 0.45);
    --taskbar-height: 54px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body.notes-body {
    font-family: system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
    background: var(--notes-bg);
    color: var(--notes-text);
}

.notes-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.08), transparent 45%),
                radial-gradient(circle at bottom right, rgba(45, 212, 191, 0.12), transparent 40%),
                var(--notes-bg);
}

.notes-shell--room {
    height: 100vh;
}

.notes-taskbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--taskbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    gap: 10px;
    background: rgba(10, 15, 26, 0.96);
    border-bottom: 1px solid rgba(15, 23, 42, 0.9);
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.75);
    backdrop-filter: blur(14px);
}

.notes-taskbar-section {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.notes-taskbar-brand {
    flex: 1;
    justify-content: flex-start;
}

.notes-taskbar-presence {
    justify-content: center;
}

.notes-taskbar-actions {
    flex: 1;
    justify-content: flex-end;
    flex-wrap: wrap;
}

[dir="ltr"] .notes-taskbar-brand {
    order: 1;
}

[dir="ltr"] .notes-taskbar-presence {
    order: 2;
}

[dir="ltr"] .notes-taskbar-actions {
    order: 3;
}

[dir="rtl"] .notes-taskbar-brand {
    order: 1;
}

[dir="rtl"] .notes-taskbar-presence {
    order: 2;
}

[dir="rtl"] .notes-taskbar-actions {
    order: 3;
}

.notes-brand img {
    width: 34px;
    height: 34px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

.notes-title-wrap {
    min-width: 0;
}

.notes-title {
    font-weight: 700;
    font-size: 1rem;
}

.notes-icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: radial-gradient(circle at 0 0, rgba(148, 163, 184, 0.28), rgba(15, 23, 42, 0.9));
    color: var(--notes-text);
    font-size: 0.75rem;
    cursor: pointer;
    transition: 0.2s ease;
}

.notes-icon-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.notes-icon-btn:hover {
    border-color: rgba(56, 189, 248, 0.85);
    color: #e2e8f0;
    background: radial-gradient(circle at 0 0, rgba(56, 189, 248, 0.35), rgba(15, 23, 42, 0.98));
}

.notes-icon-btn--accent {
    border-color: rgba(45, 212, 191, 0.75);
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.3), rgba(45, 212, 191, 0.9));
    color: #0b1120;
}

.notes-icon-btn--accent:hover {
    border-color: rgba(45, 212, 191, 0.95);
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.5), rgba(45, 212, 191, 1));
}

.notes-presence {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--notes-muted);
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.5);
}

.notes-badge {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.72rem;
    background: rgba(15, 23, 42, 0.7);
    color: var(--notes-muted);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.notes-badge--online {
    background: rgba(34, 197, 94, 0.18);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.3);
}

.notes-badge--offline {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.35);
}

.notes-badge--saving {
    background: rgba(56, 189, 248, 0.15);
    color: #7dd3fc;
    border-color: rgba(56, 189, 248, 0.35);
}

/* status badges are no longer shown in header, but kept for potential inline use */
.notes-badge--muted {
    background: rgba(15, 23, 42, 0.6);
}

.notes-editor {
    flex: 1;
    min-height: 0;
    padding: 14px 16px 18px;
}

.notes-editor-shell {
    height: 100%;
    width: 100%;
    display: flex;
    border-radius: 14px;
    border: 1px solid var(--notes-border);
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.75));
    box-shadow: var(--notes-shadow);
    overflow: hidden;
}

[dir="ltr"] .notes-editor-shell {
    flex-direction: row;
}

[dir="rtl"] .notes-editor-shell {
    flex-direction: row-reverse;
}

.notes-gutter {
    width: 56px;
    padding: 16px 8px;
    background: rgba(10, 15, 26, 0.96);
    border-inline-end: 1px solid rgba(148, 163, 184, 0.16);
    color: rgba(148, 163, 184, 0.85);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.6;
    text-align: end;
    user-select: none;
    overflow: hidden;
}

.notes-gutter div {
    height: 1.6em;
}

.notes-editor textarea {
    flex: 1;
    border: none;
    padding: 16px 20px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 14px;
    line-height: 1.6;
    color: var(--notes-text);
    background: transparent;
    resize: none;
    box-shadow: none;
    outline: none;
    white-space: pre;
    overflow: auto;
    text-align: start;
}

.notes-editor textarea[readonly] {
    color: rgba(248, 250, 252, 0.6);
}

.notes-toast {
    position: fixed;
    bottom: 24px;
    inset-inline-end: 24px;
    background: rgba(15, 23, 42, 0.95);
    color: var(--notes-text);
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: var(--notes-shadow);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateY(10px);
    font-size: 0.85rem;
}

.notes-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.notes-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
}

.notes-modal.is-open {
    display: flex;
}

.notes-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.65);
}

.notes-modal__panel {
    position: relative;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 14px;
    padding: 18px 20px;
    width: min(480px, 100%);
    box-shadow: var(--notes-shadow);
    z-index: 2;
}

.notes-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.notes-modal__header h3 {
    font-size: 1rem;
}

.notes-modal__close {
    border: none;
    background: transparent;
    color: var(--notes-muted);
    font-size: 1.4rem;
    cursor: pointer;
}

.notes-modal__body label {
    display: block;
    font-size: 0.8rem;
    color: var(--notes-muted);
    margin: 10px 0 6px;
}

.notes-modal__body select,
.notes-modal__body input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.7);
    color: var(--notes-text);
}

.notes-field-inline {
    display: flex;
    gap: 8px;
}

.notes-btn {
    padding: 9px 14px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: rgba(15, 23, 42, 0.8);
    color: var(--notes-text);
    cursor: pointer;
    font-size: 0.85rem;
}

.notes-btn--primary {
    background: linear-gradient(135deg, #0ea5e9, #22d3ee);
    color: #0b1120;
    border: none;
}

.notes-btn--ghost {
    background: rgba(15, 23, 42, 0.5);
}

.notes-modal__footer {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
}

.notes-chooser,
.notes-error {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}

.notes-card {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 16px;
    padding: 28px 30px;
    width: min(520px, 100%);
    box-shadow: var(--notes-shadow);
    text-align: center;
}

.notes-card h1 {
    font-size: 1.6rem;
    margin-bottom: 10px;
}

.notes-card p {
    color: var(--notes-muted);
    margin-bottom: 16px;
}

.notes-card--error {
    border-color: rgba(248, 113, 113, 0.4);
}

.notes-chooser-field {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.notes-chooser-field input {
    flex: 1;
}

.notes-card input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.7);
    color: var(--notes-text);
}

.notes-chooser-help {
    font-size: 0.75rem;
    color: var(--notes-muted);
}

.notes-error-actions {
    margin-top: 12px;
}

@media (max-width: 900px) {
    .notes-taskbar {
        flex-wrap: wrap;
        height: auto;
        padding: 8px 10px;
    }

    .notes-taskbar-brand,
    .notes-taskbar-actions {
        flex-basis: 100%;
    }

    .notes-editor {
        padding-top: 10px;
    }
}

@media (max-width: 600px) {
    .notes-icon-btn span {
        display: none;
    }
}
