@charset "UTF-8";
/* ── Brand / primary accent ──────────────────────────────────────────────
   The portal accent (Ezee orange) is driven by these variables so users can
   pick their own primary color (Profile → Appearance). Only orange usages are
   tied to the variable; other colors (greens, reds, blues) are untouched.
   The home banner re-declares the variable back to brand orange (see .banner)
   so it always stays orange regardless of the user's choice. */
:root {
    --primary: #FB612F;
    --primary-rgb: 251, 97, 47;
}

html {
    overflow-x: hidden;
}
html, body {
    height: 100%; /* Ensure html and body take full viewport height */
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ── Font size scale ── */
html[data-fontsize="small"]  { font-size: 13px; }
html[data-fontsize="default"] { font-size: 15px; }
html[data-fontsize="large"]  { font-size: 17px; }
html[data-fontsize="xlarge"] { font-size: 20px; }

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.light {
    background-color: #ffffff;
    color: #000000;
}

body.dark {
    background-color: #2b3138;
    color: #ffffff;
}

.container {
    flex-grow: 1; /* Allow container to fill remaining vertical space */
    display: flex;
    flex-direction: column;
}

header {
    display: flex;
    align-items: center;
    padding: 0.25rem 1rem;
    /* The top chrome stays brand orange on every page — re-pin the accent vars
       locally so a user's custom primary color never touches the header or nav. */
    --primary: #FB612F;
    --primary-rgb: 251, 97, 47;
    background-color: var(--primary);
    gap: 1.5rem;
    position: relative;
    min-height: 90px;
}

.header-logo-group {
    position: absolute;
    top: 50%;
    left: 16px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}

.header-logo-link {
    display: block;
    line-height: 0;
}

.header-logo {
    height: 72px;
    width: auto;
}

/* The New UI's light/dark logo pair is inert here — the classic UI keeps
   .header-logo--classic. new-ui.css flips which of the three is shown. */
.header-logo--v2 {
    display: none;
}

body.dark header {
    background-color: var(--primary);
}

.header-left {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
}

h1 {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    margin: 0;
    font-size: 2rem;
    pointer-events: none;
}

h1 .username,
h1 .profile-icon-link {
    pointer-events: auto;
}

.profile-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 10px;
    color: white;
    margin-left: 0.5rem;
    vertical-align: middle;
    transition: background-color 0.3s, border-color 0.3s;
}

.profile-icon-link svg {
    width: 28px;
    height: 28px;
}

/* Avatar (initials/photo) shown only under body.new-ui — see new-ui.css */
.profile-icon-avatar {
    display: none;
}

.profile-icon-link:hover {
    opacity: 0.8;
    background-color: rgba(255, 255, 255, 0.1); /* Subtle hover effect */
}

body.dark h1 {
    color: white;
}

.username {
    font-weight: bold;
    color: white;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.header-right {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: flex-end;
}

.header-controls-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-datetime {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    color: white;
    line-height: 1.2;
}

.header-date {
    font-size: 0.95rem;
    opacity: 0.9;
}

.header-time {
    font-size: 1.25rem;
    font-weight: 700;
}

.theme-toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-label {
    color: inherit;
    font-size: 1rem;
}

body.light .theme-label { color: #333; }
body.dark .theme-label { color: #f0f0f0; }

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
    overflow: hidden;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:checked + .slider:before {
    transform: translateX(20px);
}

body.dark .profile-theme-slider {
    background-color: #2196F3;
}

body.dark .profile-theme-slider:before {
    transform: translateX(20px);
}

.notification-bell-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0;
}

.notification-bell-button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 36px; /* Slightly smaller than profile/search for subtlety */
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
}

.notification-bell-button:hover {
    opacity: 0.8;
}

.notification-bell-button svg {
    width: 28px;
    height: 28px;
}

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    background-color: #FFD700; /* Gold/yellow for notification */
    border-radius: 50%;
    border: 1px solid white;
    box-shadow: 0 0 0 1px #FFD700;
}

.notification-badge.hidden {
    display: none;
}

/* ── Urgent announcement slide-out banner ── */
.urgent-banner {
    position: absolute;
    right: calc(100% + 6px);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: #FFD700;
    color: #1a1000;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    max-width: 0;
    padding: 0.38rem 0;
    opacity: 0;
    pointer-events: none;
    transition: max-width 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, padding 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1200;
}
.urgent-banner.visible {
    max-width: 360px;
    opacity: 1;
    pointer-events: auto;
    padding: 0.38rem 0.7rem 0.38rem 0.65rem;
}
.urgent-banner:hover { background: #f0cc00; }
.urgent-banner-icon { flex-shrink: 0; font-style: normal; }
.urgent-banner-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 240px;
    display: block;
}
.urgent-banner-dismiss {
    flex-shrink: 0;
    font-size: 1rem;
    line-height: 1;
    opacity: 0.6;
    margin-left: 2px;
}
.urgent-banner-dismiss:hover { opacity: 1; }

.top-nav {
    /* Keep the nav bar (and its search/dropdowns) brand orange regardless of the
       user's custom primary color. */
    --primary: #FB612F;
    --primary-rgb: 251, 97, 47;
    background-color: var(--primary);
    padding: 0.25rem 0.75rem;
    display: flex;
    justify-content: center;
    position: relative;
}

.top-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    /* Wraps so the row can never be wider than the bar. Without this the tabs
       held the nav open past the viewport on small windows, and because the
       mega-dropdowns are sized off the nav (left:0/right:0) they inherited that
       width and hung off both edges with no way to scroll to them — half the
       links unreachable. The New UI overrides this with its measured collapse to
       an All Tools link (see .nav-collapsed in new-ui.css). */
    flex-wrap: wrap;
    gap: 0;
    justify-content: center;
    align-items: stretch;
    position: relative;
}

.top-nav > ul > li > .page-link,
.top-nav .dropdown-toggle {
    white-space: nowrap;
}

.nav-home-btn {
    padding: 0.5rem 0.75rem;
    min-width: 44px;
}

.top-nav li {
    position: relative;
    display: flex;
}

/* Vertical separator lines between nav tabs */
.top-nav > ul > li + li {
    border-left: 1px solid rgba(255, 255, 255, 0.28);
}

/* Remove bubble border from page-links inside the nav bar */
.top-nav > ul > li > .page-link {
    border: none;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}

.top-nav > ul > li > .page-link:hover {
    background-color: rgba(255, 255, 255, 0.18);
    color: white;
}

/* The "All Tools" fallback link belongs to the New UI: syncNavStacking() reveals it
   via .nav-collapsed once the tabs stop fitting, and new-ui.css both hides it by
   default and strips .page-link's tile styling when it does show.
   None of that reaches the classic UI. syncNavStacking() returns early for it and
   never sets .nav-collapsed, and every taming rule is scoped to `body.new-ui` — so
   here the link fell through to the bare .page-link below (display: flex, width:
   100%, 2px solid white, min-height: 42px), which is built to be a full-width tile
   in the tool grid. As a direct flex child of .top-nav it claimed the entire nav row
   at every width, boxed in white, and pushed the tab list onto a second line.
   So it is hidden for the classic UI specifically. Note the selector has to be
   `body:not(.new-ui) ...` (0,2,0) and not a bare `.nav-collapsed-link` (0,1,0):
   `.page-link` below is also (0,1,0) and comes later in this file, so a bare class
   loses the tie on source order. Scoping to :not(.new-ui) also keeps this rule out
   of the New UI's way entirely, so it cannot interfere with .nav-collapsed. */
body:not(.new-ui) .nav-collapsed-link {
    display: none;
}

.management-nav-item {
    margin-left: auto;
}

.top-nav li:has(> .dropdown)::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 12px;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.2rem;
    min-height: 42px;
    width: 100%;
    border: none;
    background-color: transparent;
    color: white;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
    border-radius: 6px;
    text-align: center;
    position: relative;
    white-space: nowrap;
    font-size: 1.05rem;
    cursor: pointer;
}

.dropdown-toggle:hover {
    background-color: rgba(255, 255, 255, 0.18);
    color: white;
}

.dropdown-toggle.open {
    background-color: white;
    color: var(--primary);
    border-radius: 6px 6px 0 0;
}

body.dark .dropdown-toggle.open {
    background-color: #1e2330;
    color: #f0f0f0;
}

body.dark .top-nav > ul > li > .page-link:hover {
    background-color: rgba(255, 255, 255, 0.12);
    color: white;
}

.dropdown-toggle::after {
    content: '▶';
    margin-left: 6px;
    transition: transform 0.3s;
}

.dropdown-toggle.open::after {
    content: '▼';
}

/* Fills the gap between the hovered tab's bottom and the mega-dropdown top,
   making that specific tab appear connected to the dropdown panel below */
.top-nav li:has(> .mega-dropdown) .dropdown-toggle.open::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    height: 0.25rem; /* matches the nav's bottom-padding gap */
    background-color: white;
    z-index: 1001;
}

body.dark .top-nav li:has(> .mega-dropdown) .dropdown-toggle.open::before {
    background-color: #1e2330;
}

.dropdown {
    display: none !important;
    list-style: none;
    padding: 0.1rem 0;
    margin: 0.05rem 0 0 0;
    background-color: #ffffff;
    border-radius: 8px;
    border: 2px solid var(--primary);
    position: absolute;
    top: 100%;
    left: 0;
    width: max-content;
    min-width: 220px;
    z-index: 1000;
}

body.dark .dropdown {
    background-color: #1e2330;
}

.dropdown.show {
    display: block !important;
    border-top: none;
}

.dropdown li {
    margin: 0;
    width: 100%;
    position: relative;
}

.dropdown-link-row,
.sub-dropdown .dropdown-link-row {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    width: 100%;
}

.dropdown a {
    color: #111;
    text-decoration: none;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 0.8rem;
    min-height: 38px;
    transition: background-color 0.3s, color 0.3s;
    font-size: 1.1rem;
    line-height: 1.2;
}

body.dark .dropdown a {
    color: #f0f0f0;
}

.dropdown .nav-pin-button {
    color: #888;
}

body.dark .dropdown .nav-pin-button {
    color: rgba(255, 255, 255, 0.5);
}

.dropdown-tool-link {
    flex: 1;
    width: auto;
    min-width: 0;
}

.dropdown a:hover,
.dropdown-link-row:hover .dropdown-tool-link,
.dropdown-link-row:hover .nav-pin-button {
    background-color: rgba(var(--primary-rgb), 0.1);
    color: var(--primary);
}

body.dark .dropdown a:hover,
body.dark .dropdown-link-row:hover .dropdown-tool-link,
body.dark .dropdown-link-row:hover .nav-pin-button {
    background-color: rgba(var(--primary-rgb), 0.2);
    color: var(--primary);
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.2rem;
    min-height: 42px;
    width: 100%;
    border: 2px solid white;
    background-color: transparent;
    color: white;
    text-decoration: none;
    transition: background-color 0.3s, color 0.3s;
    border-radius: 8px; /* Rounded corners for page links */
    text-align: center;
    position: relative;
    white-space: nowrap;
    font-size: 1.05rem;
    cursor: pointer;
}

.page-link:hover {
    background-color: white;
    color: var(--primary);
}

.banner {
    width: 100%;
    position: relative;
    /* The banner always stays brand orange — re-pin the accent vars locally so the
       user's custom primary color does not bleed into the banner or its search. */
    --primary: #FB612F;
    --primary-rgb: 251, 97, 47;
}

.banner-search {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    background: #ffffff !important;
    border: 1px solid rgba(var(--primary-rgb), 0.28);
    border-radius: 22px;
    width: 44px;
    height: 44px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    z-index: 100;
}

.banner-search.expanded {
    width: 320px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: visible;
}

.search-toggle {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: var(--primary);
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-input.inline-search-input {
    width: 0;
    opacity: 0;
    padding: 0;
    border: none;
    background: transparent !important; /* Ensure background doesn't turn dark */
    font-size: 1.1rem;
    color: #000000 !important; /* Force black text */
    transition: width 0.4s ease, opacity 0.2s ease;
    outline: none;
}

.banner-search.expanded .search-input.inline-search-input {
    width: 260px;
    opacity: 1;
    padding: 0 15px 0 5px;
}

.search-input.inline-search-input::placeholder {
    color: #999;
}

body.dark .banner-search {
    background: #ffffff; /* Keep white background for black text as requested */
    background: #ffffff !important;
}

/* Results dropdown position adjusted for oval */
.banner-search-panel.hidden {
    display: none;
}

.banner-search-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: auto;
    width: min(400px, calc(100vw - 2rem));
    max-height: 60vh;
    overflow-y: auto;
    padding: 0.5rem;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(var(--primary-rgb), 0.16);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.12);
    z-index: 1100;
}

body.dark .banner-search-panel {
    background: #20262c;
    border-color: rgba(255, 255, 255, 0.1);
}

/* ── Compact search results in banner panel ─────────────────────────── */
#search-results .shortcut-item {
    min-height: unset;
    padding: 0.35rem 0.5rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    border-radius: 8px;
    background: transparent;
}
#search-results .shortcut-item:hover { background: rgba(var(--primary-rgb),0.07); }
#search-results .shortcut-primary {
    flex-direction: row;
    align-items: center;
    min-height: unset;
    gap: 0.5rem;
}
#search-results .shortcut-item-icon {
    width: 22px;
    height: 22px;
    max-width: 22px;
    max-height: 22px;
    margin-bottom: 0;
    border-radius: 4px;
    flex-shrink: 0;
}
#search-results .shortcut-link {
    font-size: 0.82rem;
    font-weight: 600;
    text-align: left;
    min-height: unset;
    display: block;
}
#search-results .shortcut-meta,
#search-results .pin-button,
#search-results .iframe-badge { display: none; }

