:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --text: #172033;
    --muted: #6b7280;
    --primary: #4f46e5;
    --primary-dark: #3730a3;
    --danger: #dc2626;
    --border: #dbe3ef;
    --shadow: 0 18px 45px rgba(15, 23, 42, 0.10);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(135deg, #eef2ff 0%, var(--bg) 55%, #ecfeff 100%);
    color: var(--text);
}

.app-shell {
    width: min(1120px, calc(100% - 28px));
    margin: 0 auto;
    padding: 28px 0 48px;
}

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 28px;
    border-radius: 26px;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    color: #ffffff;
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0 0 8px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-size: 0.75rem;
    opacity: 0.9;
}

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

h1 {
    margin-bottom: 10px;
    font-size: clamp(1.8rem, 4vw, 3rem);
}

.subtitle {
    margin-bottom: 0;
    max-width: 620px;
    line-height: 1.6;
    opacity: 0.92;
}

.note-count {
    min-width: 96px;
    min-height: 96px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    text-align: center;
}

.note-count span {
    font-size: 2rem;
    font-weight: 800;
}

.note-count small {
    display: block;
    margin-top: -18px;
}

.card,
.toolbar,
.notes-section {
    margin-top: 22px;
}

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

.editor-card h2,
.notes-section h2 {
    margin-bottom: 18px;
}

label {
    display: block;
    margin: 16px 0 8px;
    font-weight: 700;
}

input,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px 16px;
    font: inherit;
    color: var(--text);
    background: #ffffff;
    outline: none;
}

input:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}

textarea {
    resize: vertical;
    min-height: 130px;
}

.actions,
.note-actions,
.toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.actions {
    margin-top: 18px;
}

button {
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

button:hover {
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

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

.primary-btn:hover {
    background: var(--primary-dark);
}

.secondary-btn,
.edit-btn {
    background: #eef2ff;
    color: var(--primary-dark);
}

.danger-btn,
.delete-btn {
    background: #fee2e2;
    color: var(--danger);
}

.toolbar {
    align-items: center;
}

.toolbar input {
    flex: 1 1 260px;
}

.notes-section {
    padding-bottom: 16px;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.note-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
    overflow-wrap: anywhere;
}

.note-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.note-card h3 {
    margin-bottom: 0;
    font-size: 1.1rem;
}

.note-card time {
    white-space: nowrap;
    color: var(--muted);
    font-size: 0.82rem;
}

.note-card p {
    color: #374151;
    line-height: 1.55;
    white-space: pre-wrap;
}

.empty-state {
    display: grid;
    gap: 6px;
    justify-items: center;
    padding: 34px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    color: var(--muted);
    background: rgba(255, 255, 255, 0.58);
    text-align: center;
}

.hidden {
    display: none;
}

@media (max-width: 900px) {
    .notes-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 620px) {
    .app-shell {
        width: min(100% - 18px, 1120px);
        padding-top: 12px;
    }

    .hero {
        align-items: stretch;
        flex-direction: column;
        padding: 22px;
        border-radius: 20px;
    }

    .note-count {
        min-width: unset;
        min-height: 78px;
    }

    .note-count small {
        margin-top: -12px;
    }

    .card {
        padding: 18px;
    }

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

    .actions button,
    .toolbar button,
    .note-actions button {
        width: 100%;
    }
}
