:root {
    --scarlet: #ff2400;
    --scarlet-dark: #d91f00;
    --background: #ffffff;
    --surface: #ffffff;
    --surface-soft: #f7f8fa;
    --text: #202124;
    --text-secondary: #687078;
    --border: #e1e4e8;
    --border-strong: #d2d6da;
    --shadow: 0 8px 30px rgba(31, 35, 40, 0.08);
    --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--background); }
body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background: var(--background);
    display: flex;
    flex-direction: column;
}
button, input { font: inherit; }
a { color: inherit; }

/* ---------- Bookmarks bar ---------- */
.bookmarks-bar {
    position: relative;
    z-index: 30;
    width: 100%;
    height: 40px;
    flex: 0 0 40px;
    display: flex;
    align-items: center;
    background: #f7f8fa;
    border-bottom: 1px solid var(--border);
}

.bookmarks-track {
    width: 100%;
    height: 100%;
    padding: 0 18px;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    white-space: nowrap;
}
.bookmarks-track::-webkit-scrollbar { display: none; }

.bookmark-item,
.bookmark-add {
    height: 30px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #565d64;
    font-size: 12px;
    font-weight: 550;
    text-decoration: none;
    cursor: pointer;
}
.bookmark-item:hover,
.bookmark-add:hover,
.bookmark-add[aria-expanded="true"] {
    background: #eceff2;
    color: var(--text);
}