.search-section-header {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9ca3af;
    padding: 0.45rem 0.5rem 0.15rem;
}
.search-divider {
    border: none;
    border-top: 1px solid rgba(0,0,0,0.07);
    margin: 0.3rem 0;
}
body.dark .search-divider { border-color: rgba(255,255,255,0.08); }

.search-article-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
}
.search-article-item:hover { background: rgba(var(--primary-rgb),0.07); }
.search-article-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(var(--primary-rgb),0.12);
    color: var(--primary);
    font-size: 0.6rem;
    font-weight: 700;
    flex-shrink: 0;
    letter-spacing: 0.04em;
}
.search-article-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.banner-search-input {
    margin-bottom: 0.65rem;
}

.hidden-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.main-content {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.page {
    display: none; /* Hidden by default */
    flex-grow: 1; /* Active page should fill remaining space */
    flex-direction: column; /* Allow main-content to grow within it */
}

.page.active {
    display: flex; /* Change to flex to allow children to grow */
}

.page h1 {
    color: #000000;
    margin-top: 0;
    margin-bottom: 1rem;
}

body.dark .page h1 {
    color: #ffffff;
}

.tools-area {
    padding: 1rem; /* Padding for the tools area */
    flex-grow: 1; /* Allow tools-area to fill remaining space within main-content */
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.portal-dashboard {
    display: grid;
    gap: 1.25rem;
}

.dashboard-hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: stretch;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
}

.secondary-grid {
    grid-template-columns: minmax(0, 1fr);
}

.dashboard-card,
.today-panel {
    background: rgba(var(--primary-rgb), 0.06);
    border: 1px solid rgba(var(--primary-rgb), 0.16);
    border-radius: 16px;
    padding: 1rem;
}

body.dark .dashboard-card,
body.dark .today-panel {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.hero-copy {
    padding: 1.25rem;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.18), rgba(var(--primary-rgb), 0.04));
    border: 1px solid rgba(var(--primary-rgb), 0.16);
    margin-top: 1.5rem;
}

body.dark .hero-copy {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.22), rgba(255, 255, 255, 0.03));
    border-color: rgba(var(--primary-rgb), 0.25);
}

.eyebrow,
.panel-label,
.tool-category,
.shortcut-meta {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    font-weight: 700;
}

.hero-copy h2,
.card-header h3 {
    margin: 0;
}

.hero-text,
.card-header p,
.today-note,
.search-status,
.quick-action-status,
.empty-state,
.announcement-list {
    margin: 0;
    line-height: 1.5;
}

.hero-copy,
.today-panel,
.dashboard-card {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.05);
}

body.dark .hero-copy,
body.dark .today-panel,
body.dark .dashboard-card {
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.2);
}

.admin-access-section {
    margin-top: 2rem;
}

.pa-card {
    border: 1px solid #e5e7eb;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
    background: #ffffff !important;
    color: #111111 !important;
}
.pa-card * { color: inherit; }
.pa-card .pa-title { font-weight: 700; font-size: .9rem; margin-bottom: 3px; color: #111111 !important; }
.pa-card .pa-meta { font-size: .76rem; color: #6b7280 !important; margin-bottom: 6px; }
.pa-card .pa-meta .pa-submitter { font-weight: 600; color: #374151 !important; }
.pa-card .pa-toggle { font-size: .72rem; color: #d97706 !important; background: none; border: none; cursor: pointer; padding: 0; font-weight: 600; }
.pa-card .pa-detail { display: none; margin-top: 10px; border-top: 1px solid #f3f4f6; padding-top: 10px; color: #374151 !important; font-size: .78rem; line-height: 1.6; }

.admin-divider {
    border: 0;
    border-top: 1px solid rgba(var(--primary-rgb), 0.2);
    margin-bottom: 1.5rem;
}

.admin-access-section h4 {
    margin-bottom: 1rem;
    opacity: 0.8;
}

.card-header {
    display: grid;
    gap: 0.25rem;
    margin-bottom: 0.85rem;
}

/* Centered status/picker card used by the home-page resolver (loading + select) */
.home-status-card {
    max-width: 640px;
    margin: 2rem auto;
    text-align: center;
}

/* Hide the redundant dashboard search bar */
.favorites-card .search-label,
.favorites-card .search-input,
.banner-search-panel .hidden-label {
    display: none;
}

.favorites-card,
.management-card {
    display: grid;
    gap: 0.75rem;
    align-content: start;
}

.search-label {
    font-size: 0.86rem;
    font-weight: 700;
}

.search-input {
    width: 100%;
    padding: 0.8rem 0.9rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    font: inherit;
    background: #ffffff;
    color: #000000;
}

body.dark .search-input {
    background: #20262c;
    border-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.open-pages-menu,
#open-pages-menu-item {
    position: relative;
    display: flex;
    margin-left: auto;
}

/* Align the header dropdown to the right edge of the button */
.open-pages-menu .dropdown {
    right: 0;
    left: auto;
}

.open-pages-empty {
    padding: 0.5rem 0.8rem;
    color: white;
    font-size: 0.9rem;
}

.open-pages-link,
.open-pages-close {
    border: none;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

#open-pages-list .dropdown-tool-link {
    padding: 0 0.8rem;
    min-height: 38px;
}

#open-pages-list .nav-pin-button {
    padding: 0 0.7rem;
    height: 38px;
}

.open-pages-link {
    color: white;
    font-weight: 700;
    text-align: left;
}

.open-pages-close {
    color: var(--primary);
    font-size: 0.8rem;
    font-weight: 700;
}

.open-pages-empty {
    color: #6b7280;
    font-size: 0.9rem;
}

.shortcut-list,
.management-form {
    display: grid;
    gap: 0.75rem;
}

.shortcut-item {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem 0.75rem;
    align-items: start;
    padding: 0.8rem 0.9rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.75);
    min-height: 215px;
}

body.dark .shortcut-item {
    background: rgba(255, 255, 255, 0.03);
}

.iframe-badge {
    position: absolute;
    top: 0.55rem;
    left: 0.55rem;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.25);
    cursor: pointer;
    padding: 0;
}

.shortcut-primary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    justify-content: flex-start;
    min-height: 100%;
}

.shortcut-image-button {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.shortcut-item-icon {
    width: auto;
    height: 72px;
    max-width: 181px;
    max-height: 72px;
    object-fit: contain;
    object-position: center;
    margin-bottom: 0.75rem;
    border-radius: 6px;
}

.shortcut-link {
    color: inherit;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    line-height: 1.25;
    min-height: 38px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.shortcut-meta {
    color: #6b7280;
    text-align: center;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark .shortcut-meta {
    color: #c0cad4;
}

.pin-button,
.quick-action-button,
.urgent-toggle-label {
    border: 1px solid rgba(var(--primary-rgb), 0.28);
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    background-color: transparent;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    text-align: center;
    text-decoration: none;
    user-select: none;
}

.urgent-toggle-label {
    gap: 0.5rem;
}

.urgent-toggle-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.urgent-toggle-text {
    pointer-events: none;
}

.urgent-toggle-label:has(.urgent-toggle-checkbox:checked) {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.pin-button:hover,
.quick-action-button:hover,
.urgent-toggle-label:hover,
.pin-button.pinned,
.quick-action-button:focus {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

body.dark .pin-button,
body.dark .quick-action-button,
body.dark .urgent-toggle-label {
    border-color: rgba(var(--primary-rgb), 0.45);
    color: var(--primary);
}

body.dark .pin-button:hover,
body.dark .quick-action-button:hover,
body.dark .urgent-toggle-label:hover,
body.dark .pin-button.pinned,
body.dark .quick-action-button:focus {
    background: var(--primary);
    color: #ffffff;
}

.empty-state {
    color: #6b7280;
}

body.dark .empty-state {
    color: #c0cad4;
}

.hidden {
    display: none !important;
}

/* Squared Favorites Layout */
#favorites-list.shortcut-list, #all-tools-list .shortcut-list {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    row-gap: 0.75rem;
    column-gap: 0.75rem;
}

#favorites-list .shortcut-item, #all-tools-list .shortcut-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    aspect-ratio: 1 / 1;
    padding: 1.5rem;
    position: relative;
    cursor: grab;
}

#favorites-list .shortcut-item:active, #all-tools-list .shortcut-item:active {
    cursor: grabbing;
}

#favorites-list .shortcut-item.dragging, #all-tools-list .shortcut-item.dragging {
    opacity: 0.4;
    border: 2px dashed var(--primary);
    transform: scale(0.95);
}

#favorites-list .shortcut-item.drop-target, #all-tools-list .shortcut-item.drop-target {
    outline: 3px solid var(--primary);
    outline-offset: -3px;
    background: rgba(var(--primary-rgb), 0.1);
}

/* Prevent children from intercepting drag events to stop flickering */
#favorites-list .shortcut-item.drop-target *, #all-tools-list .shortcut-item.drop-target * {
    pointer-events: none;
}

#favorites-list .shortcut-item.swapping {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    pointer-events: none;
}

#favorites-list .shortcut-meta, .shortcut-list .shortcut-meta {
    grid-column: auto;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

#favorites-list .pin-button, .shortcut-list .pin-button {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 0.5rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.all-tools-horizontal-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.all-tools-category-section {
    background: rgba(var(--primary-rgb), 0.03);
    padding: 1.5rem;
    border-radius: 24px;
    border: 1px solid rgba(var(--primary-rgb), 0.1);
}

.category-header {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(var(--primary-rgb), 0.2);
}

.hero-announcements {
    margin: 1.25rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}


.announcement-item {
    background: rgba(var(--primary-rgb), 0.08);
    padding: 0;
    border-radius: 12px;
    border-left: 4px solid var(--primary);
    font-weight: 500;
    animation: fadeIn 0.5s ease-out;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    overflow: hidden;
    transition: background-color 0.3s, border-color 0.3s;
}

/* Image banner — sits flush at the top of the card */
.announcement-media {
    width: 100%;
    flex-shrink: 0;
    line-height: 0;
}

.announcement-media img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 0;
}

/* ── Announcement Edit Modal ─────────────────────────────────────── */
.announcement-edit-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.announcement-edit-overlay.hidden { display: none; }

.announcement-edit-modal {
    background: var(--bg-card, #fff);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 660px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

body.dark .announcement-edit-modal { background: #1e2028; }

.announcement-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1rem;
}

.announcement-edit-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-muted, #9ca3af);
    opacity: 0.7;
}
.announcement-edit-close:hover { opacity: 1; }

/* ── Floating image resize toolbar ──────────────────────────────── */
.img-resize-toolbar {
    background: rgba(20,20,20,0.92);
    border-radius: 7px;
    padding: 5px 7px;
    display: flex;
    gap: 4px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.4);
    pointer-events: all;
}

.img-resize-toolbar button {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
    color: #fff;
    border-radius: 4px;
    padding: 3px 9px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
}

.img-resize-toolbar button:hover { background: rgba(255,255,255,0.22); }
.img-resize-toolbar button.active { background: var(--primary); border-color: var(--primary); }

.announcement-item.urgent {
    background: rgba(255, 0, 0, 0.25); /* More visible red background */
    border-left-color: #FF0000; /* Red border */
    color: #8B0000; /* Darker red text for contrast */
    font-weight: 700; /* Make text bolder */
}

body.dark .announcement-item.urgent {
    background: rgba(255, 0, 0, 0.35); /* Even more visible in dark mode */
    border-left-color: #FF0000;
    color: #FFDCDC; /* Lighter red text for dark mode */
}

.announcement-item.it-update {
    background: rgba(37, 99, 235, 0.1);
    border-left-color: #2563EB;
    color: #1e3a8a;
    font-weight: 600;
}

body.dark .announcement-item.it-update {
    background: rgba(59, 130, 246, 0.18);
    border-left-color: #3b82f6;
    color: #bfdbfe;
}

.it-update-toggle-label {
    border-color: rgba(37, 99, 235, 0.4) !important;
    color: #2563EB !important;
}

.it-update-toggle-label .urgent-toggle-checkbox {
    accent-color: #2563EB !important;
}

.it-update-toggle-label:has(.urgent-toggle-checkbox:checked) {
    background-color: #2563EB !important;
    color: white !important;
    border-color: #2563EB !important;
}

body.dark .it-update-toggle-label {
    border-color: rgba(59, 130, 246, 0.5) !important;
    color: #60a5fa !important;
}

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

.announcement-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-start;
    text-align: left;
    flex: 1;
    min-width: 0;
    padding: 0.85rem 1rem 0.85rem;
}

.announcement-date {
    font-size: 0.75rem;
    opacity: 0.7;
    font-weight: 400;
}

.announcement-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0 1rem 0.6rem;
}

.announcement-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.quick-action-button.small {
    height: 30px;
    padding: 0 0.8rem;
    font-size: 0.85rem;
}

.announcement-history-box {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    width: 100%;
    font-size: 0.9rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.announcement-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.announcement-editor:empty::before {
    content: attr(data-placeholder);
    color: #9ca3af;
    pointer-events: none;
    display: block;
}

.announcement-editor img {
    max-width: 100%;
    border-radius: 6px;
    vertical-align: middle;
    cursor: default;
}

.announcement-body img {
    max-width: 85%;
    max-height: 400px;
    margin: 12px 0;
    border-radius: 6px;
    vertical-align: middle;
}

.announcement-body img.small-icon, 
.announcement-content img.small-icon {
    height: 48px !important;
    width: auto !important;
    max-height: 48px !important;
    max-width: 85% !important;
    object-fit: contain;
    margin: 6px 0 !important;
    display: block;
    border-radius: 4px;
}

/* --- Polls -----------------------------------------------------------------
   A poll renders inside the announcement card it belongs to, so everything here
   is scoped to .poll-* and inherits the card's own padding and colours. Colours
   go through the primary-rgb / greyscale-alpha pattern used above so both
   themes work without a body.dark override for every rule. */
.poll-box {
    margin: 0.75rem 0 0.25rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid rgba(var(--primary-rgb), 0.18);
    border-radius: 10px;
    background: rgba(var(--primary-rgb), 0.04);
}

.poll-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.55rem;
}

