/* ============================================================
 *  APP HEADER
 * ============================================================ */
.app-header {
    background: var(--bg-header);
    color: var(--text-on-header);
    padding: 0 16px;
    padding-left: calc(16px + env(safe-area-inset-left, 0px));
    padding-right: calc(16px + env(safe-area-inset-right, 0px));
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 54px;
    box-shadow: var(--shadow-header);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 10px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.brand-icon { font-size: 1.3rem; }

.brand-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.main-nav {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-shrink: 1;
    min-width: 0;
}
.main-nav::-webkit-scrollbar { display: none; }

.nav-btn {
    padding: 6px 13px;
    background: transparent;
    border: 1.5px solid var(--header-nav-border);
    border-radius: 20px;
    color: var(--header-nav-text);
    font-size: 0.84rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 44px;
}

.nav-btn:hover  { border-color: var(--header-nav-hover); color: var(--text-on-header); }
.nav-btn.active { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); font-weight: 600; }

/* Tools dropdown — replaces the row of per-view nav buttons */
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown-caret {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.7rem;
    line-height: 1;
    transition: transform 0.15s ease;
}
.nav-dropdown.open .nav-dropdown-caret { transform: rotate(180deg); }
.nav-dropdown-menu {
    /* position:fixed (not absolute) so it escapes .main-nav's overflow
       container — otherwise the implicit overflow-y clip cuts it off. */
    position: fixed;
    min-width: 200px;
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 10px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
    padding: 6px;
    /* Above #person-panel (z-index 200) so the dropdown is always usable
       even when a profile is open over a view. */
    z-index: 300;
    display: none;
    flex-direction: column;
    gap: 2px;
}
.nav-dropdown-menu.open { display: flex; }
.nav-tool-item {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 11px 12px;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font: inherit;
    color: var(--text-primary, #2c2c2c);
    text-align: left;
    transition: background 0.1s ease, color 0.1s ease;
}
.nav-tool-item:hover {
    background: var(--bg-hover-soft, #f4fdf6);
}
.nav-tool-item.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent);
    font-weight: 600;
}
.nav-tool-icon { font-size: 1rem; line-height: 1; }
.nav-tool-text { white-space: nowrap; }

/* Theme toggle (icon-only) */
.nav-btn-theme {
    font-size: 1rem;
    padding: 4px 10px;
    line-height: 1;
}
.nav-btn-theme .theme-icon-light { display: inline; }
.nav-btn-theme .theme-icon-dark  { display: none; }
:root[data-theme="dark"] .nav-btn-theme .theme-icon-light { display: none; }
:root[data-theme="dark"] .nav-btn-theme .theme-icon-dark  { display: inline; }

/* Help button */
.nav-btn-help {
    display: flex;
    align-items: center;
    gap: 5px;
}
.nav-btn-help .help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    border: 1.5px solid currentColor;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}