.bookmark-icon {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    display: grid;
    place-items: center;
    border-radius: 5px;
    background: #ffffff;
    border: 1px solid #dfe3e7;
    color: #666d74;
    font-size: 8px;
    font-weight: 800;
    line-height: 1;
}
.bookmark-label {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bookmark-add { color: #7a8188; }
.bookmark-add svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.bookmark-popover[hidden] { display: none !important; }
.bookmark-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: 18px;
    width: min(340px, calc(100vw - 28px));
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 34px rgba(31, 35, 40, 0.16);
}
.bookmark-popover-heading {
    margin-bottom: 14px;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
}
.bookmark-field {
    display: block;
    margin-top: 11px;
}
.bookmark-field > span {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 650;
}
.bookmark-field input {
    width: 100%;
    height: 40px;
    padding: 0 11px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    outline: none;
    background: #ffffff;
    color: var(--text);
    font-size: 13px;
}
.bookmark-field input:focus {
    border-color: #90979e;
    box-shadow: 0 0 0 3px rgba(32, 33, 36, 0.07);
}
.bookmark-field input::placeholder { color: #a0a6ac; }
.bookmark-error {
    margin: 10px 0 0;
    color: var(--scarlet-dark);
    font-size: 11px;
}
.bookmark-error[hidden] { display: none !important; }
.bookmark-form-actions {
    margin-top: 16px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}
.bookmark-cancel,
.bookmark-save {
    min-width: 68px;
    height: 36px;
    padding: 0 13px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
}
.bookmark-cancel {
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text-secondary);
}
.bookmark-cancel:hover { background: var(--surface-soft); }
.bookmark-save {
    border: 1px solid var(--text);
    background: var(--text);
    color: #ffffff;
}
.bookmark-save:hover { background: #08090a; }

/* Bookmark right-click menu */
.bookmark-context-menu[hidden],
.bookmark-rename-popover[hidden] {
    display: none !important;
}

.bookmark-context-menu {
    position: fixed;
    z-index: 1000;
    width: 150px;
    padding: 5px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(31, 35, 40, 0.18);
}

.bookmark-context-action {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}
.bookmark-context-action:hover,
.bookmark-context-action:focus-visible {
    background: var(--surface-soft);
    outline: none;
}
.bookmark-context-delete { color: #b42318; }
.bookmark-context-delete:hover,
.bookmark-context-delete:focus-visible {
    background: #fff1ef;
}

.bookmark-rename-popover {
    position: fixed;
    z-index: 1001;
    width: min(300px, calc(100vw - 16px));
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 34px rgba(31, 35, 40, 0.16);
}

/* ---------- Main Scarlet header ---------- */
.site-header {
    width: 100%;
    min-height: 78px;
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-name {
    font-size: 24px;
    font-weight: 750;
    letter-spacing: 0.18em;
}

.brand-flower {
    width: 56px;
    height: 56px;
    object-fit: contain;
    flex: 0 0 auto;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.10));
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Shared Bromero account avatar */
.account-button {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    text-decoration: none;
    transition: background 140ms ease;
}
.account-button:hover { background: var(--surface-soft); }

.account-avatar-shell {
    position: relative;
    width: 34px;
    height: 34px;
    display: block;
    overflow: hidden;
    border-radius: 50%;
    border: 1px solid #d9dde1;
    background: #eef0f2;
}
.account-avatar-image,
.account-avatar-fallback {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
}
.account-avatar-image {
    display: block;
    object-fit: cover;
    background: #eef0f2;
}
.account-avatar-image[hidden],
.account-avatar-fallback[hidden] {
    display: none !important;
}
.account-avatar-fallback {
    display: grid;
    place-items: center;
    color: #697077;
}
.account-avatar-fallback svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.apps-container { position: relative; }
.apps-grid {
    width: 42px;
    height: 42px;
    display: grid;
    grid-template-columns: repeat(3, 4px);
    grid-template-rows: repeat(3, 4px);
    place-content: center;
    gap: 4px;
    background: transparent;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}
.apps-grid:hover,
.apps-grid[aria-expanded="true"] { background: var(--surface-soft); }
.dot {
    width: 4px;
    height: 4px;
    background: #646a70;
    border-radius: 50%;
}
.apps-menu {
    display: none;
    position: absolute;
    z-index: 20;
    right: 0;
    top: 50px;
    width: 230px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}
.apps-menu.active { display: block; }
.app-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 10px;
    text-decoration: none;
}
.app-item:hover { background: var(--surface-soft); }
.app-item > span:last-child {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.app-item strong { font-size: 14px; font-weight: 650; }
.app-item small { color: var(--text-secondary); font-size: 11px; }
.app-icon {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 10px;
    background: #f0f1f3;
    display: grid;
    place-items: center;
    font-size: 11px;
    font-weight: 800;
}

main {
    width: 100%;
    flex: 1;
    padding: 7vh 22px 64px;
}
.search-hero {
    width: min(720px, 100%);
    margin: 0 auto;
}
.search-bar {
    height: 56px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 0 18px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
.search-bar:hover,
.search-bar:focus-within {
    border-color: transparent;
    box-shadow: 0 2px 12px rgba(32, 33, 36, 0.18);
}
.search-icon {
    width: 21px;
    height: 21px;
    flex: 0 0 auto;
    fill: #747b82;
}
.search-input {
    min-width: 0;
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 16px;
}
.search-input::placeholder { color: #899097; }
.search-submit {
    height: 40px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: var(--text);
    color: white;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
}
.search-submit:hover { background: #08090a; }
.search-caption {
    margin: 10px 0 0;
    text-align: center;
    color: #8a9198;
    font-size: 11px;
}

.news-section {
    width: min(940px, 100%);
    margin: 62px auto 0;
}
.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px;
}
.eyebrow {
    margin: 0 0 4px;
    color: var(--scarlet-dark);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.14em;
}
.section-heading h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.source-link {
    color: var(--text-secondary);
    font-size: 12px;
    text-decoration: none;
}
.source-link:hover { color: var(--scarlet-dark); }
.news-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.news-card {
    min-height: 196px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}
.news-card:hover {
    transform: translateY(-2px);
    border-color: #d3d7db;
    box-shadow: 0 8px 22px rgba(31, 35, 40, 0.07);
}
.news-card-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.news-category {
    color: var(--scarlet-dark);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.news-date { color: #969ca2; font-size: 10px; }
.news-card h3 {
    margin: 0;
    font-size: 17px;
    line-height: 1.3;
    letter-spacing: -0.015em;
}
.news-card h3 a { text-decoration: none; }
.news-card h3 a:hover {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}
.news-card p {
    margin: 10px 0 18px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.55;
}
.news-source {
    margin-top: auto;
    color: #858c92;
    font-size: 11px;
    font-weight: 600;
}

footer {
    min-height: 58px;
    padding: 15px 28px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    color: var(--text-secondary);
    font-size: 11px;
}
.footer-links,
.footer-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}
footer a {
    color: inherit;
    text-decoration: none;
}
footer a:hover {
    color: var(--text);
    text-decoration: underline;
}
.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;
}

@media (max-width: 700px) {
    .bookmarks-bar {
        height: 38px;
        flex-basis: 38px;
    }
    .bookmarks-track {
        padding: 0 8px;
    }
    .bookmark-popover {
        left: 8px;
        width: min(340px, calc(100vw - 16px));
    }
    .bookmark-item,
    .bookmark-add {
        height: 29px;
        padding: 0 8px;
        font-size: 11px;
    }

    .site-header { padding: 14px 16px; }
    .brand-name { font-size: 20px; }
    .brand-flower {
        width: 48px;
        height: 48px;
    }
    .header-actions { gap: 4px; }
    .account-button,
    .apps-grid {
        width: 40px;
        height: 40px;
    }
    .account-avatar-shell {
        width: 32px;
        height: 32px;
    }
    main { padding: 6vh 14px 42px; }
    .search-bar {
        height: 52px;
        padding-left: 15px;
    }
    .search-submit { display: none; }
    .news-section { margin-top: 44px; }
    .news-grid { grid-template-columns: 1fr; }
    .news-card { min-height: 0; }
    footer {
        padding: 14px 16px;
        flex-direction: column;
        align-items: flex-start;
    }
}