.poll-chip {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 7px;
    border-radius: 99px;
    background: rgba(var(--primary-rgb), 0.14);
    color: var(--primary);
}

.poll-deadline {
    font-size: 0.74rem;
    opacity: 0.6;
}

.poll-options {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.poll-option {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.12s;
}

.poll-option:hover {
    background: rgba(var(--primary-rgb), 0.08);
}

.poll-option input {
    accent-color: var(--primary);
    flex-shrink: 0;
    cursor: pointer;
}

.poll-action-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.55rem;
}

.poll-status {
    font-size: 0.75rem;
    color: #ef4444;
}

.poll-result {
    margin-bottom: 0.45rem;
}

.poll-result-label {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.86rem;
    margin-bottom: 3px;
}

.poll-result.mine .poll-result-label {
    font-weight: 700;
    color: var(--primary);
}

.poll-result-count {
    font-size: 0.76rem;
    opacity: 0.65;
    white-space: nowrap;
}

.poll-bar {
    height: 7px;
    border-radius: 99px;
    background: rgba(128, 128, 128, 0.16);
    overflow: hidden;
}

.poll-bar > span {
    display: block;
    height: 100%;
    border-radius: 99px;
    background: rgba(var(--primary-rgb), 0.45);
    transition: width 0.25s ease;
}

.poll-result.mine .poll-bar > span {
    background: var(--primary);
}

.poll-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(128, 128, 128, 0.14);
}

.poll-voted-count {
    font-size: 0.74rem;
    opacity: 0.6;
}

/* Poll builder — announcement manager only */
.poll-builder {
    margin-top: 0.75rem;
    padding: 0.8rem;
    border: 1px dashed rgba(var(--primary-rgb), 0.3);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.poll-builder.hidden { display: none; }

.poll-builder-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.poll-builder-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.55;
}

.poll-mode-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.84rem;
    cursor: pointer;
}

.poll-mode-label input { accent-color: var(--primary); cursor: pointer; }

.poll-builder-options {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.poll-option-input,
.poll-deadline-input {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(var(--primary-rgb), 0.25);
    background: rgba(var(--primary-rgb), 0.05);
    font-size: 0.86rem;
    color: inherit;
    font-family: inherit;
}

.poll-deadline-input { width: 220px; }

.poll-builder-hint {
    font-size: 0.72rem;
    opacity: 0.55;
}

.announcement-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid rgba(128,128,128,0.2);
    background: rgba(128,128,128,0.06);
    cursor: pointer;
    font-size: .82rem;
    line-height: 1.6;
    transition: background .15s, border-color .15s;
}

.reaction-pill:hover {
    background: rgba(var(--primary-rgb),0.08);
    border-color: rgba(var(--primary-rgb),0.25);
}

.reaction-pill.mine {
    background: rgba(var(--primary-rgb),0.12);
    border-color: rgba(var(--primary-rgb),0.4);
    color: var(--primary);
    font-weight: 600;
}

.reaction-picker-wrapper {
    position: relative;
    display: inline-flex;
}

.reaction-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 12px;
    border: 1px dashed rgba(128,128,128,0.35);
    background: none;
    cursor: pointer;
    font-size: .8rem;
    color: #9ca3af;
    transition: border-color .15s, color .15s;
}

.reaction-add-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.reaction-picker {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    display: flex;
    gap: 2px;
    background: var(--card-bg, #fff);
    border: 1px solid rgba(128,128,128,0.15);
    border-radius: 12px;
    padding: 6px 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.13);
    z-index: 200;
}

.reaction-picker.hidden { display: none; }

body.dark .reaction-picker {
    background: #1f2937;
    border-color: rgba(255,255,255,0.1);
}

.reaction-emoji-option {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    padding: 3px 5px;
    border-radius: 6px;
    transition: background .1s, transform .1s;
    line-height: 1;
}

.reaction-emoji-option:hover {
    background: rgba(128,128,128,0.12);
    transform: scale(1.2);
}

.iframe-wrapper {
    position: relative;
    width: 100%;
    flex-grow: 1; /* Allow iframe-wrapper to fill remaining space */
    display: flex;
    flex-direction: column;
    border-radius: 16px;
}

.iframe-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.5s ease, visibility 0.5s;
}

body.dark .iframe-overlay {
    background: rgba(43, 49, 56, 0.98);
}

.overlay-card {
    text-align: center;
    padding: 2.5rem;
    max-width: 400px;
}

.overlay-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.iframe-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}


.management-iframe {
    width: 100%;
    height: 100%; /* Make iframe fill its parent */
    border: none; /* Remove border */
    min-height: auto; /* Remove fixed min-height */
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);

}

body.dark .management-iframe {
    background: #20262c;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

#management-protected {
    display: grid;
    gap: 1rem;
}

.account-summary {
    display: grid;
    gap: 0.65rem;
}

.account-summary-row {
    display: grid;
    grid-template-columns: minmax(140px, 180px) minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.75);
}

body.dark .account-summary-row {
    background: rgba(255, 255, 255, 0.03);
}

.account-summary-label {
    font-weight: 700;
    color: #6b7280;
}

body.dark .account-summary-label {
    color: #c0cad4;
}

.account-summary-error-row {
    background-color: rgba(255, 0, 0, 0.1); /* Light red background */
    border: 1px solid rgba(255, 0, 0, 0.3); /* Red border */
}

body.dark .account-summary-error-row {
    background-color: rgba(255, 0, 0, 0.15);
    border-color: rgba(255, 0, 0, 0.4);
}



.account-summary-value {
    overflow-wrap: anywhere;
}

.account-raw-data {
    margin: 0;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.08);
    overflow: auto;
    font-size: 0.82rem;
    line-height: 1.45;
    white-space: pre-wrap;
}

body.dark .account-raw-data {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.sign-in-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.filter-field {
    display: grid;
    gap: 0.45rem;
}

.sign-in-log-list {
    display: grid;
    gap: 0.65rem;
}

.sign-in-log-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    padding: 0.8rem 0.9rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.75);
}

body.dark .sign-in-log-item {
    background: rgba(255, 255, 255, 0.03);
}

.sign-in-log-username {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.sign-in-log-timestamp {
    color: #6b7280;
    white-space: nowrap;
}

body.dark .sign-in-log-timestamp {
    color: #c0cad4;
}

@media (max-width: 900px) {
    .dashboard-hero,
    .dashboard-grid,
    .secondary-grid {
        grid-template-columns: 1fr;
    }

    header {
        flex-wrap: wrap;
    }

    .header-left,
    h1,
    .header-right {
        flex: 1 1 100%;
    }

    .header-left {
        justify-content: flex-start;
    }

    h1 {
        text-align: left;
    }

    .header-right {
        justify-content: space-between;
    }

    .management-nav-item {
        margin-left: 0;
    }

    .account-summary-row {
        grid-template-columns: 1fr;
    }

    .sign-in-log-item {
        grid-template-columns: 1fr;
    }
}

.sub-dropdown-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 65px 0 0.8rem;
    color: #111;
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.3s, color 0.3s;
    position: relative;
    cursor: pointer;
    min-height: 38px;
    line-height: 1.2;
}

body.dark .sub-dropdown-toggle {
    color: #f0f0f0;
}

.sub-dropdown-toggle::after {
    content: '▶';
    position: absolute;
    right: 0;
    top: 0;
    width: 65px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 1px solid rgba(0, 0, 0, 0.12);
    font-size: 0.7rem;
    margin: 0;
    transition: transform 0.3s;
}

body.dark .sub-dropdown-toggle::after {
    border-left-color: rgba(255, 255, 255, 0.15);
}

.sub-dropdown-toggle.open::after {
    content: '▼';
}

.dropdown li:has(> .sub-dropdown)::after {
    content: '';
    position: absolute;
    top: 0;
    left: 100%;
    width: 12px;
    height: 100%;
}

.sub-dropdown {
    display: none !important;
    list-style: none;
    padding: 0.1rem 0;
    margin: 0.05rem 0 0 0;
    background-color: #ffffff;
    border-radius: 8px;
    border: 2px solid var(--primary);
    position: absolute;
    top: 0;
    left: 100%;
    width: max-content;
    min-width: 220px;
    z-index: 1001;
}

body.dark .sub-dropdown {
    background-color: #1e2330;
}

.sub-dropdown.show {
    display: block !important;
}

/* Add leeway buffer around sub-dropdowns */
.sub-dropdown::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    z-index: -1;
}

.sub-dropdown li {
    margin: 0;
    width: 100%;
}

.sub-dropdown a {
    color: #111;
    text-decoration: none;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 0.8rem;
    min-height: 38px;
    transition: background-color 0.3s, color 0.3s;
    font-size: 1.1rem;
    line-height: 1.2;
}

body.dark .sub-dropdown a {
    color: #f0f0f0;
}

/* Nav-level settings + bell controls (left side of nav bar) */
.nav-left-controls {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 1100;
}

.nav-left-controls .profile-icon-link {
    margin-left: 0;
}

/* ---- Mega Menu (Personal Tools full-width dropdown) ---- */
/* li is position:static so the <ul> (position:relative) is the containing block;
   left:0/right:0 spans the full tab-bar width, centering the dropdown */
.top-nav li:has(> .mega-dropdown) {
    position: static;
}

.top-nav li:has(> .mega-dropdown)::after {
    display: none;
}

/* ── Mega panel ──
   A component in its own right, NOT a `.dropdown`. It used to carry both
   classes and then fight the inherited geometry with eight `!important`
   declarations — which is how `left: 0 !important` came to silently outrank the
   JS that positions it, and how a `min-width` floor could overflow the panel
   unnoticed. `.dropdown` also forces `display: none !important`, which is why
   `.show` needed `!important` to undo. Detaching the markup (index.html) means
   every declaration here is a plain one that says what it means.

   Sized to its own content rather than stretched across the bar, so a
   one-column panel is one column wide. positionMegaDropdown() in script.js
   aims it at its tab and nudges it back inside the window. */
.mega-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    width: max-content;
    max-width: calc(100vw - 24px);
    padding: 0;
    background-color: #ffffff;
    border: 2px solid var(--primary);
    border-top: none;
    border-radius: 0 0 10px 10px;
    /* The <ul> bottom sits 0.25rem above the nav's bottom (nav's padding-bottom);
       this margin pushes the panel past that gap so it clears the orange bar.
       The open tab's ::before bridges the same gap for the pointer. */
    margin-top: 0.25rem;
    /* Wrapped columns make the panel taller, so cap it at the viewport and let
       it scroll — otherwise the extra rows fall off the bottom of the screen,
       which is the same unreachable-link problem in the other axis. The height
       allowance is measured in syncNavStacking() — see --mega-max-h. */
    max-height: var(--mega-max-h, calc(100vh - 170px));
    overflow-y: auto;
    overscroll-behavior: contain;
}

.mega-dropdown.show {
    display: block;
}

body.dark .mega-dropdown {
    background-color: #1e2330;
}

/* The column strip wraps. `flex: 1` alone can't shrink a column below its
   longest link (min-width defaults to auto, and the links are nowrap), so five
   columns held a hard 1289px floor and simply painted outside the panel at any
   viewport under ~1300px — links you could see but never reach, with no scroll.
   `min-width: 0` lets a column narrow, the 200px basis stops it collapsing to
   unreadable, and wrapping moves the overflow onto a second row instead of
   off-screen. */
.mega-columns {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
}

.mega-column {
    /* `flex-basis: auto` so a panel sized to max-content reports the sum of its
       columns' real widths — with a fixed 200px basis the basis won, and a
       two-column panel wrapped to two rows on a 1600px screen. min-width keeps a
       clamped column readable; wrapping (not overflow) absorbs the rest. */
    flex: 1 1 auto;
    min-width: 200px;
    padding: 1.1rem 1.4rem;
    border-right: 1px solid rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.mega-column:last-child {
    border-right: none;
}

/* Apps → "Your Tools" holds nothing but permission-gated links, so a user with
   none of those grants would see a header and a divider over empty space. Drop
   any column with no visible link left in it. Done in CSS rather than JS so it
   reacts the instant a permission check toggles `.hidden`, with no ordering
   dependency on when that check resolves.

   Descendant `a`, not `> a`: enhanceMegaMenuWithPins() wraps authorized links in
   a .mega-link-row, while links the user isn't authorized for are skipped and
   stay bare children — so the visible ones are a level deeper than the hidden
   ones and a child selector would match nothing after init. */
.mega-column:not(:has(a:not(.hidden))) {
    display: none;
}

.mega-col-header {
    color: rgba(0, 0, 0, 0.5);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.55rem;
    padding-bottom: 0.45rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.15);
    width: 100%;
    text-align: center;
}

/* Pin row: inline-flex so it only takes up the width of text + icon */
.mega-link-row {
    display: inline-flex;
    align-items: center;
    border-radius: 6px;
    padding: 0.15rem 0.3rem;
    transition: background-color 0.2s;
    max-width: 100%;
}

