/* Shared fixed navigation for the online Easytok workspace. */
:root { --app-sidebar-width: 248px; }

body.has-app-sidebar {
    margin: 0 !important;
    padding-left: var(--app-sidebar-width) !important;
}

body.has-app-sidebar > .top-nav,
body.has-app-sidebar > header.nav,
body.has-app-sidebar > .topbar {
    display: none !important;
}

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--app-sidebar-width);
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 22px 14px 16px;
    overflow-y: auto;
    background: rgba(13, 13, 24, .97);
    border-right: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 12px 0 32px rgba(0, 0, 0, .18);
}

.app-sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 10px 18px;
    color: #f0eff8;
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.app-sidebar__brand i {
    color: #8f7cf4;
    font-size: 22px;
}

.app-sidebar__section {
    padding: 14px 12px 5px;
    color: #77758d;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.app-sidebar__nav {
    display: grid;
    gap: 5px;
}

.app-sidebar__link,
.app-sidebar__action {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: #aaa8bb;
    font: inherit;
    font-size: 13px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.app-sidebar__link i,
.app-sidebar__action i {
    width: 18px;
    color: #8f7cf4;
    font-size: 15px;
    text-align: center;
    flex: 0 0 18px;
}

.app-sidebar__link:hover,
.app-sidebar__action:hover,
.app-sidebar__link.is-active {
    color: #fff;
    background: rgba(108, 92, 231, .18);
    border-color: rgba(143, 124, 244, .34);
}

.app-sidebar__link.is-primary {
    color: #fff;
    background: linear-gradient(135deg, #6c5ce7, #806ff0);
    box-shadow: 0 6px 18px rgba(108, 92, 231, .24);
}

.app-sidebar__link.is-primary i { color: #fff; }

.app-sidebar__link.has-unread-release::after {
    content: "新";
    margin-left: auto;
    padding: 2px 6px;
    border-radius: 999px;
    background: #e17055;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    line-height: 1.4;
}

.app-sidebar__theme-toggle {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: #aaa8bb;
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: background .2s ease, color .2s ease, border-color .2s ease;
}

.app-sidebar__theme-toggle i {
    width: 18px;
    color: #fdcb6e;
    font-size: 15px;
    text-align: center;
    flex: 0 0 18px;
}

.app-sidebar__theme-toggle:hover {
    color: #fff;
    background: rgba(253, 203, 110, .12);
    border-color: rgba(253, 203, 110, .28);
}

/* Theme preference now lives in Settings; keep the shared rules here so every
   authenticated page responds to the same html/body state. */
html[data-theme="light"],
html.theme-light {
    color-scheme: light;
}

html[data-theme="light"] body,
html.theme-light body,
body.theme-light {
    --bg: #f5f7fb;
    --page-bg: #f5f7fb;
    --card: #ffffff;
    --page-card: #ffffff;
    --surface: #ffffff;
    --surface-2: #eef1f7;
    --card-hover: #f0f2f8;
    --page-card-hover: #f0f2f8;
    --text: #202334;
    --page-text: #202334;
    --text-dim: #5d6678;
    --page-text-dim: #5d6678;
    --text-muted: #7c879a;
    --page-text-muted: #7c879a;
    --settings-bg: #f5f7fb;
    --settings-card: #ffffff;
    --settings-text: #202334;
    --settings-muted: #5d6678;
    --settings-line: rgba(36,45,66,.14);
    --border: rgba(36,45,66,.14);
    --page-border: rgba(36,45,66,.14);
    background: var(--page-bg) !important;
    color: var(--page-text) !important;
}

html[data-theme="light"] body input,
html[data-theme="light"] body textarea,
html[data-theme="light"] body select,
html.theme-light body input,
html.theme-light body textarea,
html.theme-light body select {
    background-color: rgba(255,255,255,.9) !important;
    color: var(--text, #202334) !important;
    border-color: rgba(36,45,66,.18) !important;
}

.app-sidebar__footer {
    display: grid;
    gap: 8px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.app-sidebar__credits {
    padding: 10px 12px;
    border: 1px solid rgba(253, 203, 110, .18);
    border-radius: 11px;
    color: #fdcb6e;
    font-size: 12px;
    white-space: nowrap;
}

.app-sidebar__credits strong { font-size: 15px; }
.app-sidebar__email {
    overflow: hidden;
    padding: 0 12px;
    color: #77758d;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar__action.is-logout { color: #a9a4b7; }
.app-sidebar__action.is-logout:hover { color: #ffb09e; background: rgba(225, 112, 85, .1); }

.release-update-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 5000;
    display: none;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 12px;
    width: min(520px, calc(100vw - 48px));
    padding: 14px 16px;
    border: 1px solid rgba(143, 124, 244, .42);
    border-radius: 14px;
    background: #1b1a2e;
    color: #f4f2ff;
    box-shadow: 0 18px 56px rgba(0, 0, 0, .4);
}
.release-update-toast.is-visible { display: grid; }
.release-update-toast strong,
.release-update-toast span { display: block; }
.release-update-toast span { margin-top: 3px; color: #aaa8bb; font-size: 12px; }
.release-update-toast button,
.release-modal__actions button,
.release-modal__actions a {
    border: 0;
    border-radius: 9px;
    padding: 9px 12px;
    background: #7562ea;
    color: #fff;
    font: inherit;
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
}
.release-update-toast button.is-quiet { padding-inline: 6px; background: transparent; color: #aaa8bb; }

.release-modal { position: fixed; inset: 0; z-index: 5100; }
.release-modal[hidden] { display: none; }
.release-modal__backdrop { position: absolute; inset: 0; background: rgba(5, 5, 12, .72); backdrop-filter: blur(5px); }
.release-modal__dialog {
    position: relative;
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    margin: 8vh auto 0;
    overflow: auto;
    padding: 28px;
    border: 1px solid rgba(143, 124, 244, .35);
    border-radius: 18px;
    background: #171625;
    color: #f4f2ff;
    box-shadow: 0 28px 90px rgba(0, 0, 0, .5);
}
.release-modal__close { position: absolute; top: 13px; right: 16px; border: 0; background: transparent; color: #8f8ca2; font-size: 28px; cursor: pointer; }
.release-modal__eyebrow { color: #55d8b7; font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.release-modal h2 { margin: 8px 32px 5px 0; color: #f4f2ff; font-size: 24px; }
.release-modal__summary { margin: 18px 0 12px; color: #d8d4e9; line-height: 1.7; }
.release-modal__items { margin: 0; padding-left: 20px; color: #aaa8bb; font-size: 13px; line-height: 1.85; }
.release-modal__actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.release-modal__actions a { background: rgba(117, 98, 234, .14); color: #b8adff; border: 1px solid rgba(143,124,244,.3); }

/* The page-level styles use different variable names; defining both families on
   the body lets one preference switch all authenticated pages consistently. */
body.theme-light {
    --bg: #f5f7fb;
    --page-bg: #f5f7fb;
    --card: #ffffff;
    --page-card: #ffffff;
    --surface: #ffffff;
    --surface-2: #eef1f7;
    --card-hover: #f0f2f8;
    --page-card-hover: #f0f2f8;
    --text: #202334;
    --page-text: #202334;
    --text-dim: #5d6678;
    --page-text-dim: #5d6678;
    --text-muted: #7c879a;
    --page-text-muted: #7c879a;
    --settings-bg: #f5f7fb;
    --settings-card: #ffffff;
    --settings-text: #202334;
    --settings-muted: #5d6678;
    --settings-line: rgba(36, 45, 66, .14);
    --border: rgba(36, 45, 66, .14);
    --page-border: rgba(36, 45, 66, .14);
    background: var(--page-bg, #f5f7fb) !important;
    color: var(--page-text, #202334) !important;
}

body.theme-light .app-sidebar {
    background: rgba(255, 255, 255, .96);
    border-right-color: rgba(36, 45, 66, .12);
    box-shadow: 12px 0 32px rgba(43, 52, 75, .1);
}

body.theme-light .app-sidebar__brand { color: #202334; border-bottom-color: rgba(36,45,66,.12); }
body.theme-light .app-sidebar__link,
body.theme-light .app-sidebar__action,
body.theme-light .app-sidebar__theme-toggle { color: #5d6678; }
body.theme-light .app-sidebar__link:hover,
body.theme-light .app-sidebar__action:hover,
body.theme-light .app-sidebar__theme-toggle:hover,
body.theme-light .app-sidebar__link.is-active { color: #2f2c66; background: rgba(108,92,231,.1); border-color: rgba(108,92,231,.24); }
body.theme-light .app-sidebar__section { color: #8a94a6; }
body.theme-light .app-sidebar__footer { border-top-color: rgba(36,45,66,.12); }
body.theme-light .app-sidebar__email { color: #8a94a6; }
body.theme-light .app-sidebar__credits { border-color: rgba(184,128,19,.24); }
body.theme-light .top-nav,
body.theme-light .topbar,
body.theme-light .nav,
body.theme-light header { background: rgba(255,255,255,.9) !important; border-color: rgba(36,45,66,.12) !important; }
body.theme-light input,
body.theme-light textarea,
body.theme-light select { background-color: rgba(255,255,255,.86) !important; color: var(--text, #202334) !important; }

/* Remove the old top-bar spacing after the shared sidebar takes over. */
body.has-app-sidebar .main-workspace { padding-top: 32px; }
body.has-app-sidebar .pe-container { margin-top: 24px; }
body.has-app-sidebar .page-wrapper { padding-top: 28px; }
body.has-app-sidebar .qc-container { margin-top: 36px; }
body.has-app-sidebar .usage-shell { padding-top: 28px; }

@media (max-width: 768px) {
    :root { --app-sidebar-width: 84px; }
    .app-sidebar { padding: 16px 9px 12px; }
    .app-sidebar__brand { justify-content: center; padding: 0 0 16px; }
    .app-sidebar__brand span,
    .app-sidebar__section,
    .app-sidebar__link span,
    .app-sidebar__action span,
    .app-sidebar__email { display: none; }
    .app-sidebar__link,
    .app-sidebar__action,
    .app-sidebar__theme-toggle { justify-content: center; padding: 10px 5px; }
    .app-sidebar__link i,
    .app-sidebar__action i { margin: 0; }
    .app-sidebar__link.has-unread-release::after { position: absolute; margin: -24px 0 0 24px; padding: 2px 4px; font-size: 8px; }
    .app-sidebar__credits { padding: 9px 4px; text-align: center; }
    .app-sidebar__credits strong { display: block; margin-top: 3px; font-size: 11px; }
    body.has-app-sidebar .main-workspace { padding-left: 16px; padding-right: 16px; }
    .release-update-toast { right: 12px; bottom: 12px; width: calc(100vw - 24px); grid-template-columns: 1fr auto; }
    .release-update-toast button.is-quiet { display: none; }
    .release-modal__dialog { margin-top: 24px; padding: 24px 20px; }
}
