/* Appearance controls are shared by the Dark and Light WebsiteGlass appearances. */
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
html[data-theme-loading="light"] { background: #e9f0f9; }
html[data-theme-loading="dark"] { background: #18191d; }
html[data-theme-loading] body { visibility: hidden; }

/* Both appearances share decorative WebsiteGlass layers behind the live PHP UI. */
:root[data-theme] [data-glass-position="relative"] { position: relative; }
:root[data-theme] [data-website-glass] {
    isolation: isolate;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
:root[data-theme] .auth-refresh .auth-card[data-website-glass] { background: transparent; }
:root[data-theme] .website-glass-host {
    position: absolute;
    z-index: -1;
    inset: 0;
    display: block;
    overflow: hidden;
    border-radius: inherit;
    pointer-events: none;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    --spacing: .25rem;
}
.website-glass-host .website-glass-material { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Keep closed native menus out of layout even when they contain isolated glass layers. */
:is(.account-menu, .notification-menu, .dev-switcher, [data-organization-switcher]):not([open]) > :not(summary) { display: none; }

.theme-selector {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-subtle, var(--canvas));
}
.theme-choice {
    display: inline-flex;
    min-height: 36px;
    min-width: 40px;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 7px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--appearance-control-text, var(--muted));
    cursor: pointer;
    font: inherit;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.3;
    transition: background 160ms ease, border-color 160ms ease;
}
.theme-choice:hover { background: var(--surface); color: var(--text); }
.theme-choice[aria-pressed="true"] { background: var(--surface); border-color: var(--line); color: var(--brand-600); box-shadow: var(--shadow-sm); }
.theme-choice[aria-busy="true"] { cursor: progress; }
.theme-choice:focus-visible { outline: 3px solid var(--brand-500); outline-offset: 3px; }
.theme-choice svg { width: 14px; height: 14px; }
.account-menu-workspace .theme-choice { text-decoration: none; }
.account-menu-workspace .theme-choice[aria-current="page"] { background: var(--surface); border-color: var(--line); color: var(--brand-600); box-shadow: var(--shadow-sm); }
.auth-corner-controls {
    position: fixed;
    z-index: 35;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(16px, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 8px;
}
.auth-corner-controls .theme-selector,
.auth-corner-controls .auth-dev-launcher {
    position: static;
    inset: auto;
    width: auto;
    height: auto;
    min-height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.auth-corner-controls .auth-dev-launcher > span { display: inline; }
.auth-corner-controls .theme-selector { padding: 3px; }
.theme-control-auth { display: flex; }
.auth-refresh .auth-form-panel { padding-bottom: 100px; }
.auth-refresh .auth-form-footer { bottom: 70px; }

.account-menu { position: relative; flex: 0 0 auto; }
.account-menu > summary { cursor: pointer; list-style: none; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary > div { min-width: 0; max-width: 150px; }
.account-menu > summary :is(strong, small) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.account-menu > summary > svg { flex: 0 0 auto; transition: transform 160ms ease; }
.account-menu[open] > summary > svg { transform: rotate(180deg); }
.account-menu-panel {
    position: absolute;
    z-index: 45;
    top: calc(100% + 8px);
    right: 0;
    width: min(280px, calc(100vw - 24px));
    max-height: min(460px, calc(100dvh - 88px));
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-md);
    color: var(--text);
}
.account-menu-heading { display: grid; gap: 4px; padding: 12px 10px; overflow-wrap: anywhere; }
.account-menu-heading strong { color: var(--ink); font-size: 13px; font-weight: 600; }
.account-menu-heading small { color: var(--appearance-control-text, var(--muted)); font-size: 11px; }
.account-menu-panel nav { display: grid; }
.account-menu-panel nav a, .account-menu-logout button {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.account-menu-panel nav a:hover, .account-menu-logout button:hover { background: var(--brand-50); }
.account-menu-appearance { display: grid; gap: 8px; margin: 5px 0; padding: 12px 10px; border-block: 1px solid var(--line); font-size: 12px; }
.account-menu-appearance .theme-selector { display: flex; }
.account-menu-appearance .theme-choice { flex: 1; }
.account-menu-theme { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; padding: 7px 10px; border: 0; color: var(--muted); font-size: 11px; }
.account-menu-theme .theme-selector { flex: 0 0 auto; gap: 2px; width: auto; padding: 0; border: 0; border-radius: 8px; background: transparent; }
.account-menu-theme .theme-choice { flex: 0 0 auto; width: 32px; min-width: 32px; min-height: 32px; padding: 6px; border-radius: 8px; box-shadow: none; }
.account-menu-theme .theme-choice > span { display: none; }
@media (pointer: coarse) { .account-menu-theme .theme-choice { min-width: 40px; min-height: 40px; } }
.account-menu-logout button { color: var(--account-danger, var(--red)); }
.account-menu :is(summary, a, button):focus-visible { outline: 2px solid var(--brand-600); outline-offset: 2px; }

/* Shared layout additions. */
.professional-list, .professional-row { min-width: 0; }
.task-day-create small { display: inline-flex; align-items: center; justify-content: center; gap: 4px; color: var(--brand-600); }
.task-day-create:hover { border-color: var(--brand-600); }
.task-day-dialog .task-overview-create-form { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.task-day-dialog.has-create-form .task-day-modal-empty { min-height: 70px; gap: 8px; padding: 12px 0; }

@media (max-width: 1180px) {
    .account-menu > summary > div { display: none; }
}
@media (pointer: coarse) {
    .theme-choice, .auth-corner-controls .auth-dev-launcher,
    .account-menu-panel nav a, .account-menu-logout button { min-height: 44px; }
}
@media (max-width: 600px) {
    .auth-corner-controls .theme-choice > span { display: none; }
    .auth-corner-controls .theme-choice { min-width: 36px; }
}
@media (max-width: 360px) {
    .topbar .account-menu > summary { gap: 4px; padding-inline: 2px; }
}
@media (prefers-reduced-motion: reduce) {
    .theme-choice, .account-menu > summary > svg { transition: none; }
}
@media (forced-colors: active) {
    .theme-choice { border: 1px solid ButtonText; }
    .theme-choice[aria-pressed="true"] { outline: 2px solid Highlight; }
}