.mega-link-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    border-radius: 3px;
    flex-shrink: 0;
}

.mega-link-row:hover {
    background-color: rgba(var(--primary-rgb), 0.1);
}

/* No `!important` here either: these two selectors are more specific than the
   `.page-link` bubble styles they need to beat, and `.dropdown a` no longer
   applies at all now that the panel isn't a .dropdown. */
.mega-link-row > a,
.mega-link-row .page-link {
    color: #111;
    text-decoration: none;
    font-size: 1rem;
    min-height: 28px;
    display: flex;
    align-items: center;
    border: none;
    background: transparent;
    padding: 0.1rem 0.25rem;
    /* Wraps rather than nowrap: a long label ("Presale - Digital Contact Card")
       used to set an unshrinkable floor for its whole column. Two lines is
       better than a link that's off the panel. */
    white-space: normal;
    overflow-wrap: anywhere;
    width: auto;
}

.mega-link-row > a:hover,
.mega-link-row .page-link:hover {
    background-color: transparent;
    color: var(--primary);
}

/* Compact pin button — no border, sits right next to text */
.mega-link-row .nav-pin-button {
    width: 22px;
    height: 22px;
    padding: 0;
    border-left: none !important;
    border-radius: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}

.mega-link-row:hover .nav-pin-button {
    opacity: 1;
    color: #555;
}

.mega-link-row .nav-pin-button.pinned {
    opacity: 1;
    color: var(--primary);
    background: transparent !important;
}

.mega-dropdown.show .mega-link-row .nav-pin-button {
    opacity: 0.55;
    color: #999;
}

.mega-dropdown.show .mega-link-row:hover .nav-pin-button {
    opacity: 1;
    color: #555;
}

.mega-dropdown.show .mega-link-row .nav-pin-button.pinned {
    opacity: 1;
    color: var(--primary);
    background: transparent !important;
}

/* Tool entries (Note Generator, Email Templates) with author label */
.mega-tool-entry {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mega-tool-author {
    font-size: 0.68rem;
    color: rgba(0, 0, 0, 0.45);
    margin-top: -0.15rem;
    padding: 0 0.25rem 0.2rem;
    text-align: center;
}

/* Bare links not yet wrapped by JS (fallback) */
.mega-column > a:not(.mega-col-header) {
    color: #111;
    text-decoration: none;
    font-size: 1rem;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}
/* ---- End Mega Menu ---- */

/* ---- Dark mode mega menu overrides ---- */
body.dark .mega-column {
    border-right-color: rgba(255, 255, 255, 0.12);
}

body.dark .mega-col-header {
    color: rgba(255, 255, 255, 0.6);
    border-bottom-color: rgba(255, 255, 255, 0.18);
}

body.dark .mega-link-row > a,
body.dark .mega-link-row .page-link {
    color: #f0f0f0 !important;
}

body.dark .mega-link-row > a:hover,
body.dark .mega-link-row .page-link:hover {
    color: var(--primary) !important;
}

body.dark .mega-link-row:hover {
    background-color: rgba(var(--primary-rgb), 0.2);
}

body.dark .mega-tool-author {
    color: rgba(255, 255, 255, 0.45);
}

body.dark .mega-column > a:not(.mega-col-header) {
    color: #f0f0f0;
}

body.dark .mega-link-row .nav-pin-button,
body.dark .mega-dropdown.show .mega-link-row .nav-pin-button {
    color: rgba(255, 255, 255, 0.5);
}

body.dark .mega-link-row:hover .nav-pin-button,
body.dark .mega-dropdown.show .mega-link-row:hover .nav-pin-button {
    color: rgba(255, 255, 255, 0.85);
}

/* ---- Nav Panels (Settings / Notifications) ---- */
.nav-icon-wrapper {
    position: relative;
}

.nav-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: auto;
    min-width: 240px;
    background: #ffffff;
    border: 2px solid var(--primary);
    border-radius: 10px;
    padding: 0.85rem;
    z-index: 2000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-panel.hidden {
    display: none !important;
}

body.dark .nav-panel {
    background: #1e2330;
}

.nav-panel-header {
    font-size: 0.9rem;
    color: #111;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark .nav-panel-header {
    color: #f0f0f0;
}

.nav-panel-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    margin: 0.1rem 0;
}

body.dark .nav-panel-divider {
    background: rgba(255, 255, 255, 0.12);
}

.nav-panel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.nav-panel-label {
    font-size: 0.875rem;
    color: #333;
}

body.dark .nav-panel-label {
    color: #ccc;
}

.nav-panel-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav-panel-btn {
    background: rgba(var(--primary-rgb), 0.07);
    border: 1px solid rgba(var(--primary-rgb), 0.22);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    color: #333;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s, color 0.2s;
    width: 100%;
}

.nav-panel-btn:hover {
    background: rgba(var(--primary-rgb), 0.18);
    color: var(--primary);
}

body.dark .nav-panel-btn {
    color: #f0f0f0;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

body.dark .nav-panel-btn:hover {
    background: rgba(var(--primary-rgb), 0.25);
    color: var(--primary);
}

.nav-panel-primary {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
    font-weight: 600;
}

.nav-panel-primary:hover {
    background: #e05020 !important;
    color: white !important;
}

.nav-panel-list {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.notif-compact-item {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(128,128,128,0.1);
    border-left: 3px solid transparent;
    cursor: default;
    transition: background .15s;
}
.notif-compact-item:last-child { border-bottom: none; }
.notif-compact-item:hover { background: rgba(128,128,128,0.07); }
.notif-compact-item.notif-urgent { border-left-color: #ef4444; }
.notif-compact-item.notif-it { border-left-color: #f97316; }

body.dark .notif-compact-item { border-bottom-color: rgba(255,255,255,0.07); }
body.dark .notif-compact-item:hover { background: rgba(255,255,255,0.05); }

.notif-compact-text {
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--text-primary, #111);
    margin-bottom: 3px;
}
body.dark .notif-compact-text { color: #e5e7eb; }

.notif-compact-meta {
    font-size: 0.7rem;
    color: #9ca3af;
}

#notification-panel {
    min-width: 340px;
}

.nav-panel-subheader {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #9ca3af;
    padding: 0 2px 2px;
    font-weight: 600;
}

.notif-recap-card {
    background: rgba(var(--primary-rgb), 0.05);
    border: 1px solid rgba(var(--primary-rgb), 0.14);
    border-radius: 8px;
    padding: 6px 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
body.dark .notif-recap-card {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.1);
}

.notif-recap-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .13s;
}
.notif-recap-row:hover { background: rgba(var(--primary-rgb), 0.1); }
.notif-recap-row--soon { cursor: default; opacity: .55; }
.notif-recap-row--soon:hover { background: transparent; }

.notif-recap-label {
    font-size: 0.84rem;
    color: var(--text-primary, #111);
}
body.dark .notif-recap-label { color: #e5e7eb; }

.notif-recap-badge {
    font-size: 0.78rem;
    font-weight: 700;
    min-width: 22px;
    text-align: center;
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary);
    border-radius: 12px;
    padding: 1px 7px;
}
body.dark .notif-recap-badge { background: rgba(var(--primary-rgb), 0.25); }

.notif-recap-badge--soon {
    background: rgba(156,163,175,0.2);
    color: #9ca3af;
    font-weight: 500;
    font-size: 0.72rem;
}

.nav-panel-empty {
    margin: 0;
    font-size: 0.85rem;
    color: #888;
    text-align: center;
    padding: 0.5rem 0;
}

body.dark .nav-panel-empty {
    color: #aaa;
}

.nav-panel .switch {
    flex-shrink: 0;
}
/* ---- End Nav Panels ---- */

.nav-pin-button {
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0;
    padding: 0 0.7rem;
    width: 65px;
    flex-shrink: 0;
    background: transparent;
    color: white;
    font-size: 0.78rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-pin-button.pinned {
    background: transparent;
    color: var(--primary);
}

body.dark .nav-pin-button {
    border-left-color: rgba(255, 255, 255, 0.18);
}
.iframe-page-actions {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.dynamic-iframe-page .main-content,
.dynamic-iframe-page .tools-area {
    padding-top: 0;
    padding-bottom: 0;
}

#customer-journey-page .main-content,
#management-dashboard-page .main-content,
#management-dashboard-page .tools-area,
#sales-order-management-page .main-content,
#sales-order-management-page .tools-area,
#directsales-home-page .main-content,
#directsales-home-page .tools-area,
#announcement-history-page .main-content,
#announcement-history-page .tools-area,
#home-page .main-content,
#home-page .tools-area,
#note-generator-page .main-content,
#note-generator-page .tools-area,
#email-templates-page .main-content,
#email-templates-page .tools-area,
#profile-page .main-content,
#profile-page .tools-area,
#tsr-gui-page .main-content,
#tsr-gui-page .tools-area,
#my-evals-page .main-content,
#my-evals-page .tools-area,
#org-chart-page .main-content,
#org-chart-page .tools-area,
#qa-evaluation-manager-page .main-content,
#qa-evaluation-manager-page .tools-area {
    padding-top: 0;
    padding-bottom: 0;
}

#tachus-shenandoah-page {
    overflow: hidden;
}
#tachus-shenandoah-page .layout {
    height: 100%;
}

#management-dashboard-page .tools-area {
    gap: 16px;
}

#management-dashboard-page h1,
#announcement-history-page h1,
#profile-page h1,
.dynamic-iframe-page h1 {
    display: none;
}

.management-iframe {
    width: 100%;
    min-height: auto; /* Remove fixed min-height */
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

#management-dashboard-page .management-iframe,
.dynamic-iframe-page .management-iframe {
    border-radius: 0;
    box-shadow: none;
}

.iframe-page-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0;
    flex-wrap: wrap;
}

/* --- Note Generator & Tools Integration Styles --- */

.tool-page-wrap {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.note-sub-btn {
    padding: 0.6rem 1.25rem;
    border: none;
    background: transparent;
    color: #75787B;
    border-radius: 8px;
    cursor: pointer;
    font: 700 0.9rem sans-serif;
    transition: all 0.2s ease;
}


.note-sub-btn:hover, .note-sub-btn.active,
.email-mini-btn:hover, .email-mini-btn.active,
.email-mini-btn-active {
    background: var(--primary);
    color: white !important;
}

.etf-generate-btn {
    color: #ffffff !important;
}

.note-sub-page {
    display: none;
}

.note-sub-page.active {
    display: block;
}

.note-with-sidebar,
.email-template-form {
    display: flex;
    flex-direction: row-reverse;
    gap: 0.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .note-with-sidebar,
    .email-template-form { flex-direction: column-reverse; padding: 1rem; }
}

.note-info-panel {
    background: rgba(var(--primary-rgb), 0.04);
    border: 1px solid rgba(var(--primary-rgb), 0.16);
    border-radius: 16px;
    padding: 1.25rem;
    position: sticky;
    top: 1rem;
}

body.dark .note-info-panel {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

.info-panel-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--primary);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.info-panel-icon {
    background: var(--primary);
    padding: 5px;
    border-radius: 6px;
    display: flex;
}

.info-panel-section-title {
    font-weight: 700;
    margin: 1rem 0 0.5rem 0;
    font-size: 0.9rem;
}

.info-panel-list {
    padding-left: 1.25rem;
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.4;
    opacity: 0.85;
}

/* --- Form Elements for Tools --- */

.section-label {
    color: var(--primary);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.section-divider {
    grid-column: 1 / -1;
    border: 0;
    border-top: 1px solid rgba(var(--primary-rgb), 0.15);
    margin: 1rem 0;
}

.provider-btn-group, .equip-btn-group, .yes-no-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.provider-btn, .equip-btn, .yes-no-buttons button {
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    background: transparent;
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.provider-btn.active, .equip-btn.active, .yes-no-buttons button.active,
.provider-btn:hover, .equip-btn:hover, .yes-no-buttons button:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.output-section {
    margin-top: 2rem;
    background: rgba(var(--primary-rgb), 0.05);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid rgba(var(--primary-rgb), 0.1);
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

#generatedNote, #hdGeneratedNote, #dpGeneratedNote, #cecrGeneratedNote, #ncGeneratedNote, #cgGeneratedNote {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    background: #ffffff;
    color: #333;
}

body.dark #generatedNote, body.dark #hdGeneratedNote, body.dark #dpGeneratedNote, 
body.dark #cecrGeneratedNote, body.dark #ncGeneratedNote, body.dark #cgGeneratedNote {
    background: #20262c;
    color: #e0e0e0;
    border-color: rgba(255, 255, 255, 0.1);
}

/* ── Feedback Modal ── */
.feedback-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.feedback-modal {
    background: #ffffff;
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}

body.dark .feedback-modal {
    background: #2b3138;
    color: #ffffff;
}

.feedback-modal-title {
    margin: 0;
    font-size: 1.2rem;
    color: var(--primary);
}

.feedback-type-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.feedback-type-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
}

.feedback-type-label input[type="radio"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.feedback-input,
.feedback-textarea {
    width: 100%;
    padding: 0.75rem 0.9rem;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 10px;
    font: inherit;
    font-size: 0.95rem;
    background: #ffffff;
    color: #000000;
    resize: vertical;
}

body.dark .feedback-input,
body.dark .feedback-textarea {
    background: #20262c;
    border-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.feedback-input:focus,
.feedback-textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.feedback-modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.feedback-status {
    margin: 0;
    font-size: 0.9rem;
    text-align: center;
}

/* ═══════════════════════════════════════════════
   SIDE PANEL BUTTONS STACK (Chat + Notes)
   ═══════════════════════════════════════════════ */

.side-panel-btns {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 990;
}

.chat-panel-btn {
    display: flex;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px 0 0 8px;
    padding: 14px 10px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    box-shadow: -2px 0 12px rgba(0,0,0,0.2);
    transition: background 0.2s, padding-right 0.2s;
}
.chat-panel-btn.hidden { display: none !important; }

.chat-panel-btn:hover {
    background: #e5511a;
    padding-right: 14px;
}

.chat-panel-btn-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.chat-panel-btn-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    text-transform: uppercase;
}

/* ═══════════════════════════════════════════════
   ONENOTE PANEL
   ═══════════════════════════════════════════════ */

.onenote-panel-btn {
    background: #7B1FA2;
    color: #fff;
    border: none;
    border-radius: 8px 0 0 8px;
    padding: 14px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    box-shadow: -2px 0 12px rgba(0,0,0,0.2);
    transition: background 0.2s, padding-right 0.2s;
}

.onenote-panel-btn:hover {
    background: #6A1B9A;
    padding-right: 14px;
}

.onenote-btn-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.onenote-btn-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    text-transform: uppercase;
}

/* ── Reference Guide tab (matches Notes tab, orange) ── */
.ref-panel-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px 0 0 8px;
    padding: 14px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    box-shadow: -2px 0 12px rgba(0,0,0,0.2);
    transition: background 0.2s, padding-right 0.2s;
}

.ref-panel-btn:hover {
    background: #e5511a;
    padding-right: 14px;
}

.ref-panel-btn-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.ref-panel-btn-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    text-transform: uppercase;
}

/* ── Notes panel: body shift when open ── */
body {
    transition: padding-right 0.32s ease;
}
body.notes-panel-open {
    padding-right: var(--notes-panel-width, 380px);
}
body.notes-panel-open.notes-panel-fullscreen {
    padding-right: 0 !important;
}
body.notes-resizing {
    user-select: none;
    cursor: ew-resize !important;
}
body.notes-resizing,
body.notes-resizing .onenote-panel,
body.notes-resizing .side-panel-btns {
    transition: none !important;
}

/* ── Side buttons shift to panel edge ── */
body.notes-panel-open .side-panel-btns {
    right: var(--notes-panel-width, 380px);
    transition: right 0.32s ease;
}
body.notes-panel-open.notes-panel-fullscreen .side-panel-btns {
    display: none;
}

/* ── Chat panel — page shift (mirrors notes panel pattern) ── */
body.chat-panel-open {
    padding-right: 380px;
    transition: padding-right 0.3s ease;
}
body.chat-panel-open .side-panel-btns {
    right: 380px;
    transition: right 0.3s ease;
}

/* ── Both panels open — split height, shared 380px column ── */
body.chat-panel-open.notes-panel-open .chat-side-panel {
    height: 50vh;
    top: 0;
}
body.chat-panel-open.notes-panel-open .onenote-panel {
    height: 50vh;
    top: 50vh;
}

/* ── Hide header notification + profile icons while chat panel is open ── */
body.chat-panel-open .notification-bell-container,
body.chat-panel-open #profile-icon-link {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* ── Resize handle ── */
.notes-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: ew-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.15s;
}
.notes-resize-handle:hover,
body.notes-resizing .notes-resize-handle {
    background: rgba(123, 31, 162, 0.25);
}

/* ── Panel ── */
.onenote-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--notes-panel-width, 380px);
    height: 100vh;
    background: #fff;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    transform: translateX(100%);
    transition: transform 0.32s ease, width 0.32s ease, top 0.32s ease, height 0.32s ease;
}
body.dark .onenote-panel {
    background: #1a1f25;
    color: #e5e7eb;
}
.onenote-panel.open {
    transform: translateX(0);
}
.onenote-panel.fullscreen {
    top: var(--portal-nav-height, 54px);
    width: 100% !important;
    height: calc(100vh - var(--portal-nav-height, 54px));
    box-shadow: none;
}

.onenote-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 12px 20px;
    background: #7B1FA2;
    color: #fff;
    flex-shrink: 0;
}
.onenote-panel-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.onenote-panel-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.onenote-header-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
    transition: opacity 0.15s, background 0.15s;
}
.onenote-header-btn:hover { opacity: 1; background: rgba(255,255,255,0.2); }

.onenote-header-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

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

.onenote-panel-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}

.onenote-panel-close:hover {
    background: rgba(255,255,255,0.2);
}

.onenote-panel-tabs {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    flex-shrink: 0;
}

body.dark .onenote-panel-tabs {
    border-color: rgba(255,255,255,0.1);
}

.onenote-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    color: #6b7280;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

body.dark .onenote-tab {
    color: #9ca3af;
}

.onenote-tab.active {
    color: #7B1FA2;
    border-color: #7B1FA2;
}

body.dark .onenote-tab.active {
    color: #ce93d8;
    border-color: #ce93d8;
}

.onenote-tab:hover:not(.active) {
    color: #374151;
}

body.dark .onenote-tab:hover:not(.active) {
    color: #d1d5db;
}

.onenote-panel-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 12px;
}

.onenote-init-status {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.85rem;
    background: #f3e5f5;
    color: #4a148c;
    border-left: 3px solid #7B1FA2;
}

body.dark .onenote-init-status {
    background: #2d1b3d;
    color: #ce93d8;
    border-color: #9c27b0;
}

.onenote-init-status.error {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #ef4444;
}

body.dark .onenote-init-status.error {
    background: #3d1b1b;
    color: #fca5a5;
    border-color: #ef4444;
}

.onenote-init-status.hidden {
    display: none;
}

.onenote-view {
    display: none;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.onenote-view.active {
    display: flex;
}

.onenote-note-title {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    background: #fff;
    color: #111;
    box-sizing: border-box;
}

body.dark .onenote-note-title {
    background: #20262c;
    border-color: rgba(255,255,255,0.12);
    color: #e5e7eb;
}

.onenote-note-title:focus {
    outline: none;
    border-color: #7B1FA2;
}

.onenote-note-content {
    flex: 1;
    min-height: 200px;
    width: 100%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    background: #fff;
    color: #111;
    box-sizing: border-box;
    overflow-y: auto;
    outline: none;
    line-height: 1.6;
}
.onenote-note-content:empty:before {
    content: attr(data-placeholder);
    color: #9ca3af;
    pointer-events: none;
}
.onenote-note-content:focus {
    border-color: #7B1FA2;
}
body.dark .onenote-note-content {
    background: #20262c;
    border-color: rgba(255,255,255,0.12);
    color: #e5e7eb;
}

.onenote-save-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.onenote-new-btn {
    background: transparent;
    color: #7B1FA2;
    border: 1px solid #7B1FA2;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.onenote-new-btn:hover {
    background: #7B1FA2;
    color: #fff;
}

.onenote-save-btn {
    background: #7B1FA2;
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.onenote-save-btn:hover {
    background: #6A1B9A;
}

.onenote-save-btn:disabled {
    background: #a78bca;
    cursor: not-allowed;
}

.onenote-save-status {
    font-size: 0.8rem;
    color: #22c55e;
}

.onenote-save-status.error {
    color: #ef4444;
}

/* ── Formatting toolbar ── */
.onenote-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    background: #f3e5f5;
    border: 1px solid #d1b3e0;
    border-radius: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}
body.dark .onenote-toolbar {
    background: #2d1b3d;
    border-color: rgba(123,31,162,0.4);
}
.onenote-fmt-btn {
    background: transparent;
    border: none;
    width: 28px;
    height: 26px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #4a148c;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, color 0.12s;
    font-family: inherit;
    flex-shrink: 0;
}
.onenote-fmt-btn:hover {
    background: rgba(123,31,162,0.15);
}
.onenote-fmt-btn.active {
    background: #7B1FA2;
    color: #fff;
}
body.dark .onenote-fmt-btn {
    color: #ce93d8;
}
body.dark .onenote-fmt-btn:hover {
    background: rgba(123,31,162,0.3);
}
body.dark .onenote-fmt-btn.active {
    background: #7B1FA2;
    color: #fff;
}
.onenote-toolbar-sep {
    width: 1px;
    height: 18px;
    background: #c4a0d8;
    margin: 0 3px;
    flex-shrink: 0;
}
body.dark .onenote-toolbar-sep {
    background: rgba(123,31,162,0.45);
}
/* images inserted into the note */
.onenote-note-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 4px 0;
    display: block;
}

.onenote-browse-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.onenote-browse-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

body.dark .onenote-browse-label {
    color: #9ca3af;
}

.onenote-refresh-btn {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: #7B1FA2;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}

.onenote-refresh-btn:hover {
    background: rgba(123,31,162,0.1);
}

.onenote-pages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.onenote-page-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.onenote-page-item:hover {
    background: #f3e5f5;
    border-color: #ce93d8;
}

body.dark .onenote-page-item {
    background: #252d35;
    border-color: rgba(255,255,255,0.08);
}

body.dark .onenote-page-item:hover {
    background: #2d1b3d;
    border-color: #9c27b0;
}

.onenote-page-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark .onenote-page-title {
    color: #e5e7eb;
}

.onenote-page-date {
    font-size: 0.75rem;
    color: #9ca3af;
}

.onenote-pages-empty {
    text-align: center;
    padding: 24px 0;
    color: #9ca3af;
    font-size: 0.875rem;
}

.onenote-pages-loading {
    text-align: center;
    padding: 24px 0;
    color: #7B1FA2;
    font-size: 0.875rem;
}

/* ── Notebook tree browser ── */
.nb-tree { display: flex; flex-direction: column; gap: 2px; }

.nb-item-row, .nb-section-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 600;
    color: inherit;
    transition: background 0.15s;
    user-select: none;
}
.nb-item-row:hover { background: rgba(123,31,162,0.1); }
.nb-section-row { font-weight: 500; padding-left: 20px; }
.nb-section-row:hover { background: rgba(123,31,162,0.07); }
body.dark .nb-item-row:hover { background: rgba(206,147,216,0.12); }
body.dark .nb-section-row:hover { background: rgba(206,147,216,0.08); }

.nb-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-icon { flex-shrink: 0; font-size: 1rem; line-height: 1; }
.nb-chevron {
    flex-shrink: 0;
    font-size: 0.75rem;
    opacity: 0.5;
    transition: transform 0.2s;
    display: inline-block;
}
.nb-item.expanded > .nb-item-row .nb-chevron,
.nb-section.expanded > .nb-section-row .nb-chevron { transform: rotate(90deg); opacity: 0.9; }

.nb-children { display: none; }
.nb-item.expanded > .nb-children,
.nb-section.expanded > .nb-children { display: block; }

.nb-page {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 36px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: inherit;
    text-decoration: none;
    transition: background 0.15s;
    overflow: hidden;
}
.nb-page:hover { background: rgba(123,31,162,0.08); text-decoration: none; }
body.dark .nb-page:hover { background: rgba(206,147,216,0.1); }
.nb-page .nb-label { flex: 1; }
.nb-date { flex-shrink: 0; font-size: 0.72rem; opacity: 0.5; }

.nb-loading, .nb-error, .nb-empty {
    padding: 8px 12px;
    font-size: 0.78rem;
    opacity: 0.6;
}
.nb-error { color: #ef4444; opacity: 1; }

/* Delete button — only shows on page row hover */
.nb-del-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 2px 3px;
    border-radius: 3px;
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    transition: color 0.12s, background 0.12s;
}
.nb-page:hover .nb-del-btn {
    display: flex;
}
.nb-del-btn:hover {
    color: #ef4444;
    background: rgba(239,68,68,0.1);
}

/* ── Note Generator Save-to-OneNote Sub-toolbar ────────── */

.onenote-page-toolbar {
    position: absolute;
    top: 8px;
    right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    padding: 0;
}

.onenote-page-toolbar.hidden {
    display: none;
}

.onenote-toolbar-icon {
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex-shrink: 0;
}

.onenote-toolbar-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
}

body.dark .onenote-toolbar-label {
    color: #d1d5db;
}

.onenote-toggle-state-text {
    font-size: 0.75rem;
    font-weight: 600;
    color: #9ca3af;
    min-width: 20px;
}

.onenote-toggle-state-text.on {
    color: #7B1FA2;
}

body.dark .onenote-toggle-state-text.on {
    color: #ce93d8;
}

/* ── Tool context banner ─────────────────────────────────────────────────── */
.tool-context-banner {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 16px;
    background: rgba(var(--primary-rgb), 0.06);
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.15);
    font-size: 0.75rem;
    line-height: 1;
}

.tool-context-banner.hidden {
    display: none;
}

.tool-context-icon {
    font-size: 0.8rem;
}

.tool-context-name {
    font-weight: 700;
    color: var(--primary);
}

.tool-context-sep {
    color: #d1d5db;
    margin: 0 1px;
}

.tool-context-desc {
    color: #9ca3af;
    font-style: italic;
}

body.dark .tool-context-banner {
    background: rgba(var(--primary-rgb), 0.07);
    border-bottom-color: rgba(var(--primary-rgb), 0.18);
}

body.dark .tool-context-name {
    color: var(--primary);
}

body.dark .tool-context-desc {
    color: #64748b;
}

.onenote-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.onenote-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.onenote-switch-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 22px;
    cursor: pointer;
    transition: background 0.2s;
}

.onenote-switch-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.onenote-switch input:checked + .onenote-switch-slider {
    background: #7B1FA2;
}

.onenote-switch input:checked + .onenote-switch-slider::before {
    transform: translateX(18px);
}

/* ═══════════════════════════════════════════════
   CHAT SIDE PANEL
   ═══════════════════════════════════════════════ */

.chat-side-overlay { display: none; } /* overlay removed — panel stays open like OneNote */

.chat-side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 380px;
    max-width: 95vw;
    height: 100vh;
    background: #fff;
    z-index: 1003;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}
body.dark .chat-side-panel { background: #1a1f25; color: #e5e7eb; }
.chat-side-panel.open { transform: translateX(0); }

.chat-side-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    background: var(--primary);
    color: #fff;
    flex-shrink: 0;
}
body.dark .chat-side-header { border-color: rgba(255,255,255,0.1); }

.chat-side-header-info { display: flex; align-items: center; gap: 10px; }

.chat-side-avatar {
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chat-side-title { font-size: 0.95rem; font-weight: 700; }
.chat-side-subtitle { font-size: 0.7rem; opacity: 0.85; }

.chat-side-clear, .chat-side-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background 0.2s;
}
.chat-side-clear:hover, .chat-side-close:hover { background: rgba(255,255,255,0.3); }

.chat-side-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #f9fafb;
}
body.dark .chat-side-messages { background: #12171e; }

.chat-ai-mode-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 12px;
    background: rgba(var(--primary-rgb), 0.08);
    border-top: 1px solid rgba(var(--primary-rgb), 0.2);
    font-size: 0.72rem;
    color: var(--primary);
    font-weight: 600;
    flex-shrink: 0;
}
body.dark .chat-ai-mode-bar { background: rgba(var(--primary-rgb), 0.15); }
.chat-ai-mode-exit {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.72rem;
    font-family: inherit;
    cursor: pointer;
    opacity: 0.7;
    padding: 0;
    transition: opacity 0.15s;
}
.chat-ai-mode-exit:hover { opacity: 1; text-decoration: underline; }

.chat-side-input-area {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}
body.dark .chat-side-input-area { background: #1a1f25; border-color: rgba(255,255,255,0.1); }

.chat-side-input {
    flex: 1;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    font-size: 0.88rem;
    color: #111;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    font-family: inherit;
    transition: border-color 0.2s;
    line-height: 1.4;
}
.chat-side-input:focus { outline: none; border-color: var(--primary); }
body.dark .chat-side-input { background: #0c1520; border-color: #2d3748; color: #e5e7eb; }
body.dark .chat-side-input:focus { border-color: var(--primary); }


.ai-ask-ai-link {
    margin-top: 10px;
    font-size: 0.78rem;
    color: #6b7280;
}
.ai-ask-ai-link-btn {
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
    font-weight: 600;
}
.ai-ask-ai-link-btn:hover { opacity: 0.8; }
body.dark .ai-ask-ai-link { color: #9ca3af; }
body.dark .ai-ask-ai-link-btn { color: #fb8c5f; }

.ai-disclaimer {
    font-size: 0.68rem;
    color: #92400e;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 4px;
    padding: 4px 8px;
    margin: 2px 8px 6px 8px;
}
body.dark .ai-disclaimer { color: #fcd34d; background: rgba(252,211,77,0.1); border-color: rgba(252,211,77,0.3); }

.ai-sources {
    font-size: 0.68rem;
    color: #4b5563;
    margin: 2px 8px 6px 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}
.ai-sources-label { font-weight: 600; color: #6b7280; }
.ai-source-link {
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.ai-source-link:hover { opacity: 0.75; }
body.dark .ai-sources { color: #9ca3af; }
body.dark .ai-sources-label { color: #6b7280; }
body.dark .ai-source-link { color: #fb8c5f; }

.ai-websearch-btn {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
    background: none;
    border: 1px dashed rgba(var(--primary-rgb),0.4);
    border-radius: 6px;
    padding: 5px 10px;
    margin: 2px 8px 6px 8px;
    cursor: pointer;
}
.ai-websearch-btn:hover { background: rgba(var(--primary-rgb),0.06); }
.ai-websearch-btn:disabled { cursor: default; opacity: 0.6; }
body.dark .ai-websearch-btn { color: #fb8c5f; border-color: rgba(251,140,95,0.4); }

.chat-side-send {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.chat-side-send:hover { background: #e5511a; }
.chat-side-send:disabled { background: #ccc; cursor: not-allowed; }

/* ---- AI Chat Widget (floating bubble - legacy, kept for reference) ---- */
#ai-chat-widget {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

.ai-chat-toggle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.45);
    transition: transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
}

.ai-chat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.55);
}

.ai-chat-panel {
    width: 340px;
    height: 480px;
    background: #ffffff;
    border: 2px solid var(--primary);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    animation: chatSlideUp 0.22s ease;
}

.ai-chat-panel.hidden {
    display: none !important;
}

body.dark .ai-chat-panel {
    background: #1e2330;
}

@keyframes chatSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ai-chat-header {
    background: var(--primary);
    color: white;
    padding: 0.65rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.ai-chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-chat-title {
    font-weight: 700;
    font-size: 0.92rem;
}

.ai-chat-subtitle {
    font-size: 0.72rem;
    opacity: 0.8;
}

.ai-chat-clear {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.ai-chat-clear:hover {
    color: white;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.ai-msg {
    max-width: 85%;
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
    font-size: 0.875rem;
    line-height: 1.45;
    word-break: break-word;
}

.ai-msg-bot {
    align-self: flex-start;
    background: rgba(var(--primary-rgb), 0.08);
    border: 1px solid rgba(var(--primary-rgb), 0.18);
    color: #111;
    border-radius: 4px 12px 12px 12px;
}

body.dark .ai-msg-bot {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.1);
    color: #f0f0f0;
}

.ai-msg-user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-radius: 12px 4px 12px 12px;
}

.ai-msg-typing {
    align-self: flex-start;
    background: rgba(var(--primary-rgb), 0.08);
    border: 1px solid rgba(var(--primary-rgb), 0.18);
    color: #888;
    font-style: italic;
    font-size: 0.8rem;
    border-radius: 4px 12px 12px 12px;
    padding: 0.45rem 0.75rem;
}

body.dark .ai-msg-typing {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.1);
}

.ai-kb-card {
    background: rgba(var(--primary-rgb), 0.07);
    border: 1px solid rgba(var(--primary-rgb), 0.18);
    border-radius: 8px;
    padding: 9px 12px;
    margin-top: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.ai-kb-card:hover { background: rgba(var(--primary-rgb), 0.14); border-color: var(--primary); }
.ai-kb-title { font-size: .83rem; font-weight: 600; }
.ai-kb-snippet { font-size: .75rem; opacity: .65; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.dark .ai-kb-card { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); }
body.dark .ai-kb-card:hover { background: rgba(var(--primary-rgb),0.15); border-color: var(--primary); }

.ai-chat-input-area {
    padding: 0.65rem;
    border-top: 1px solid rgba(var(--primary-rgb), 0.18);
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-shrink: 0;
    background: inherit;
}

body.dark .ai-chat-input-area {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.ai-chat-input {
    flex: 1;
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    border-radius: 8px;
    padding: 0.5rem 0.65rem;
    font-size: 0.875rem;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    line-height: 1.4;
    background: #ffffff;
    color: #111;
    outline: none;
    transition: border-color 0.2s;
}

.ai-chat-input:focus {
    border-color: var(--primary);
}

body.dark .ai-chat-input {
    background: #2a3240;
    color: #f0f0f0;
    border-color: rgba(255, 255, 255, 0.15);
}

body.dark .ai-chat-input:focus {
    border-color: var(--primary);
}

.ai-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.ai-chat-send:hover {
    background: #e05020;
}

.ai-chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}
/* ---- End AI Chat Widget ---- */

/* ── Widget Bar ──────────────────────────────────────────────────── */
.home-widget-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 6px 0 14px;
}

.choice-row {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.home-widget-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid rgba(var(--primary-rgb), 0.35);
    background: rgba(var(--primary-rgb), 0.07);
    color: var(--text-color, #1a1a1a);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.home-widget-action-btn:hover {
    background: rgba(var(--primary-rgb), 0.15);
    border-color: rgba(var(--primary-rgb), 0.6);
}

.home-widget-action-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

body.dark .home-widget-action-btn {
    color: var(--dark-text, #f0f0f0);
}

body.dark .home-widget-action-btn.active {
    color: #fff;
}

/* ── Widget Grid ─────────────────────────────────────────────────── */
/* Widget grid: block layout by default (widget mode off) */
.widget-grid {
    position: relative;
}

.widget-grid:not(.widget-active) {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.widget-grid:not(.widget-active) .widget {
    height: auto;
    grid-column: 1 / -1;
    margin-bottom: 0;
}

/* World clock and TZ tracker share a row */
.widget-grid:not(.widget-active) #widget-world-clock {
    grid-column: 1 / 2;
}

.widget-grid:not(.widget-active) #widget-tz-tracker {
    grid-column: 2 / 3;
}

/* To-Do List + Recent Tools share a row */
.widget-grid:not(.widget-active) #widget-todo {
    grid-column: 1 / 2;
}

.widget-grid:not(.widget-active) #widget-recent-tools {
    grid-column: 2 / 3;
}

.widget-grid:not(.widget-active) .widget .widget-body {
    overflow-y: visible;
}

.widget-grid:not(.widget-active) .widget .widget-body .hero-copy {
    margin-top: 1.5rem;
}

/* Widget mode on: fixed 6-column grid with 200px square rows */
.widget-grid.widget-active {
    display: grid;
    grid-template-columns: repeat(6, 200px);
    grid-auto-rows: 200px;
    gap: 12px;
    margin: 0 auto;
    width: fit-content;
}

/* Background grid cells — injected by JS in edit mode */
.widget-cell {
    border: 1px dashed rgba(var(--primary-rgb), 0.22);
    border-radius: 8px;
    background: rgba(var(--primary-rgb), 0.025);
    pointer-events: none;
    z-index: 0;
    transition: background 0.12s, border-color 0.12s;
}

.widget-cell.drop-preview {
    background: rgba(var(--primary-rgb), 0.12);
    border-color: rgba(var(--primary-rgb), 0.65);
    pointer-events: none;
}

/* Widgets */
.widget {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Fill the grid cell height only when widget mode is active */
.widget-grid.widget-active .widget {
    height: 100%;
}

/* In widget mode, body must never scroll — the widget itself is the boundary */
.widget-grid.widget-active .widget .widget-body {
    overflow: hidden;
}

.widget-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Make widget content stretch to fill the full widget height */
.widget .widget-body .dashboard-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.widget .widget-body .hero-copy {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    margin-top: 0;    /* override general 1.5rem top margin */
    border-radius: 12px;
}

.widget .widget-body .hero-announcements {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.widget .widget-body .hero-announcements .announcement-item {
    flex: 0 0 auto;
}

.widget .widget-body .dashboard-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Compact header inside widgets */
.widget .widget-body .card-header {
    margin-bottom: 0.35rem;
    padding-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.widget .widget-body .card-header h3 {
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.widget .widget-body .hero-copy h2 {
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.widget-grid.widget-active .widget-body .dashboard-card .shortcut-list {
    flex: 1;
    overflow-y: hidden;
    min-height: 0;
}

/* Scroll wrapper — flex column so grid is vertically centered; horizontal scroll for overflow */
.widget-grid.widget-active .favorites-scroll-wrapper {
    flex: 1;
    min-height: 0;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--primary-rgb), 0.4) transparent;
}
.widget-grid.widget-active .favorites-scroll-wrapper::-webkit-scrollbar {
    height: 4px;
}
.widget-grid.widget-active .favorites-scroll-wrapper::-webkit-scrollbar-track {
    background: transparent;
}
.widget-grid.widget-active .favorites-scroll-wrapper::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-rgb), 0.4);
    border-radius: 2px;
}
.widget-grid.widget-active .favorites-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-rgb), 0.75);
}

/* Favorites grid — column flow only in widget mode */
.widget-grid.widget-active #favorites-list.shortcut-list {
    display: grid;
    grid-template-columns: none;
    grid-auto-flow: column;
    gap: 8px;
    flex-shrink: 0;   /* don't compress inside the flex scroll wrapper */
    /* grid-template-rows and grid-auto-columns set by JS */
}

.widget-grid.widget-active #favorites-list .shortcut-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1 / 1;
    min-height: unset;
    min-width: unset;
    padding: 0.5rem;
    overflow: hidden;
    box-sizing: border-box;
}

/* Primary must NOT fill 100% height — let the tile center it */
.widget-grid.widget-active #favorites-list .shortcut-primary {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    width: 100%;
    min-height: unset;
    flex: 0 0 auto;
}

.widget-grid.widget-active #favorites-list .shortcut-image-button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.widget-grid.widget-active #favorites-list .shortcut-item-icon {
    height: 48px;
    max-height: 48px;
    max-width: 85%;
    width: auto;
    margin-bottom: 0;
    flex-shrink: 0;
}

.widget-grid.widget-active #favorites-list .shortcut-link {
    font-size: 0.72rem;
    min-height: unset;
    line-height: 1.15;
    font-weight: 700;
    text-align: center;
}

.widget-grid.widget-active #favorites-list .shortcut-meta {
    font-size: 0.58rem;
    min-height: unset;
    line-height: 1;
    margin: 0;
    text-align: center;
}

/* Pin button: hidden by default in widget tiles, tiny on hover */
.widget-grid.widget-active #favorites-list .shortcut-item .pin-button {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    padding: 2px;
    border-radius: 50%;
    border: none !important;
    background: rgba(var(--primary-rgb), 0.75) !important;
    color: #fff !important;
    opacity: 0;
    transition: opacity 0.15s;
}
.widget-grid.widget-active #favorites-list .shortcut-item:hover .pin-button {
    opacity: 1;
}
.widget-grid.widget-active #favorites-list .shortcut-item .pin-button svg {
    width: 10px;
    height: 10px;
}


/* In edit mode, block child interactions so any widget can be dragged from anywhere */
.widget-grid.editing .widget .widget-body {
    pointer-events: none;
}

/* Drop preview: valid position */
.widget-cell.drop-invalid {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.65);
}

/* Edit mode widget state */
.widget-grid.editing .widget:not(.hidden) {
    outline: 2px dashed rgba(var(--primary-rgb), 0.4);
    outline-offset: 3px;
    cursor: grab;
    user-select: none;
    overflow: hidden; /* clip to grid cell bounds while editing */
}

.widget-grid.editing .widget:not(.hidden):hover {
    outline-color: rgba(var(--primary-rgb), 0.75);
    box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.1);
}

.widget-grid.editing .widget.dragging {
    opacity: 0.35;
    cursor: grabbing;
}

/* Edit handle bar — floats above widget content, doesn't shrink it */
.widget-edit-bar {
    position: absolute;
    top: 6px;
    right: 6px;
    left: auto;
    z-index: 3;
    display: flex;
    align-items: center;
    background: none;
    border-radius: 0;
    cursor: default;
    user-select: none;
    color: #fff;
}

.widget-grip {
    display: none;
}

/* Delete button */
.widget-delete-btn {
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: #fff;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.12s;
}

.widget-delete-btn:hover {
    background: rgba(239, 68, 68, 0.9);
    border-color: transparent;
}

/* ── Add Widget Picker Popup ─────────────────────────────────────── */
.widget-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease;
}

.widget-picker-modal {
    background: var(--card-bg, #fff);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: 16px;
    padding: 1.5rem;
    width: min(420px, 90vw);
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

body.dark .widget-picker-modal {
    background: #1e2130;
    border-color: rgba(var(--primary-rgb), 0.3);
}

.widget-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    font-size: 1rem;
}

.widget-picker-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.45;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
    transition: opacity 0.12s;
}

.widget-picker-close:hover { opacity: 1; }

.widget-picker-item {
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    border-radius: 10px;
    padding: 0.9rem 1rem;
    margin-bottom: 0.65rem;
}

.widget-picker-item-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 0.65rem;
}

.widget-active-badge {
    font-size: 0.66rem;
    background: rgba(var(--primary-rgb), 0.12);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
}

.widget-picker-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.widget-picker-size-btn {
    padding: 5px 14px;
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    border-radius: 7px;
    background: rgba(var(--primary-rgb), 0.06);
    color: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s;
}

.widget-picker-size-btn:hover {
    background: rgba(var(--primary-rgb), 0.18);
    border-color: rgba(var(--primary-rgb), 0.6);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}
/* ── Display Settings Widget ─────────────────────────────────────── */
.widget-ds-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 0.4rem;
}

.widget-ds-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 0;
}

.widget-ds-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #6b7280);
}

.widget-ds-divider {
    height: 1px;
    background: rgba(var(--primary-rgb), 0.12);
    margin: 0.2rem 0;
}

.widget-ds-sizes {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.widget-ds-size-btn {
    flex: 1;
    padding: 5px 4px;
    border: 1px solid rgba(var(--primary-rgb), 0.25);
    border-radius: 6px;
    background: rgba(var(--primary-rgb), 0.06);
    color: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    text-align: center;
}

.widget-ds-size-btn:hover {
    background: rgba(var(--primary-rgb), 0.15);
    border-color: rgba(var(--primary-rgb), 0.5);
}

.widget-ds-size-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.widget-ds-switch {
    transform: scale(0.82);
    transform-origin: right center;
}

/* ── World Clock Widget ───────────────────────────────────────────── */
.widget-clock-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.clock-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.clock-view-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid rgba(var(--primary-rgb), 0.25);
    background: rgba(var(--primary-rgb), 0.06);
    color: rgba(var(--primary-rgb), 0.75);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
    padding: 0;
}

.clock-view-toggle:hover {
    background: rgba(var(--primary-rgb), 0.18);
    color: var(--primary);
    border-color: rgba(var(--primary-rgb), 0.55);
}

.world-clock-grid {
    display: grid;
    gap: 6px;
    flex: 1;
    align-content: center;
    min-height: 0;
}

.clock-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(var(--primary-rgb), 0.05);
    border: 1px solid rgba(var(--primary-rgb), 0.12);
    border-radius: 10px;
    padding: 6px 4px;
    gap: 2px;
    text-align: center;
    min-height: 0;
    overflow: hidden;
}

.clock-cell.user-zone {
    border: 2px solid var(--primary);
    background: rgba(var(--primary-rgb), 0.09);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.15);
}

.clock-abbr {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1;
}

.clock-label {
    font-size: 0.58rem;
    color: var(--text-muted, #9ca3af);
    font-weight: 500;
    line-height: 1;
}

.clock-face {
    display: block;
    flex-shrink: 0;
    max-width: 100%;
    height: auto;
}

.clock-time {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

body.dark .clock-time {
    color: #f3f4f6;
}

.clock-date {
    font-size: 0.52rem;
    color: var(--text-muted, #9ca3af);
    white-space: nowrap;
    line-height: 1;
}

/* ── Time Zone Tracker Widget ────────────────────────────────────── */
.widget-tz-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 0.5rem;
}

.tz-input-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.tz-zip-input {
    flex: 1;
    min-width: 0;
    padding: 5px 8px;
    border-radius: 7px;
    border: 1px solid rgba(var(--primary-rgb), 0.25);
    background: rgba(var(--primary-rgb), 0.04);
    color: inherit;
    font-size: 0.78rem;
    outline: none;
    transition: border-color 0.15s;
}

.tz-zip-input:focus {
    border-color: rgba(var(--primary-rgb), 0.6);
}

body.dark .tz-zip-input {
    background: rgba(var(--primary-rgb), 0.07);
}

.tz-check-btn {
    padding: 5px 10px;
    border-radius: 7px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    flex-shrink: 0;
}

.tz-check-btn:hover { background: #e5511a; }

.tz-result {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 2px;
    font-size: 0.78rem;
    color: var(--text-muted, #6b7280);
    min-height: 0;
}

.tz-result-city {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
}

.tz-result-time {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary, #111827);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

body.dark .tz-result-time {
    color: #f3f4f6;
}

.tz-result-date {
    font-size: 0.68rem;
    color: var(--text-muted, #9ca3af);
}

/* ── To-Do List Widget ───────────────────────────────────────────── */
.widget-todo-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 0.5rem;
}

.todo-input-row {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.todo-input {
    flex: 1;
    min-width: 0;
    padding: 5px 9px;
    border-radius: 7px;
    border: 1px solid rgba(var(--primary-rgb), 0.25);
    background: rgba(var(--primary-rgb), 0.04);
    color: inherit;
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.15s;
}

.todo-input:focus {
    border-color: rgba(var(--primary-rgb), 0.6);
}

body.dark .todo-input {
    background: rgba(var(--primary-rgb), 0.07);
}

.todo-add-btn {
    padding: 5px 12px;
    border-radius: 7px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}

.todo-add-btn:hover { background: #e5511a; }

.todo-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 0;
    padding-right: 2px;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--primary-rgb), 0.3) transparent;
}

.todo-list::-webkit-scrollbar { width: 4px; }
.todo-list::-webkit-scrollbar-track { background: transparent; }
.todo-list::-webkit-scrollbar-thumb { background: rgba(var(--primary-rgb), 0.3); border-radius: 2px; }

.todo-empty {
    font-size: 0.78rem;
    color: var(--text-muted, #9ca3af);
    text-align: center;
    padding: 1rem 0;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(var(--primary-rgb), 0.1);
    background: rgba(var(--primary-rgb), 0.03);
    position: relative;
    min-height: 34px;
    transition: background 0.12s, border-color 0.12s;
}

.todo-item:hover {
    background: rgba(var(--primary-rgb), 0.07);
    border-color: rgba(var(--primary-rgb), 0.2);
}

.todo-text {
    flex: 1;
    font-size: 0.82rem;
    line-height: 1.35;
    word-break: break-word;
}

.todo-completed .todo-text {
    color: #22c55e;
    text-decoration: line-through;
    opacity: 0.85;
}

.todo-actions {
    display: flex;
    gap: 3px;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.todo-item:hover .todo-actions {
    opacity: 1;
}

.todo-action-btn {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.06);
    color: inherit;
    padding: 0;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}

body.dark .todo-action-btn {
    background: rgba(255, 255, 255, 0.07);
}

.todo-complete-btn:hover {
    background: rgba(34, 197, 94, 0.18);
    color: #22c55e;
}

.todo-edit-btn:hover {
    background: rgba(var(--primary-rgb), 0.18);
    color: var(--primary);
}

.todo-delete-btn:hover {
    background: rgba(239, 68, 68, 0.18);
    color: #ef4444;
}

.todo-edit-input {
    flex: 1;
    min-width: 0;
    padding: 2px 6px;
    border-radius: 5px;
    border: 1px solid rgba(var(--primary-rgb), 0.55);
    background: var(--card-bg, #fff);
    color: inherit;
    font-size: 0.82rem;
    outline: none;
}

body.dark .todo-edit-input {
    background: #1a1f2e;
}

/* ── Recent Tools Widget ─────────────────────────────────────────── */
.widget-recent-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.recent-tools-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    justify-content: center;
}

.recent-tools-empty {
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af);
    text-align: center;
    padding: 0.5rem 0;
}

.recent-tool-btn {
    width: 100%;
    text-align: left;
    padding: 6px 10px;
    border-radius: 7px;
    border: 1px solid rgba(var(--primary-rgb), 0.12);
    background: rgba(var(--primary-rgb), 0.04);
    color: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-tool-btn:hover {
    background: rgba(var(--primary-rgb), 0.12);
    border-color: rgba(var(--primary-rgb), 0.35);
    color: var(--primary);
}

/* ── TZ nav button ── */
.tz-nav-btn {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}
.tz-nav-btn:hover { opacity: 0.8; }
.tz-nav-btn svg { width: 22px; height: 22px; }
.tz-nav-panel { min-width: 260px; }

/* ── To-Do side-tab button (hidden until user opts in) ── */
.todo-panel-btn {
    display: none;
    border: none;
    border-radius: 8px 0 0 8px;
    padding: 14px 10px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    box-shadow: -2px 0 12px rgba(0,0,0,0.2);
    transition: background 0.2s, padding-right 0.2s;
    color: #fff;
}
.todo-panel-btn { background: var(--primary); }
.todo-panel-btn.sidetab-enabled { display: flex; }
.todo-panel-btn:hover { background: #e5511a; padding-right: 14px; }
.todo-panel-btn-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    text-transform: uppercase;
}

/* ── Widget card header with side-tab toggle ── */
.widget-card-header-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.widget-sidetab-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex-shrink: 0;
}
.widget-sidetab-checkbox { display: none; }
.widget-sidetab-slider {
    position: relative;
    display: inline-block;
    width: 28px;
    height: 16px;
    background: rgba(var(--primary-rgb),0.15);
    border-radius: 8px;
    border: 1px solid rgba(var(--primary-rgb),0.25);
    transition: background 0.2s;
    flex-shrink: 0;
}
.widget-sidetab-slider::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #9ca3af;
    transition: left 0.2s, background 0.2s;
}
.widget-sidetab-checkbox:checked + .widget-sidetab-slider {
    background: rgba(var(--primary-rgb),0.3);
    border-color: var(--primary);
}
.widget-sidetab-checkbox:checked + .widget-sidetab-slider::after {
    left: calc(100% - 13px);
    background: var(--primary);
}
.widget-sidetab-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted, #9ca3af);
    white-space: nowrap;
}

/* ── Quick side panels (To-Do & TZ) ── */
.quick-side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 340px;
    height: 100vh;
    z-index: 2100;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    background: #fff;
}
body.dark .quick-side-panel { background: #1a1f25; color: #e5e7eb; }
.quick-side-panel.open { transform: translateX(0); }

.quick-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 14px 20px;
    color: #fff;
    flex-shrink: 0;
}
.todo-panel-header { background: var(--primary); }
.quick-panel-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.quick-panel-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.quick-panel-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.8;
    padding: 4px 6px;
    border-radius: 4px;
    transition: opacity 0.15s, background 0.15s;
}
.quick-panel-close:hover { opacity: 1; background: rgba(255,255,255,0.15); }

.quick-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* When todo panel is open, shift side-panel-btns */
body.todo-panel-open .side-panel-btns {
    right: 340px;
    transition: right 0.3s ease;
}

/* ── Notes Widget ── */
.widget-notes-card {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.notes-card-header {
    padding: 0;
    border-bottom: 1px solid rgba(var(--primary-rgb),0.12);
    flex-shrink: 0;
}
.notes-tabs-row {
    display: flex;
    align-items: center;
    overflow-x: auto;
    gap: 2px;
    padding: 6px 6px 0;
    scrollbar-width: none;
}
.notes-tabs-row::-webkit-scrollbar { display: none; }
.notes-tabs {
    display: flex;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.notes-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 6px 6px 0 0;
    border: 1px solid rgba(var(--primary-rgb),0.15);
    border-bottom: none;
    background: rgba(var(--primary-rgb),0.04);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s;
    color: var(--text-muted, #6b7280);
}
.notes-tab.active {
    background: rgba(var(--primary-rgb),0.12);
    color: var(--primary);
    font-weight: 700;
    border-color: rgba(var(--primary-rgb),0.3);
}
.notes-tab:hover:not(.active) { background: rgba(var(--primary-rgb),0.08); }
.notes-tab-delete {
    background: none;
    border: none;
    color: inherit;
    font-size: 0.7rem;
    padding: 0 2px;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.notes-tab:hover .notes-tab-delete { opacity: 0.6; }
.notes-tab-delete:hover { opacity: 1 !important; color: #ef4444; }
.notes-add-page-btn {
    background: none;
    border: 1px solid rgba(var(--primary-rgb),0.2);
    border-radius: 5px;
    color: var(--primary);
    font-size: 1rem;
    font-weight: 700;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    margin-bottom: 2px;
    transition: background 0.15s;
}
.notes-add-page-btn:hover { background: rgba(var(--primary-rgb),0.1); }
.notes-content-area {
    flex: 1;
    padding: 10px 14px;
    font-size: 0.82rem;
    line-height: 1.6;
    outline: none;
    overflow-y: auto;
    resize: none;
    color: inherit;
    white-space: pre-wrap;
}
.notes-content-area:empty::before {
    content: attr(data-placeholder);
    color: #9ca3af;
    pointer-events: none;
}
body.dark .notes-content-area { color: #e5e7eb; }
body.dark .notes-tab { color: #9ca3af; }
body.dark .notes-tab.active { color: var(--primary); }

/* ── Profile top row ─────────────────────────────────────────────── */
/* ── Profile page layout ─────────────────────────────────────────── */
.profile-full-row {
    margin-bottom: 1rem;
}

.profile-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1rem;
    align-items: start;
}

.profile-col-main,
.profile-col-side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Customer lookup */
.customer-lookup-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 10px;
    flex-wrap: wrap;
}

.customer-lookup-input {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid rgba(var(--primary-rgb),0.25);
    background: rgba(var(--primary-rgb),0.04);
    font-size: .85rem;
    width: 240px;
    color: inherit;
}

.badge-admin {
    font-size: .65rem;
    background: var(--primary);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    vertical-align: middle;
    margin-left: 6px;
    font-weight: 700;
    letter-spacing: .03em;
}

/* Display settings */
.profile-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
}

.profile-setting-row--bordered {
    border-top: 1px solid rgba(var(--primary-rgb),0.12);
    margin-top: 0.15rem;
}

.profile-setting-label {
    font-size: 0.88rem;
    font-weight: 600;
}

.profile-setting-desc {
    font-size: 0.72rem;
    color: var(--text-muted, #9ca3af);
    display: block;
    margin-top: 2px;
}

.profile-text-size-section {
    padding: 0.65rem 0 0.5rem;
    border-top: 1px solid rgba(var(--primary-rgb),0.12);
    margin-top: 0.25rem;
}

.avatar-preview-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar-preview-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── TIME INPUT ── */
.profile-time-input {
    padding: 4px 8px; border-radius: 6px; font-size: 0.82rem;
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    background: transparent; color: inherit; cursor: pointer; outline: none;
    transition: border-color .15s;
}
.profile-time-input:focus { border-color: var(--primary); }
body.dark .profile-time-input { border-color: rgba(255,255,255,0.18); color-scheme: dark; }


/* ── Accent color picker ── */
.accent-swatch-row {
    display: flex; flex-wrap: wrap; gap: 10px; margin-top: 0.75rem;
}
.accent-swatch {
    width: 28px; height: 28px; border-radius: 50%; padding: 0;
    background: var(--sw, #ccc); border: 2px solid transparent;
    cursor: pointer; position: relative; outline-offset: 2px;
    box-shadow: 0 0 0 1px rgba(128,128,128,0.25);
    transition: transform .12s;
}
.accent-swatch:hover { transform: scale(1.12); }
.accent-swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--sw), 0 0 0 1px rgba(0,0,0,0.15); }
.accent-swatch--custom {
    display: inline-flex; align-items: center; justify-content: center;
    color: #6b7280; background: transparent;
    box-shadow: 0 0 0 1px rgba(128,128,128,0.4);
}
.accent-swatch--custom input[type="color"] {
    position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%;
    padding: 0; border: none; cursor: pointer;
}

.profile-font-slider {
    width: 100%;
    accent-color: var(--primary);
    cursor: pointer;
    display: block;
}

.profile-font-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
}

.profile-font-labels span {
    font-size: 0.72rem;
    color: var(--text-muted, #9ca3af);
    cursor: pointer;
}

/* Shift footer */
.shift-genesys-bar {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}

.shift-genesys-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.32rem 0.75rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.shift-genesys-btn:hover { opacity: 0.85; }
.shift-genesys-btn:disabled { opacity: 0.45; cursor: default; }

.shift-genesys-status {
    font-size: 0.74rem;
    color: var(--muted-text, #999);
}
.shift-genesys-status.synced { color: #4caf50; }
.shift-genesys-status.error  { color: #e53935; }

.shift-override-row { margin-bottom: 0.4rem; }

@keyframes genesys-spin { to { transform: rotate(360deg); } }
.shift-genesys-icon-spinning { animation: genesys-spin 0.9s linear infinite; transform-origin: center; }

.shift-fields-locked input[type="time"],
.shift-fields-locked select,
.shift-fields-locked input[type="checkbox"]:not(#shift-manual-override) {
    opacity: 0.45;
    pointer-events: none;
}
.shift-fields-locked #shift-save-btn {
    opacity: 0.45;
    pointer-events: none;
}

.shift-footer-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* ── Coming Soon ─────────────────────────────────────────────────── */
#coming-soon-card .card-header h3 { font-size: 0.9rem; }

.coming-soon-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.15rem 0;
    max-height: 220px;
    overflow-y: auto;
}

.coming-soon-item {
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--primary);
    border-radius: 0 6px 6px 0;
    background: rgba(var(--primary-rgb), 0.06);
    font-size: 0.8rem;
    line-height: 1.45;
}

body.dark .coming-soon-item {
    background: rgba(var(--primary-rgb), 0.1);
}

.coming-soon-body { white-space: pre-wrap; }

.coming-soon-meta {
    margin-top: 3px;
    font-size: 0.68rem;
    color: var(--text-muted, #9ca3af);
}

.coming-soon-empty {
    font-size: 0.8rem;
    color: var(--text-muted, #9ca3af);
    font-style: italic;
}

@media (max-width: 780px) {
    .profile-layout { grid-template-columns: 1fr; }
}


/* ── Home Customize Modal ────────────────────────────────────────── */
.home-customize-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 3000;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 60px 24px 0 0;
}

.home-customize-overlay.hidden { display: none; }

.home-customize-modal {
    background: var(--bg-card, #fff);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    min-width: 240px;
    max-width: 300px;
    padding: 0;
    overflow: hidden;
}

body.dark .home-customize-modal {
    background: #1e2028;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.home-customize-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(var(--primary-rgb),0.12);
}

.home-customize-header strong {
    font-size: 0.9rem;
}

.home-customize-close {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-muted, #9ca3af);
    padding: 0 2px;
    line-height: 1;
    opacity: 0.7;
}

.home-customize-close:hover { opacity: 1; }

.home-customize-desc {
    font-size: 0.75rem;
    color: var(--text-muted, #9ca3af);
    padding: 8px 16px 4px;
    margin: 0;
}

.home-customize-list {
    padding: 6px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.home-customize-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.12s;
}

.home-customize-row:hover {
    background: rgba(var(--primary-rgb),0.07);
}

.home-customize-checkbox {
    accent-color: var(--primary);
    width: 15px;
    height: 15px;
    cursor: pointer;
    flex-shrink: 0;
}

.home-customize-label {
    font-size: 0.83rem;
    font-weight: 500;
    user-select: none;
}

/* ── End Widget ──────────────────────────────────────────────────── */

/* ── Shift Schedule ───────────────────────────────────────────────── */
/* ── Header countdown ─────────────────────────────────────────────── */
.shift-countdown-bar {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    margin-top: 2px;
}

.shift-countdown-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #fff;
    letter-spacing: 0.02em;
    font-size: 1rem;
}

/* ── Shift Countdown Widget ───────────────────────────────────────── */
.widget-shift-cd-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0.6rem 0.75rem 0.75rem;
}

.widget-shift-cd-card .card-header {
    padding: 0 0 0.4rem;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(var(--primary-rgb),0.12);
}

.widget-shift-cd-card .card-header h3 {
    font-size: 0.72rem;
    font-weight: 700;
}

.widget-shift-cd-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 0.4rem 0 0;
    text-align: center;
    gap: 3px;
}

.widget-shift-cd-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted, #9ca3af);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.widget-shift-cd-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1;
}

.widget-shift-today {
    padding: 0.45rem 0 0.35rem;
    border-bottom: 1px solid rgba(var(--primary-rgb),0.12);
    margin-bottom: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.widget-shift-today:empty { display: none; }

.widget-shift-today-time {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    letter-spacing: -0.01em;
}

.widget-shift-today-breaks {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.widget-shift-today-break {
    display: flex;
    justify-content: space-between;
    font-size: 0.59rem;
    color: var(--text-muted, #9ca3af);
    padding: 0 2px;
}

.widget-shift-today-off {
    font-size: 0.66rem;
    color: var(--text-muted, #9ca3af);
    text-align: center;
    padding: 0.3rem 0;
    font-style: italic;
}

/* ── Shift Schedule ───────────────────────────────────────────────── */
.shift-days-row {
    display: flex;
    gap: 8px;
    margin: 0.75rem 0 0.6rem;
}

.shift-day-chip {
    cursor: pointer;
    user-select: none;
}

.shift-day-chip input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.shift-day-chip span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    border: 2px solid rgba(var(--primary-rgb), 0.25);
    color: var(--text-muted, #9ca3af);
    background: transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.shift-day-chip:hover span {
    border-color: rgba(var(--primary-rgb), 0.55);
    color: var(--primary);
}

.shift-day-chip input:checked + span {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.shift-same-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0.5rem 0 0.75rem;
    cursor: pointer;
    user-select: none;
}

.shift-same-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.shift-same-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: inherit;
    opacity: 0.75;
}

.shift-time-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0.45rem 0;
    border-top: 1px solid rgba(var(--primary-rgb), 0.1);
    transition: opacity 0.15s;
}

.shift-time-entry:first-child {
    border-top: none;
}

#shift-shared-row {
    border-top: 1px solid rgba(var(--primary-rgb), 0.1);
    margin-bottom: 0.25rem;
}

.shift-entry-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted, #9ca3af);
    min-width: 80px;
    flex-shrink: 0;
}

#shift-shared-row .shift-entry-label,
.shift-entry-label--shared {
    color: var(--primary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.shift-times {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: flex-end;
}

.shift-time-sep {
    font-size: 0.85rem;
    color: var(--text-muted, #9ca3af);
    flex-shrink: 0;
}

.shift-time-input {
    height: 30px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid rgba(var(--primary-rgb), 0.22);
    background: rgba(var(--primary-rgb), 0.04);
    color: inherit;
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s, border-color 0.15s;
    width: 110px;
}

.shift-time-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.15);
}

.shift-time-input:disabled {
    opacity: 0.28;
    cursor: default;
    pointer-events: none;
}

body.dark .shift-time-input {
    background: rgba(var(--primary-rgb), 0.07);
    color: #e2e8f0;
    border-color: rgba(var(--primary-rgb), 0.2);
}

.shift-day-row.shift-inactive {
    opacity: 0.32;
}

/* ── Breaks & Lunch section ───────────────────────────────────────── */
.shift-breaks-section {
    margin-top: 0.75rem;
    border-top: 1px solid rgba(var(--primary-rgb), 0.15);
    padding-top: 0.5rem;
}

.shift-breaks-summary {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    user-select: none;
}

.shift-breaks-summary::-webkit-details-marker { display: none; }

.shift-breaks-summary::after {
    content: '▸';
    font-size: 0.7rem;
    transition: transform 0.18s;
    color: rgba(var(--primary-rgb), 0.6);
}

.shift-breaks-section[open] .shift-breaks-summary::after {
    transform: rotate(90deg);
}

.shift-break-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.35rem 0;
    border-top: 1px solid rgba(var(--primary-rgb), 0.07);
}

.shift-break-entry:first-of-type {
    border-top: none;
    margin-top: 0.25rem;
}

.shift-break-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #9ca3af);
    min-width: 56px;
    flex-shrink: 0;
}

.shift-dur-select {
    height: 30px;
    padding: 0 6px;
    border-radius: 6px;
    border: 1px solid rgba(var(--primary-rgb), 0.22);
    background: rgba(var(--primary-rgb), 0.04);
    color: inherit;
    font-size: 0.78rem;
    font-family: inherit;
    cursor: pointer;
    width: 80px;
}

.shift-dur-select:focus {
    outline: none;
    border-color: var(--primary);
}

body.dark .shift-dur-select {
    background: rgba(var(--primary-rgb), 0.07);
    color: #e2e8f0;
    border-color: rgba(var(--primary-rgb), 0.2);
}

.shift-iday-breaks {
    margin-top: 0.4rem;
    border-radius: 8px;
    background: rgba(var(--primary-rgb), 0.04);
    border: 1px solid rgba(var(--primary-rgb), 0.1);
    margin-bottom: 0.4rem;
    overflow: hidden;
}

.shift-iday-summary {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    list-style: none;
    padding: 0.4rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.shift-iday-summary::-webkit-details-marker { display: none; }

.shift-iday-summary::after {
    content: '▸';
    font-size: 0.65rem;
    transition: transform 0.15s;
    margin-left: auto;
    opacity: 0.6;
}

.shift-iday-details[open] .shift-iday-summary::after {
    transform: rotate(90deg);
}

.shift-iday-details .shift-break-entry {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}
/* ── End Shift Schedule ───────────────────────────────────────────── */

