/* CardFollower / Atelier Command UI
   Visual system only. Interaction contracts, IDs and API-driven markup remain untouched. */

:root {
    color-scheme: light;
    --orange-primary: #f06432;
    --orange-secondary: #ff8a5c;
    --orange-bg: #fff3eb;
    --orange-border: rgba(240, 100, 50, .22);
    --orange-border-strong: rgba(240, 100, 50, .48);
    --text-dark: #17212b;
    --text-medium: #5d6975;
    --text-light: #8d99a6;
    --text-muted: #aeb8c2;
    --surface: #ffffff;
    --surface-raised: #fffdfa;
    --surface-soft: #f7f5f1;
    --surface-tint: #fff8f3;
    --ink: #17212b;
    --white: #ffffff;
    --black: #101820;
    --buy-green: #07c160;
    --buy-green-soft: #e8f9ef;
    --toast-green: #07c160;
    --toast-green-hover: #06a653;
    --sell-red: #d75d51;
    --sell-red-soft: #fff0ed;
    --success: #07c160;
    --error: #d75d51;
    --warning: #c47a20;
    --info: #3d78a8;
    --font-sans: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-display: Inter, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --radius-xs: 5px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 26px;
    --shadow-xs: 0 1px 2px rgba(20, 28, 36, .05);
    --shadow-sm: 0 5px 18px rgba(25, 33, 42, .07);
    --shadow-md: 0 12px 34px rgba(25, 33, 42, .10);
    --shadow-lg: 0 24px 70px rgba(25, 33, 42, .16);
    --shadow-orange: 0 12px 30px rgba(240, 100, 50, .16);
    --ease-out: cubic-bezier(.22, 1, .36, 1);
    --page-gutter: clamp(16px, 3vw, 56px);
    --content-width: 1720px;
}

* { box-sizing: border-box; }

html {
    min-width: 320px;
    background: #f3f1ed;
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    min-height: 0;
    margin: 0;
    overflow-x: hidden;
    color: var(--text-dark);
    background:
        radial-gradient(circle at 4% 0%, rgba(240, 100, 50, .08), transparent 28rem),
        radial-gradient(circle at 96% 8%, rgba(61, 120, 168, .06), transparent 30rem),
        linear-gradient(135deg, #f8f7f4 0%, #f1efeb 100%);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::before {
    position: fixed;
    z-index: -1;
    inset: 0;
    pointer-events: none;
    content: "";
    opacity: .34;
    background-image: linear-gradient(rgba(23, 33, 43, .022) 1px, transparent 1px), linear-gradient(90deg, rgba(23, 33, 43, .022) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(to bottom, black, transparent 78%);
}

button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
::selection { color: #fff; background: var(--orange-primary); }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: rgba(23, 33, 43, .045); }
::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 99px; background: rgba(93, 105, 117, .32); background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(240, 100, 50, .62); background-clip: padding-box; }

/* Shared controls */
.btn {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0 15px;
    color: var(--text-dark);
    background: var(--surface);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .01em;
    cursor: pointer;
    transition: transform .22s var(--ease-out), box-shadow .22s var(--ease-out), background .22s ease, border-color .22s ease, color .22s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn:disabled { opacity: .56; cursor: wait; transform: none; box-shadow: none; }
.btn:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(240, 100, 50, .23); outline-offset: 2px; }
.btn-primary {
    border-color: var(--orange-primary) !important;
    color: #fff !important;
    background: linear-gradient(135deg, #f87944, #e9562c) !important;
    box-shadow: 0 7px 16px rgba(240, 100, 50, .18);
}
.btn-primary:hover { background: linear-gradient(135deg, #ff8a58, #ef6235) !important; box-shadow: var(--shadow-orange); }
.btn-ghost {
    border-color: rgba(93, 105, 117, .22) !important;
    color: var(--text-medium) !important;
    background: rgba(255, 255, 255, .62) !important;
}
.btn-ghost:hover { border-color: var(--orange-border-strong) !important; color: var(--orange-primary) !important; background: var(--orange-bg) !important; }
.btn-danger { border-color: rgba(215, 93, 81, .24) !important; color: var(--sell-red) !important; background: var(--sell-red-soft) !important; }
.btn-danger:hover { color: #fff !important; background: var(--sell-red) !important; box-shadow: 0 8px 18px rgba(215, 93, 81, .17); }
.btn-sm { min-height: 31px; border-radius: 8px; padding: 0 11px; font-size: 11px; }

input:not([type="checkbox"]):not([type="radio"]), textarea, select {
    width: 100%;
    min-height: 40px;
    border: 1px solid rgba(93, 105, 117, .18) !important;
    border-radius: 10px !important;
    padding: 9px 12px;
    color: var(--text-dark) !important;
    outline: none;
    background: rgba(255, 255, 255, .86) !important;
    box-shadow: inset 0 1px 1px rgba(23, 33, 43, .025);
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
input:not([type="checkbox"]):not([type="radio"]):hover, textarea:hover, select:hover { border-color: rgba(240, 100, 50, .36) !important; }
input:not([type="checkbox"]):not([type="radio"]):focus, textarea:focus, select:focus { border-color: var(--orange-primary) !important; background: #fff !important; box-shadow: 0 0 0 4px rgba(240, 100, 50, .10), 0 5px 14px rgba(23, 33, 43, .05) !important; }
textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
select { appearance: none; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--text-light) 50%), linear-gradient(135deg, var(--text-light) 50%, transparent 50%) !important; background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px !important; background-size: 5px 5px, 5px 5px !important; background-repeat: no-repeat !important; padding-right: 32px !important; }
input::placeholder, textarea::placeholder { color: #a4afb9; }
input[type="checkbox"] { accent-color: var(--orange-primary); }

/* Brand and public shell */
.logo, .login-logo {
    display: inline-grid;
    width: 38px;
    height: 38px;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(135deg, #ff9a67, #e64e29);
    box-shadow: 0 8px 20px rgba(240, 100, 50, .22), inset 0 1px rgba(255, 255, 255, .35);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .06em;
}
.login-logo { width: 54px; height: 54px; margin: 0 auto 15px; border-radius: 17px; font-size: 17px; }

#publicView { min-height: 0; }
.public-nav-bar {
    position: sticky;
    z-index: 50;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(100% - 28px, var(--content-width));
    min-height: 31px;
    margin: 6px auto 0;
    padding: 4px clamp(9px, 1.2vw, 15px);
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 11px;
    background: rgba(255, 255, 255, .77);
    box-shadow: 0 6px 20px rgba(23, 33, 43, .07);
    backdrop-filter: blur(18px) saturate(1.1);
    transition: padding .35s var(--ease-out), background .25s ease, box-shadow .25s ease;
}
.public-nav-bar.scrolled { min-height: 31px; padding-right: 7px; padding-left: 7px; background: rgba(255, 255, 255, .93); box-shadow: var(--shadow-md); }
.public-nav-brand, .navbar-brand { display: flex; flex-shrink: 0; align-items: center; gap: 7px; color: var(--text-dark); font-size: 12px; font-weight: 850; letter-spacing: -.02em; }
.public-nav-brand .logo { width: 22px; height: 22px; border-radius: 7px; font-size: 8px; }
.nav-logo { height: 24px; width: auto; border-radius: 6px; object-fit: contain; }
#mainNav .nav-logo { height: 22px; }
.public-nav-menu {
    position: absolute;
    left: 50%;
    top: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(19px, 2.4vw, 48px);
    transform: translate(-50%, -50%);
    transition: gap .35s var(--ease-out);
}
.public-nav-bar.scrolled .public-nav-menu { gap: clamp(9px, 1.2vw, 24px); }
.public-nav-bar.scrolled .public-nav-menu a { transform: scale(.92); opacity: .75; letter-spacing: .02em; }
.public-nav-bar.scrolled .public-nav-menu a:hover { transform: scale(.92) translateY(-1px); opacity: 1; font-size: 13px; font-weight: 900; }
.public-nav-bar.scrolled .public-nav-menu a.nav-active { font-size: 13px; font-weight: 900; }
.public-nav-menu a {
    position: relative;
    padding: 4px 5px;
    color: var(--text-medium);
    font-size: 10px;
    font-weight: 400;
    text-decoration: none;
    white-space: nowrap;
    transition: color .2s ease, transform .35s var(--ease-out), letter-spacing .35s var(--ease-out), opacity .35s var(--ease-out), font-size .25s var(--ease-out), font-weight .25s ease;
}
.public-nav-menu a::after {
    position: absolute;
    right: 4px;
    bottom: 0;
    left: 4px;
    height: 3px;
    border-radius: 3px;
    content: "";
    background: var(--toast-green);
    box-shadow: 0 2px 6px rgba(7, 193, 96, .35);
    transform: scaleX(0);
    transition: transform .25s var(--ease-out);
}
.public-nav-menu a:hover { color: var(--toast-green); transform: translateY(-1px); font-size: 16px; font-weight: 900; }
.public-nav-menu a:hover::after, .public-nav-menu a.nav-active::after { transform: scaleX(1); }
.public-nav-menu a.nav-active { color: var(--toast-green); transform: translateY(-1px); font-size: 16px; font-weight: 900; }
.public-nav-menu a.nav-active:hover { color: var(--toast-green); }
.public-nav-actions { display: flex; align-items: center; margin-left: auto; gap: 4px; }
.public-nav-actions a,
.public-nav-actions a:hover,
.public-nav-actions a:focus,
.public-nav-actions a:visited { text-decoration: none !important; }
.public-nav-actions .btn { min-height: 24px; padding: 0 7px; font-size: 9px; }
.admin-secret-dot { width: 14px; height: 14px; flex: 0 0 auto; border: 0; border-radius: 50%; background: var(--toast-green); box-shadow: 0 0 0 4px rgba(7, 193, 96, .12), 0 4px 10px rgba(7, 193, 96, .25); cursor: pointer; transition: transform .2s ease, box-shadow .2s ease; }
.admin-secret-dot:hover { transform: scale(1.18); box-shadow: 0 0 0 5px rgba(7, 193, 96, .18), 0 5px 14px rgba(7, 193, 96, .32); }
.public-container { width: 100%; max-width: var(--content-width); margin: 0 auto; padding-top: 8px; padding-bottom: 0; }
.public-container > .strategy-grid { padding: 0 var(--page-gutter) 70px; }
.public-container:has(.public-home) { padding-top: 0; padding-bottom: 0; }
.public-container:has(.public-home) .public-home-card,
.public-container:has(.public-home) .public-home-card:hover {
    box-shadow: var(--shadow-orange);
    transform: none;
    border-color: rgba(255, 255, 255, .85);
}
.public-nav-bar.scrolled + .public-container:has(.public-home) { padding-top: 0; }
.public-nav-bar.scrolled + .public-container:has(.public-home) .public-home { padding-top: 6px; }
.public-container:has(.public-home) .public-home-hero h1 { font-size: clamp(28px, 4.8vw, 68px); }
.public-container:has(.public-home) .public-home-card {
    min-height: 0;
    height: calc(100vh - 46px);
    max-height: calc(100vh - 46px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-top: clamp(10px, 2vw, 30px);
    padding-bottom: clamp(8px, 1.5vw, 20px);
    border-radius: 19px;
    clip-path: inset(0 round 19px);
    background: rgba(255, 255, 255, .92);
    box-shadow: var(--shadow-orange);
    backdrop-filter: blur(12px);
    transform: none;
    border-color: rgba(255, 255, 255, .85);
    transition: transform .28s var(--ease-out), border-color .25s ease, box-shadow .28s var(--ease-out), background .25s ease;
}
.public-container:has(.public-home) .public-home-card:hover { border-color: rgba(255, 255, 255, .85); box-shadow: var(--shadow-orange); transform: none; }
.public-container:has(.public-home) .public-home-hero { margin-top: 8.1vh; flex: 1; }
.public-home-bottom { display: flex; flex-direction: column; gap: 0; }
.public-container:has(.public-home) .public-home-principles { margin-top: -95px; margin-bottom: 65px; }
.public-container:has(.public-home) .public-home-card::before { position: absolute; z-index: 2; top: 0; right: 14%; left: 14%; display: block; width: auto; height: 5px; border: 0; border-radius: 0 0 8px 8px; content: ""; pointer-events: none; background: linear-gradient(90deg, rgba(240, 100, 50, 0) 0%, rgba(240, 100, 50, .05) 8%, rgba(240, 100, 50, .12) 20%, rgba(240, 100, 50, .3) 35%, rgba(240, 100, 50, .72) 50%, rgba(240, 100, 50, .3) 65%, rgba(240, 100, 50, .12) 80%, rgba(240, 100, 50, .05) 92%, rgba(240, 100, 50, 0) 100%); opacity: .72; }
.public-container:has(.public-home) .public-home-card::after { position: absolute; z-index: 2; right: 14%; bottom: 0; left: 14%; display: block; width: auto; height: 5px; border: 0; border-radius: 8px 8px 0 0; content: ""; pointer-events: none; background: linear-gradient(90deg, rgba(240, 100, 50, 0) 0%, rgba(240, 100, 50, .05) 8%, rgba(240, 100, 50, .12) 20%, rgba(240, 100, 50, .3) 35%, rgba(240, 100, 50, .72) 50%, rgba(240, 100, 50, .3) 65%, rgba(240, 100, 50, .12) 80%, rgba(240, 100, 50, .05) 92%, rgba(240, 100, 50, 0) 100%); box-shadow: none; opacity: .72; transform: none; }
.public-home-grid-noise { position: absolute; z-index: -1; inset: 0; opacity: .4; pointer-events: none; background-image: linear-gradient(rgba(240, 100, 50, .08) 1px, transparent 1px), linear-gradient(90deg, rgba(240, 100, 50, .08) 1px, transparent 1px); background-size: 34px 34px; mask-image: radial-gradient(circle at center, black, transparent 75%); animation: home-grid-drift 16s linear infinite; }
.public-home-grid-noise::after { position: absolute; inset: 0; content: "HY 01 10 11 1001"; color: rgba(0, 184, 148, .2); font-family: var(--font-mono); font-size: clamp(18px, 3vw, 44px); letter-spacing: .65em; line-height: 2.5; white-space: pre-wrap; word-spacing: 1.2em; animation: home-code-pulse 4s ease-in-out infinite; }
.public-home-card { position: relative; width: 100%; overflow: hidden; padding: clamp(21px, 4.25vw, 71px); border: 1px solid rgba(255, 255, 255, .85); border-radius: 19px; text-align: center; background: rgba(255, 255, 255, .92); box-shadow: var(--shadow-sm); backdrop-filter: blur(12px); transition: transform .28s var(--ease-out), border-color .25s ease, box-shadow .28s var(--ease-out), background .25s ease; }
.public-home-card::before { top: 0; right: 14%; left: 14%; height: 2px; border-radius: 0 0 8px 8px; content: ""; background: linear-gradient(90deg, transparent, rgba(240, 100, 50, .72), transparent); opacity: .72; }
.public-home-card:hover { border-color: rgba(240, 100, 50, .34); box-shadow: var(--shadow-md); transform: translateY(-4px); }
.public-home-card:hover .public-home-hero h1, .public-home-card:hover .public-home-principles strong { transform: scale(1.04); font-weight: 950; }
.public-home-kicker { color: var(--orange-primary); font-family: var(--font-display); font-size: 15px; font-weight: 850; letter-spacing: .42em; line-height: 1.2; text-indent: .42em; }
.public-home-hero { max-width: 980px; margin: 2vh auto 0; }
.public-home-hero h1 { margin: 0 0 18px; color: var(--text-dark); font-family: var(--font-display); font-size: clamp(28px, 5.5vw, 88px); font-weight: 900; line-height: 1.08; letter-spacing: -.025em; white-space: nowrap; transition: transform .35s var(--ease-out), font-weight .35s ease; }
.public-home-hero h1 em { font-style: normal; background: linear-gradient(120deg, #f06432 0%, #ff8a5c 55%, #f06432 100%); background-clip: text; -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.public-home-hero h1 .hero-sub { display: block; margin-top: .08em; font-size: .34em; font-weight: 850; letter-spacing: .1em; color: var(--text-light); }
.public-home-hero p { max-width: 720px; margin: 0 auto; color: var(--text-medium); font-size: clamp(15px, 1.5vw, 22px); line-height: 1.8; }
.public-home-actions { display: flex; justify-content: center; gap: 10px; margin-top: 28px; }
.public-home-principles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 850px; margin: clamp(16px, 3vw, 35px) auto 0; border-top: 1px solid rgba(93, 105, 117, .14); border-bottom: 1px solid rgba(93, 105, 117, .14); }
.public-home-principles div { position: relative; display: grid; gap: 5px; padding: 20px 12px; border-right: 1px solid rgba(93, 105, 117, .12); cursor: help; }
.public-home-principles div:last-child { border-right: 0; }
.public-home-principles strong { color: var(--orange-primary); font-size: clamp(19px, 2vw, 28px); transition: transform .35s var(--ease-out), font-weight .35s ease; }
.public-home-principles span { color: var(--text-light); font-size: 11px; }
/* Hero principle tooltip cards */
.public-home-tooltip {
    position: fixed;
    z-index: 9999;
    width: min(392px, calc(100vw - 32px));
    padding: 22px 26px 24px;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: 18px;
    text-align: center;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 26px 70px rgba(8, 15, 22, .26), 0 6px 18px rgba(23, 33, 43, .08);
    backdrop-filter: blur(16px) saturate(1.2);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, calc(-100% + 14px)) scale(.96);
    transition: opacity .22s ease, transform .28s var(--ease-out);
}
.public-home-tooltip.show { opacity: 1; transform: translate(-50%, -100%) scale(1); }
.public-home-tooltip .tt-line { height: 3px; margin: -22px -26px 14px; border-radius: 0 0 8px 8px; background: linear-gradient(90deg, transparent, var(--orange-primary), transparent); }
.public-home-tooltip .tt-title { margin: 0 0 12px; color: var(--orange-primary); font-family: var(--font-display); font-size: 20px; font-weight: 900; letter-spacing: -.01em; }
.public-home-tooltip .tt-body { margin: 0 auto; max-width: 320px; color: var(--text-medium); font-size: 13.5px; font-weight: 600; line-height: 1.75; text-align: center; }
.public-home-tooltip::after { position: absolute; top: 100%; left: 50%; width: 12px; height: 12px; margin-left: -6px; content: ""; background: #fff; border-right: 1px solid rgba(255, 255, 255, .72); border-bottom: 1px solid rgba(255, 255, 255, .72); transform: translateY(-6px) rotate(45deg); }
.public-home-disclaimer { max-width: 850px; margin: 10px auto 0; color: var(--text-light); font-size: 14px; text-align: center; border: 2px solid #d75d51; border-radius: 10px; padding: 12px 16px; }
.public-home-disclaimer span { color: #d75d51; font-weight: 850; font-family: "STFangsong", "华文仿宋", "FangSong", serif; }
.public-home-disclaimer p { margin: 5px 0 0; font-family: "STFangsong", "华文仿宋", "FangSong", serif; color: #d75d51; }
.public-home-company-info { display: flex; flex-direction: column; align-items: center; gap: 1px; margin-top: 12px; text-align: center; }
.public-home-company-info span { color: var(--orange-primary); font-size: 10px; font-weight: 600; line-height: 1.5; }
.public-home-company-info span:first-child { font-size: 20px; }
@keyframes home-grid-drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(34px, 34px, 0); } }
@keyframes home-code-pulse { 0%, 100% { opacity: .18; transform: scale(1); } 50% { opacity: .42; transform: scale(1.02); } }

/* Authentication */
.login-overlay, .modal-overlay {
    position: fixed;
    z-index: 100;
    inset: 0;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(17, 25, 32, .62);
    backdrop-filter: blur(14px) saturate(.8);
}
.login-overlay { z-index: 80; }
.login-box {
    position: relative;
    width: min(100%, 430px);
    overflow: hidden;
    padding: 30px clamp(24px, 5vw, 46px) 28px;
    border: 2px solid rgba(240, 100, 50, .45) !important;
    border-radius: 26px;
    text-align: center;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 30px 90px rgba(8, 15, 22, .28);
    animation: panel-in .5s var(--ease-out) both;
    transition: border-color .25s ease, box-shadow .25s ease;
}
.login-box:hover { border-color: rgba(240, 100, 50, .82); box-shadow: 0 0 0 2px rgba(240, 100, 50, .12), 0 30px 90px rgba(8, 15, 22, .28); }
.login-box::before { display: none; }
.login-box h2 { margin: 0 0 23px; color: var(--text-dark); font-size: 22px; letter-spacing: -.04em; }
.login-tabs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; margin-bottom: 22px; padding: 4px; border: 1px solid rgba(93, 105, 117, .12); border-radius: 12px; background: var(--surface-soft); }
.login-tab { position: relative; min-height: 37px; border: 0; border-radius: 9px; color: var(--text-light); background: transparent; font-size: 12px; font-weight: 750; cursor: pointer; transition: color .2s ease, background .2s ease, box-shadow .2s ease; }
.login-tab:hover { color: var(--orange-primary); }
.login-tab.active { color: var(--orange-primary); background: #fff; box-shadow: var(--shadow-xs); }
.login-box input {
    margin-bottom: 10px;
    border: 1px solid rgba(93, 105, 117, .2) !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, #fff, #fafcfb) !important;
    box-shadow: inset 0 1px 2px rgba(23, 33, 43, .035), 0 2px 8px rgba(23, 33, 43, .03);
}
.login-box input:focus { border-color: var(--buy-green) !important; box-shadow: 0 0 0 4px rgba(0, 184, 148, .12), 0 8px 18px rgba(0, 184, 148, .08) !important; }
.admin-login-back { width: 100%; margin-top: 10px; }
.login-box .btn-primary { min-height: 44px; margin-top: 4px; width: 100%; border-radius: 12px; }
.login-box a { font-weight: 700; text-decoration: none; }
.login-box a:hover { color: var(--orange-primary) !important; }
.adm-login-close {
  position: absolute; top: 12px; right: 14px;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 8px; background: rgba(93, 105, 117, .08);
  color: var(--text-light); font-size: 20px; cursor: pointer;
  transition: background .15s ease, color .15s ease; z-index: 10;
}
.adm-login-close:hover { background: rgba(215, 93, 81, .12); color: var(--sell-red); }

/* Role-specific login pages */
.role-login-page {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    animation: fadeIn .3s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.role-login-card {
    position: relative; width: min(100%, 440px);
    padding: 40px clamp(28px, 5vw, 48px) 36px;
    border-radius: 24px; text-align: center;
    box-shadow: 0 40px 100px rgba(0,0,0,.25);
    animation: panel-in .45s var(--ease-out) both;
    overflow: hidden;
}
.role-login-card::before {
    position: absolute; top: 0; left: 10%; right: 10%; height: 3px;
    border-radius: 0 0 6px 6px; content: "";
}
.role-login-card.follower-login {
    background: linear-gradient(160deg, #fff 0%, #fff7ed 100%);
    border: 1px solid rgba(240, 100, 50, .15);
}
.role-login-card.follower-login::before { background: linear-gradient(90deg, transparent, #f06432, transparent); }
.role-login-card.follower-login .role-login-icon { background: linear-gradient(135deg, #ff9a67, #e64e29); }
.role-login-card.follower-login .role-login-btn { background: linear-gradient(135deg, #f06432, #e8542a); box-shadow: 0 4px 16px rgba(240,100,50,.35); }
.role-login-card.follower-login .role-login-btn:hover { box-shadow: 0 6px 24px rgba(240,100,50,.45); transform: translateY(-1px); }

.role-login-card.signal-login {
    background: linear-gradient(160deg, #fff 0%, #fff7ed 100%);
    border: 1px solid rgba(240, 100, 50, .15);
}
.role-login-card.signal-login::before { background: linear-gradient(90deg, transparent, #f06432, transparent); }
.role-login-card.signal-login .role-login-icon { background: linear-gradient(135deg, #ff9a67, #e64e29); }
.role-login-card.signal-login .role-login-btn { background: linear-gradient(135deg, #f06432, #e8542a); box-shadow: 0 4px 16px rgba(240,100,50,.35); }
.role-login-card.signal-login .role-login-btn:hover { box-shadow: 0 6px 24px rgba(240,100,50,.45); transform: translateY(-1px); }

.role-login-card.admin-login {
    background: linear-gradient(160deg, #fff 0%, #fff7ed 100%);
    border: 1px solid rgba(240, 100, 50, .15);
}
.role-login-card.admin-login::before { background: linear-gradient(90deg, transparent, #f06432, transparent); }
.role-login-card.admin-login .role-login-icon { background: linear-gradient(135deg, #f06432, #e8542a); }
.role-login-card.admin-login .role-login-btn { background: linear-gradient(135deg, #f06432, #e8542a); box-shadow: 0 4px 16px rgba(240,100,50,.35); }
.role-login-card.admin-login .role-login-btn:hover { box-shadow: 0 6px 24px rgba(240,100,50,.45); transform: translateY(-1px); }

.role-login-icon {
    width: 64px; height: 64px; margin: 0 auto 18px;
    border-radius: 18px; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 28px; font-weight: 900;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.role-login-card h2 { margin: 0 0 6px; color: var(--text-dark); font-size: 22px; font-weight: 850; letter-spacing: -.03em; }
.role-login-card .role-login-desc { color: var(--text-light); font-size: 13px; margin: 0 0 24px; line-height: 1.5; }
.role-login-card input {
    width: 100%; height: 44px; padding: 0 14px; margin-bottom: 12px;
    border: 1px solid rgba(93, 105, 117, .15); border-radius: 11px;
    font-size: 14px; color: var(--text-dark); background: #fff;
    transition: all .15s ease;
}
.role-login-card input:focus { outline: none; border-color: var(--orange-primary); box-shadow: 0 0 0 3px rgba(240, 100, 50, .1); }
.role-login-card input::placeholder { color: var(--text-muted); }
.role-login-btn {
    width: 100%; height: 46px; border: none; border-radius: 12px;
    color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
    transition: all .2s ease; margin-top: 4px;
}
.role-login-btn:active { transform: translateY(0) scale(.98); }
.role-login-back {
    display: inline-block; margin-top: 16px; color: var(--text-light);
    font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
    transition: color .15s ease;
}
.role-login-back:hover { color: var(--orange-primary); }
.role-login-error { color: var(--sell-red); font-size: 13px; margin: 8px 0; display: none; }

/* Authenticated app shell */
#mainNav {
    position: sticky;
    z-index: 40;
    top: 0;
    display: flex;
    min-height: 36px;
    align-items: center;
    gap: clamp(8px, 1vw, 16px);
    padding: 6px var(--page-gutter);
    color: var(--text-dark);
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, #FFF7ED 0%, #FFF3EB 100%);
    border-bottom: 1px solid rgba(240, 100, 50, .12);
    box-shadow: 0 4px 16px rgba(240, 100, 50, .06);
    backdrop-filter: blur(18px);
}
#mainNav::after { position: absolute; right: var(--page-gutter); bottom: 0; left: var(--page-gutter); height: 1px; content: ""; background: linear-gradient(90deg, transparent, rgba(240, 100, 50, .25), transparent); }
.navbar-brand { color: var(--text-dark); }
.navbar-brand .logo { width: 24px; height: 24px; border-radius: 7px; font-size: 8px; }
.role-badge { display: inline-flex; min-height: 23px; align-items: center; border: 1px solid rgba(240, 100, 50, .2); border-radius: 99px; padding: 0 9px; color: var(--orange-primary); background: rgba(240, 100, 50, .08); font-size: 10px; font-weight: 800; }
.role-badge.user { color: #07c160; background: rgba(7, 193, 96, .08); border-color: rgba(7, 193, 96, .2); }
.role-badge.signal { color: #3d78a8; background: rgba(61, 120, 168, .08); border-color: rgba(61, 120, 168, .2); }
.navbar-stats { display: flex; align-items: center; gap: clamp(10px, 2vw, 28px); margin-left: auto; }
.stat-item { display: flex; min-width: 56px; flex-direction: column; gap: 1px; }
.stat-value { color: var(--text-dark); font-size: 18px; font-weight: 850; line-height: 1.1; letter-spacing: -.03em; }
.stat-label { color: var(--text-light); font-size: 10px; white-space: nowrap; }
.navbar-status { display: flex; align-items: center; gap: 8px; color: var(--text-medium); font-size: 11px; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border: 2px solid rgba(7, 193, 96, .35); border-radius: 50%; background: var(--buy-green); box-shadow: 0 0 0 4px rgba(7, 193, 96, .12); animation: soft-pulse 2.6s ease-in-out infinite; }
.consistency-badge { display: inline-flex; min-height: 22px; align-items: center; border: 1px solid transparent; border-radius: 99px; padding: 0 8px; font-size: 10px; font-weight: 800; }
.consistency-badge.ok { color: #07c160; border-color: rgba(7, 193, 96, .3); background: rgba(7, 193, 96, .08); }
.consistency-badge.warn { color: #c47a20; border-color: rgba(196, 122, 32, .35); background: rgba(196, 122, 32, .08); }
#mainNav .btn-ghost { border-color: rgba(93, 105, 117, .15) !important; color: var(--text-medium) !important; background: rgba(255, 255, 255, .6) !important; }
.signal-navbar-add-btn { margin-left: 4px; color: #fff !important; border-color: var(--orange-primary) !important; background: var(--orange-primary) !important; }
#mainNav .signal-navbar-add-btn:hover { color: #fff !important; border-color: #df4e27 !important; background: #df4e27 !important; }
#consistencyBadge { display: none !important; }
#mainNav .btn-ghost:hover { color: var(--text-dark) !important; border-color: rgba(240, 100, 50, .4) !important; background: rgba(240, 100, 50, .08) !important; }
.logged-in-user-meta { display: none !important; }

#mainContainer { width: 100%; max-width: var(--content-width); margin: 0 auto; padding: clamp(9px, .9vw, 14px) var(--page-gutter) 80px; }
.container { width: 100%; max-width: var(--content-width); margin: 0 auto; }
.main-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 350px); align-items: start; gap: clamp(18px, 2.6vw, 38px); }
.main-layout.admin-full { grid-template-columns: 1fr; }
.left-panel, .signal-source-panel { min-width: 0; }
.right-panel { position: sticky; top: 92px; min-width: 0; }
.strategy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: clamp(9px, .9vw, 14px); align-items: stretch; }

/* Trade records */
.trade-records-section {
    width: min(calc(100% - 2 * var(--page-gutter)), var(--content-width));
    margin: 18px auto 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .86);
    border-radius: 16px;
    background: rgba(255, 255, 255, .78);
    box-shadow: var(--shadow-sm);
}
.trade-records-header { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 15px; border-bottom: 1px solid rgba(93, 105, 117, .12); background: rgba(255, 255, 255, .58); }
.trade-records-header h3 { margin: 0; color: var(--text-dark); font-size: 12px; font-weight: 850; }
.trade-records-header h3 svg { stroke: var(--orange-primary) !important; }
.trade-count-badge { display: inline-grid; min-width: 20px; height: 20px; place-items: center; margin-left: 4px; border-radius: 99px; color: #fff; background: var(--orange-primary); font-size: 10px; }
.trade-records-body { display: block; max-height: 180px; overflow-y: auto; padding: 5px 10px; }
.trade-record-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.trade-record-item { display: grid; min-width: 0; gap: 3px; align-content: center; justify-items: center; border: 1px solid rgba(93, 105, 117, .1); border-radius: 9px; padding: 8px 5px; color: var(--text-medium); background: rgba(255, 255, 255, .7); font-family: var(--font-mono); font-size: 10px; line-height: 1.3; text-align: center; }
.trade-record-item.latest { border-color: rgba(0, 184, 148, .35); color: #00b894; background: var(--buy-green-soft) !important; }
.trade-record-item.latest .tr-time { color: #388879 !important; }
.tr-slot { color: var(--text-dark); font-weight: 750; }
.tr-direction.buy, .direction.buy, .tr-direction.sell, .direction.sell { display: inline-flex; align-items: center; border-radius: 5px; padding: 2px 5px !important; font-weight: 800; }
.tr-direction.buy, .direction.buy { color: var(--buy-green) !important; background: var(--buy-green-soft); }
.tr-direction.sell, .direction.sell { color: var(--sell-red) !important; background: var(--sell-red-soft); }
.tr-code { color: var(--text-dark); font-weight: 750; }
.standard-line { display: block; width: 100%; overflow-x: auto; margin-top: 4px; color: var(--text-medium); font-family: var(--font-mono); font-size: 9px; white-space: nowrap; }
.trade-records-empty, .trade-log-empty { padding: 28px 16px; color: var(--text-light); text-align: center; font-size: 12px; }

/* Sources and cards */
.source-card {
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, .9);
    border-radius: 19px;
    background: rgba(255, 255, 255, .92);
    box-shadow: none;
}
.source-card.collapsed .source-body { display: none; }
.source-card.collapsed .collapse-arrow { transform: rotate(-90deg); }
.source-card::before { display: none; }
.strategy-card-admin, [id^="sc-"] { padding: clamp(14px, 1.5vw, 20px); }
.strategy-card-admin::before, [id^="sc-"]::before { display: none; }
.strategy-card-admin:hover, [id^="sc-"]:hover { border-color: rgba(255, 255, 255, .9) !important; box-shadow: none !important; transform: none !important; }
.strategy-card-admin .strategy-card-header-admin { border-bottom-color: rgba(93, 105, 117, .11); }
.source-header { display: flex; min-height: 58px; align-items: center; gap: 12px; padding: 10px 15px; border-bottom: 1px solid rgba(93, 105, 117, .11); cursor: pointer; }
.source-body, .strategy-card-admin .strategy-card-log, [id^="sc-"] .strategy-card-log { border-radius: 13px; background: rgba(255, 255, 255, .5); }
.source-title { display: flex; min-width: 0; flex: 1; align-items: center; gap: 9px; }
.source-title input { min-width: 0; border: 0 !important; padding: 4px 0 !important; background: transparent !important; box-shadow: none !important; font-size: 17px; font-weight: 850; }
.source-title input:focus { box-shadow: 0 2px 0 var(--orange-primary) !important; }
.source-icon { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; background: var(--orange-primary); box-shadow: 0 0 0 5px rgba(240, 100, 50, .11); }
.source-meta { display: flex; align-items: center; gap: 13px; color: var(--text-light); font-size: 11px; white-space: nowrap; }
.source-meta strong { color: var(--text-dark); font-weight: 850; }
.source-actions { display: flex; align-items: center; gap: 9px; }
.collapse-arrow { color: var(--text-light); font-size: 14px; transition: transform .25s var(--ease-out); }
.delete-source-btn { border: 0; color: var(--sell-red); background: transparent; font-size: 11px; font-weight: 750; cursor: pointer; }
.delete-source-btn:hover { text-decoration: underline; }
.source-body { padding: clamp(15px, 2vw, 25px); }
.image-section { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.05fr) minmax(230px, 1fr); gap: 15px; align-items: start; margin-bottom: 24px; }
.image-box { min-width: 0; }
.image-frame, .slot-image-frame { position: relative; display: grid; min-height: 90px; overflow: hidden; place-items: center; border: 1px dashed rgba(240, 100, 50, .35); border-radius: 13px; background: linear-gradient(135deg, #fff8f3, #f8f5f0); cursor: pointer; }
.image-frame { aspect-ratio: 16 / 9; }
.image-frame img, .slot-image-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.image-frame:hover, .slot-image-frame:hover { border-color: var(--orange-primary); box-shadow: inset 0 0 0 1px rgba(240, 100, 50, .18); }
.image-label { margin-top: 7px; color: var(--text-light); font-size: 10px; text-align: center; }
.upload-placeholder { display: grid; place-items: center; gap: 5px; padding: 14px; color: var(--text-light); font-size: 11px; text-align: center; }
.upload-placeholder .icon { color: var(--orange-primary); opacity: .78; }
.delete-btn, .slot-del-btn { position: absolute; top: 7px; right: 7px; display: grid; width: 24px; height: 24px; place-items: center; border: 1px solid rgba(255, 255, 255, .9); border-radius: 50%; color: var(--sell-red); background: rgba(255, 255, 255, .9); box-shadow: var(--shadow-xs); cursor: pointer; }
.delete-btn:hover, .slot-del-btn:hover { color: #fff; background: var(--sell-red); }
.desc-section { min-width: 0; }
.desc-section label { display: block; margin-bottom: 7px; color: var(--text-medium); font-size: 11px; font-weight: 800; }
.desc-section textarea { min-height: 125px; }
.save-btn { min-height: 34px; margin-top: 8px; border: 0; border-radius: 8px; padding: 0 13px; color: #fff; background: var(--orange-primary); font-size: 11px; font-weight: 800; cursor: pointer; }
.save-btn:hover { background: #df4e27; box-shadow: var(--shadow-orange); }
.slots-section { border-top: 1px solid rgba(93, 105, 117, .12); padding-top: 20px; }
.slots-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.slots-header h3 { margin: 0; color: var(--text-dark); font-size: 13px; font-weight: 850; }
.slots-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 13px; }
.add-source-card { display: grid; min-height: 145px; place-items: center; align-content: center; gap: 9px; margin-top: 14px; border: 1px dashed rgba(240, 100, 50, .42); border-radius: var(--radius-lg); color: var(--orange-primary); background: rgba(255, 248, 243, .64); font-size: 13px; font-weight: 800; cursor: pointer; transition: background .2s ease, border-color .2s ease, transform .2s var(--ease-out); }
.add-source-card:hover { border-color: var(--orange-primary); background: var(--orange-bg); transform: translateY(-2px); }
.add-source-card .plus { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid var(--orange-border-strong); border-radius: 50%; font-size: 24px; font-weight: 400; }

/* Strategy cards */
.strategy-card, [id^="sc-"] {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .9) !important;
    border-radius: 19px !important;
    padding: clamp(14px, 1.5vw, 20px) !important;
    color: var(--text-dark);
    background: rgba(255, 255, 255, .92) !important;
    box-shadow: var(--shadow-sm) !important;
    transition: transform .28s var(--ease-out), border-color .25s ease, box-shadow .28s var(--ease-out);
}
.strategy-card::before, [id^="sc-"]::before { position: absolute; top: 0; right: 14%; left: 14%; height: 2px; border-radius: 0 0 8px 8px; content: ""; background: linear-gradient(90deg, transparent, rgba(240, 100, 50, .72), transparent); opacity: .72; }
.strategy-card:hover, [id^="sc-"]:hover { border-color: var(--orange-primary) !important; box-shadow: 0 0 0 2px rgba(240,100,50,0.25), var(--shadow-md) !important; transform: translateY(-4px); }
.strategy-card.has-signal { border-color: rgba(0, 184, 148, .38) !important; box-shadow: 0 14px 36px rgba(0, 184, 148, .10) !important; }
.strategy-card.followed { border-color: rgba(240, 100, 50, .55) !important; box-shadow: 0 14px 38px rgba(240, 100, 50, .13) !important; }
.strategy-card-header, .strategy-card-header-admin, .slot-top { display: flex; min-width: 0; align-items: center; gap: 9px; margin-bottom: 12px; }
.strategy-card-header { min-height: 31px; }
.strategy-card-header-admin { padding-bottom: 10px; border-bottom: 1px solid rgba(93, 105, 117, .11); }
.strategy-card-name, .slot-name { min-width: 0; overflow: hidden; color: var(--text-dark); font-size: 14px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.admin-card-name-input { flex: 1 1 auto; min-width: 0; border: 1px solid rgba(93, 105, 117, .18) !important; border-radius: 11px !important; padding: 7px 10px !important; color: var(--text-dark) !important; background: linear-gradient(135deg, #fff, #fafcfb) !important; box-shadow: inset 0 1px 2px rgba(23, 33, 43, .03); }
.admin-card-name-input:focus { border-color: var(--buy-green) !important; box-shadow: 0 0 0 4px rgba(0, 184, 148, .1) !important; }
.admin-strategy-factors input, .strategy-card-admin textarea, .strategy-card-signal textarea, #signalSlotsList input[type="text"] { border-radius: 11px !important; }
.strategy-card-header-admin .official-badge { flex: 0 0 auto; }

.slot-checkbox { display: flex; min-width: 0; align-items: center; gap: 8px; cursor: pointer; }
.slot-checkbox input[type="checkbox"] { width: 17px; height: 17px; margin: 0; flex: 0 0 auto; border-radius: 5px; cursor: pointer; }
.official-badge, .official-badge-slot {
    display: inline-flex;
    min-height: 21px;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
    border: 1px solid rgba(0, 184, 148, .24);
    border-radius: 999px;
    padding: 0 7px !important;
    color: #00b894 !important;
    background: linear-gradient(135deg, #effcf7, #dff7ee) !important;
    box-shadow: inset 0 1px rgba(255, 255, 255, .9), 0 2px 7px rgba(0, 184, 148, .10);
    font-size: 10px !important;
    font-weight: 850;
    letter-spacing: .02em;
    white-space: nowrap;
}
.official-badge svg, .official-badge-slot svg { width: 13px; height: 13px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.official-badge::before, .official-badge-slot::before { display: none; }
.slot-images { display: flex; gap: 9px; margin-bottom: 11px; }
.slot-image-box { min-width: 0; flex: 1; }
.slot-image-frame { aspect-ratio: 16 / 9; }
.strategy-card-desc, .public-slot-desc { display: -webkit-box; min-height: 54px; overflow: hidden; margin: 9px 0; color: var(--text-medium); font-size: 12px; line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.strategy-card-log, .follower-trade-log { overflow: auto; min-height: 38px; max-height: 145px; margin-top: 10px; border-top: 1px solid rgba(93, 105, 117, .10); border-bottom: 1px solid rgba(93, 105, 117, .10); padding: 7px 0; color: var(--text-medium); font-family: var(--font-mono); font-size: 10px; line-height: 1.55; }
.strategy-card-log > div, .follower-trade-log > div { border-bottom-color: rgba(93, 105, 117, .09) !important; }
.strategy-card-log > div:first-child { background: var(--orange-bg) !important; }
.slot-delete-btn { display: block; width: 100%; margin-top: 10px; border: 0; border-top: 1px dashed rgba(215, 93, 81, .22); padding-top: 9px; color: var(--sell-red); background: transparent; font-size: 10px; font-weight: 750; cursor: pointer; }
.slot-delete-btn:hover { color: #a33d35; }
.slot-status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #c7cfd5; }
.slot-status-dot.active { background: var(--buy-green); box-shadow: 0 0 0 4px var(--buy-green-soft); }
.slot-signal { padding: 7px 9px; border-radius: 8px; background: var(--surface-soft); }
.slot-signal .code, .slot-signal .time { font-family: var(--font-mono); }
.slot-signal .code { color: var(--text-dark); font-weight: 850; }
.info, .time { color: var(--text-light) !important; }

/* Editable strategy factors */
.strategy-factors, .admin-strategy-factors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 8px 0 11px; }
.strategy-factors span { min-width: 0; overflow: hidden; border: 1px solid rgba(93, 105, 117, .09); border-radius: 8px; padding: 7px 8px; color: var(--text-light); background: var(--surface-soft); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.strategy-factors b { display: block; overflow: hidden; margin-top: 2px; color: var(--text-dark); font-size: 10px; text-overflow: ellipsis; }
.admin-strategy-factors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-strategy-factors label { display: flex; min-width: 0; flex-direction: column; gap: 4px; color: var(--text-light); font-size: 10px; font-weight: 700; }
.admin-strategy-factors input { min-height: 33px !important; padding: 6px 8px !important; font-size: 11px; }
.strategy-card-admin textarea, .strategy-card-signal textarea { min-height: 70px; }

#mainContainer:has(#signalView) { padding-top: 9px; }
#mainContainer:has(#signalView) #signalView, #mainContainer:has(#signalView) .signal-source-panel { margin-top: 0; padding-top: 0; }
#mainContainer:has(#signalView) #signalSlotsList { margin-top: -2px; }
#mainContainer:has(#signalView) .signal-page-toolbar { margin-bottom: 2px; }
.signal-page-toolbar { display: flex; position: relative; z-index: 2; align-items: center; justify-content: flex-end; min-height: 38px; margin: 0 0 8px; padding: 0; }
.signal-page-toolbar .add-slot-btn { min-height: 34px; padding: 0 15px; font-size: 16px; }
.signal-strategy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; width: 100%; margin: 0; padding: 0; box-sizing: border-box; }

#signalSlotsList { font-size: 22px; }
#signalSlotsList .signal-card-actions { position: static; z-index: auto; display: flex; align-items: center; gap: 4px; }
#signalSlotsList .signal-toggle-btn, #signalSlotsList .signal-save-btn { min-height: 24px; border: 1px solid #111; border-radius: 3px; padding: 0 7px; color: #fff; font-size: 10px; font-weight: 850; line-height: 1; cursor: pointer; background: #111; box-shadow: none; transition: background .2s ease, border-color .2s ease, color .2s ease; }
#signalSlotsList .signal-toggle-btn:hover, #signalSlotsList .signal-save-btn:hover { transform: none; border-color: #000; color: #fff; background: #000; box-shadow: none; }
#signalSlotsList .signal-toggle-btn.is-enabled { border-color: var(--toast-green); color: #fff; background: var(--toast-green); }
#signalSlotsList .signal-toggle-btn.is-disabled, #signalSlotsList .signal-save-btn { border-color: #111; color: #fff; background: #111; }
#signalSlotsList .signal-toggle-btn.is-feedback, #signalSlotsList .signal-save-btn.is-feedback { animation: none; }
.signal-card-flash { animation: signal-card-border-flash 3s ease both; }
.signal-strategy-card.signal-card-flash { animation: signal-card-border-flash-card 3s ease both; }
@keyframes signal-card-border-flash {
    0%, 100% { border-color: rgba(23, 33, 43, .14); box-shadow: none; }
    20%, 50%, 80% { border-color: var(--orange-primary); box-shadow: 0 0 0 2px rgba(240, 100, 50, .22); }
}
@keyframes signal-card-border-flash-card {
    0%, 100% { border-color: rgba(23, 33, 43, .12); box-shadow: 0 6px 18px rgba(23, 33, 43, .06); }
    20%, 50%, 80% { border-color: var(--orange-primary); box-shadow: 0 0 0 3px rgba(240, 100, 50, .18); }
}
#signalSlotsList .signal-card-name-row { display: flex; min-width: 0; align-items: center; gap: 8px; margin: 12px 0; padding-right: 0; }
#signalSlotsList .signal-card-name-label { flex: 0 0 auto; color: var(--text-light); font-size: 11px; font-weight: 850; letter-spacing: .06em; white-space: nowrap; }
#signalSlotsList .signal-card-name-input { flex: 1; min-width: 0; min-height: 30px; border: 1px solid rgba(23, 33, 43, .17) !important; border-radius: 8px !important; padding: 7px 9px !important; color: var(--text-dark) !important; background: #fff !important; font-size: 15px !important; font-weight: 850; }
#signalSlotsList .signal-strategy-card { font-size: 12px; }
#signalSlotsList .signal-strategy-card .strategy-factors, #signalSlotsList .signal-strategy-card .strategy-factors span, #signalSlotsList .signal-strategy-card .strategy-factors b { font-size: inherit; }
#signalSlotsList .signal-strategy-card textarea { min-height: 68px; font-size: 12px !important; line-height: 1.55; }
#signalSlotsList .signal-strategy-card .strategy-card-log, #signalSlotsList .signal-strategy-card .strategy-card-log > div { font-size: 10px !important; }
#signalSlotsList .signal-strategy-card .signal-endpoint-row { font-size: 10px; }
#signalSlotsList .signal-strategy-card .signal-endpoint-row input { font-size: 10px !important; min-height: 29px; }
#signalSlotsList .signal-strategy-card .signal-delete-btn { width: 24px; height: 24px; min-height: 24px; padding: 0 !important; font-size: 0 !important; }
#signalSlotsList .signal-strategy-card .signal-card-index { font-size: 11px; }
.signal-card-flash { animation: signal-card-border-flash 3s ease both; }
.signal-strategy-card.signal-card-flash { animation: signal-card-border-flash-card 3s ease both; }
@keyframes signal-card-border-flash {
    0%, 100% { border-color: rgba(23, 33, 43, .14); box-shadow: none; }
    20%, 50%, 80% { border-color: var(--orange-primary); box-shadow: 0 0 0 2px rgba(240, 100, 50, .22); }
}
@keyframes signal-card-border-flash-card {
    0%, 100% { border-color: rgba(23, 33, 43, .12); box-shadow: 0 6px 18px rgba(23, 33, 43, .06); }
    20%, 50%, 80% { border-color: var(--orange-primary); box-shadow: 0 0 0 3px rgba(240, 100, 50, .18); }
}
.signal-source-panel { width: 100%; }
#signalSourceInfo { color: var(--text-medium); }
.signal-strategy-grid { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)) !important; gap: clamp(9px, .9vw, 14px) !important; width: 100%; margin: 0; padding: 0; box-sizing: border-box; }
.signal-add-slot-row { margin-bottom: 9px !important; }
#signalSlotsList .strategy-card { min-height: 100%; }
#signalSlotsList .strategy-card > div[style*="FAF7F2"] { border: 1px solid rgba(61, 120, 168, .18) !important; border-radius: 12px !important; background: #f2f7fb !important; color: var(--text-medium) !important; }
#signalSlotsList .strategy-card > div[style*="FAF7F2"] span[style*="E17055"] { background: var(--sell-red) !important; }
#signalSlotsList .strategy-card > div[style*="FAF7F2"] span[style*="00B894"] { background: var(--buy-green) !important; }
#signalSlotsList .strategy-card > div[style*="FAF7F2"] span[style*="0084B4"] { color: #2b6b9b !important; }
.icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid currentColor; border-radius: 10px; padding: 6px; background: transparent; cursor: pointer; transition: transform .2s var(--ease-out), background .2s ease, color .2s ease, box-shadow .2s ease; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.slot-enabled-btn { color: var(--toast-green) !important; }
.slot-enabled-btn:hover, .slot-enabled-btn.is-enabled { color: #fff !important; background: var(--toast-green) !important; }
.slot-save-premium { color: var(--orange-primary) !important; }
.slot-save-premium:hover { color: #fff !important; background: var(--orange-primary) !important; }
.icon-btn.is-saved { color: var(--buy-green) !important; background: var(--buy-green-soft) !important; }

/* Follower workspace and basket */
.position-sidebar { overflow: hidden; border: 1px solid rgba(255, 255, 255, .9); border-radius: var(--radius-lg); background: rgba(255, 255, 255, .9); box-shadow: var(--shadow-md); }
.position-sidebar-header, .position-bar-header { display: flex; min-height: 44px; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid rgba(93, 105, 117, .12); color: var(--text-dark); background: linear-gradient(120deg, #fff, #fff7f1); font-size: 13px; font-weight: 850; }
.position-sidebar-header::before { width: 9px; height: 9px; margin-right: -2px; border-radius: 50%; content: ""; background: var(--orange-primary); box-shadow: 0 0 0 5px rgba(240, 100, 50, .1); }
.position-sidebar-body, .position-bar-body { max-height: calc(100vh - 260px); overflow-y: auto; padding: 8px; }
.position-bar { overflow: hidden; border: 1px solid rgba(255, 255, 255, .9); border-radius: var(--radius-lg); background: rgba(255, 255, 255, .9); box-shadow: var(--shadow-md); }
.position-bar-footer { padding: 10px 14px; border-top: 1px solid rgba(93, 105, 117, .12); }
.position-empty { display: grid; min-height: 165px; place-items: center; align-content: center; gap: 9px; padding: 25px 15px; color: var(--text-light); text-align: center; font-size: 11px; line-height: 1.7; }
.position-empty .icon { color: var(--orange-primary); opacity: .55; font-size: 26px; }
.position-card { border-bottom: 1px solid rgba(93, 105, 117, .10); padding: 13px 14px; }
.position-card:last-child { border-bottom: 0; }
.position-card-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.position-card-name { overflow: hidden; color: var(--text-dark); font-size: 12px; font-weight: 850; text-overflow: ellipsis; white-space: nowrap; }
.position-card-source { overflow: hidden; margin-top: 2px; color: var(--text-light); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.position-mode-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin-bottom: 9px; padding: 3px; border-radius: 8px; background: var(--surface-soft); }
.position-mode-tab { display: grid; min-height: 27px; place-items: center; border-radius: 6px; color: var(--text-light); font-size: 10px; font-weight: 750; cursor: pointer; }
.position-mode-tab:hover { color: var(--orange-primary); }
.position-mode-tab.active { color: var(--orange-primary); background: #fff; box-shadow: var(--shadow-xs); }
.position-value-input { display: flex; align-items: center; gap: 5px; }
.position-value-input input { min-height: 33px !important; padding: 5px 8px !important; font-size: 11px; }
.position-value-input span { color: var(--text-light); font-size: 10px; }
#strategyBasket { max-height: calc(100vh - 300px); overflow-y: auto; }
#strategyBasket > div { border-bottom-color: rgba(93, 105, 117, .10) !important; }
#strategyBasket .basket-item-edit-btn { border: 0; border-radius: 6px; padding: 4px 7px; color: var(--orange-primary); background: var(--orange-bg); font-size: 10px; font-weight: 800; cursor: pointer; }
#strategyBasket .basket-item-edit-btn:hover { color: #fff; background: var(--orange-primary); }
.basket-effective { display: inline-flex; align-items: center; border-radius: 99px; padding: 2px 6px; color: var(--buy-green); background: var(--buy-green-soft); font-size: 9px; font-weight: 800; }
#basketTotal { color: var(--orange-primary) !important; font-weight: 800 !important; }
.right-panel > .position-sidebar > div:last-child { border-top-color: rgba(93, 105, 117, .12) !important; background: rgba(255, 248, 243, .42); }
.right-panel > .position-sidebar > div:last-child .btn { min-height: 40px; }
.wss-status-dot { display: inline-block; width: 13px; height: 13px; flex: 0 0 auto; border: 2px solid rgba(93, 105, 117, .28); border-radius: 50%; background: #9CA3AF; transition: width .25s ease, height .25s ease, background .25s ease, box-shadow .25s ease; }
.wss-status-dot.not-followed { width: 13px; height: 13px; border-color: #6B7280; background: #9CA3AF; box-shadow: 0 0 0 3px rgba(107, 114, 128, .12); }
.wss-status-dot.followed, .wss-status-dot.connected { width: 13px; height: 13px; border-color: #059669; background: #10B981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .18); animation: followed-pulse 1.2s ease-in-out infinite; }
.wss-status-dot.connecting { border-color: rgba(196, 122, 32, .35); background: #e4a447; animation: soft-pulse 1s ease-in-out infinite; }
.wss-status-dot + .is-followed, .is-followed { color: #fff !important; border-color: var(--toast-green) !important; background: var(--toast-green) !important; box-shadow: 0 7px 16px rgba(7, 193, 96, .2); }
@keyframes followed-pulse { 0%, 100% { opacity: .65; transform: scale(.92); } 50% { opacity: 1; transform: scale(1.08); } }

/* Empty states, loading, notifications */
.empty-state { display: grid; min-height: 230px; place-items: center; align-content: center; gap: 8px; padding: 45px 20px; color: var(--text-light); text-align: center; }
.empty-state h2 { margin: 0; color: var(--text-dark); font-size: 18px; }
.empty-state p { margin: 0; font-size: 12px; }
.empty-state .icon { color: var(--orange-primary); opacity: .62; }
.spinner { width: 28px; height: 28px; border: 3px solid rgba(240, 100, 50, .16); border-top-color: var(--orange-primary); border-radius: 50%; animation: spin .8s linear infinite; }
.toast { position: fixed; z-index: 300; top: 50%; left: 50%; max-width: min(420px, calc(100vw - 32px)); border: 1px solid rgba(255, 255, 255, .72); border-radius: 12px; padding: 12px 16px; color: #fff; background: rgba(23, 33, 43, .95); box-shadow: var(--shadow-lg); font-size: 12px; font-weight: 700; animation: toast-in .35s var(--ease-out) both; }
.toast.success { border-color: var(--toast-green); background: var(--toast-green); }
.toast.error { border-color: rgba(215, 93, 81, .5); background: #bd4c43; }
.toast.info { border-color: rgba(61, 120, 168, .48); background: #28628d; }
.toast.detail { z-index: 9999; width: min(680px, calc(100vw - 32px)); max-height: min(72vh, 640px); overflow: auto; padding: 18px 20px; border-color: var(--toast-green); border-radius: 14px; background: linear-gradient(160deg, #10B981, #059669); color: #fff; font-family: var(--font-mono); font-size: 12px; font-weight: 600; line-height: 1.6; white-space: pre-wrap; text-align: left; }

/* Modals */
.modal-overlay { z-index: 220; }
.modal, .ratio-error-modal, .trade-log-modal, .admin-modal {
    position: relative;
    width: min(100%, 540px);
    max-height: min(88vh, 820px);
    overflow: auto;
    border: 2px solid rgba(240, 100, 50, .45) !important;
    border-radius: 22px;
    padding: clamp(22px, 4vw, 34px);
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 30px 100px rgba(8, 15, 22, .27);
    animation: panel-in .35s var(--ease-out) both;
}
.modal::before, .ratio-error-modal::before, .trade-log-modal::before, .admin-modal::before { position: absolute; top: 0; right: 15%; left: 15%; height: 3px; border-radius: 0 0 6px 6px; content: ""; background: linear-gradient(90deg, transparent, var(--orange-primary), transparent); }
.modal h2, .ratio-error-modal h2, .trade-log-modal h2, .admin-modal h2 { margin: 0 0 18px; color: var(--text-dark); font-size: 21px; letter-spacing: -.04em; }
.modal p { color: var(--text-medium) !important; line-height: 1.7; }
.modal input, .modal textarea, .modal select { margin-bottom: 10px; }
.modal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.ratio-error-modal { width: min(100%, 470px); text-align: center; }
.ratio-error-modal .error-icon { display: grid; width: 50px; height: 50px; place-items: center; margin: 0 auto 12px; border-radius: 50%; color: var(--warning); background: #fff5df; font-size: 25px; }
.ratio-error-modal p { color: var(--text-medium); }
.ratio-detail { margin: 16px 0; border-radius: 10px; padding: 12px; color: var(--sell-red); background: var(--sell-red-soft); font-family: var(--font-mono); font-size: 11px; }
#imagePreviewModal { background: rgba(8, 15, 22, .88); }
#imagePreviewModal img { border: 1px solid rgba(255, 255, 255, .22); border-radius: 16px !important; box-shadow: 0 30px 100px rgba(0, 0, 0, .5) !important; }
.trade-log-modal { width: min(100%, 850px); padding: 0; }
.trade-log-header, .admin-header { display: flex; min-height: 66px; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid rgba(93, 105, 117, .12); background: linear-gradient(120deg, #fff, #fff7f1); }
.trade-log-header h2, .admin-header h2 { margin: 0; }
.trade-log-body, .admin-body { padding: 20px; }
.trade-log-entry { margin-bottom: 10px; overflow: hidden; border: 1px solid rgba(93, 105, 117, .12); border-radius: 12px; background: var(--surface-soft); }
.tle-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-bottom: 1px solid rgba(93, 105, 117, .10); background: #fff; }
.tle-seq { color: var(--orange-primary); font-family: var(--font-mono); font-weight: 800; }
.tle-time { color: var(--text-light); font-family: var(--font-mono); font-size: 10px; }
.tle-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 15px; padding: 11px 12px; }
.tle-field { display: flex; min-width: 0; gap: 5px; font-family: var(--font-mono); font-size: 10px; }
.tle-field-label { color: var(--text-light); }
.tle-field-value { overflow: hidden; color: var(--text-dark); text-overflow: ellipsis; }

/* ========== Admin Panel — Enterprise Sidebar Layout ========== */
.admin-modal {
  width: min(100%, 1180px);
  height: min(92vh, 760px);
  padding: 0;
  display: flex;
  flex-direction: column;
}
/* Topbar */
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(93, 105, 117, .08);
  background: linear-gradient(135deg, #fff 0%, #fffaf6 100%);
  flex-shrink: 0;
}
.admin-topbar-title { display: flex; align-items: center; gap: 8px; }
.admin-topbar-title h2 { margin: 0; font-size: 14px; font-weight: 800; color: var(--text-dark); letter-spacing: -.02em; }
.admin-topbar-title svg { width: 18px; height: 18px; color: var(--orange-primary); flex-shrink: 0; }
.admin-close-btn {
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 6px; background: transparent; color: var(--text-light);
  font-size: 16px; cursor: pointer; transition: all .15s ease;
}
.admin-close-btn:hover { background: rgba(93, 105, 117, .08); color: var(--text-dark); }
/* Layout */
.admin-layout { display: flex; flex: 1; min-height: 0; }
/* Sidebar */
.admin-sidebar {
  width: 150px; flex-shrink: 0;
  border-right: 1px solid rgba(93, 105, 117, .08);
  background: var(--surface-soft);
  padding: 8px 6px;
  display: flex; flex-direction: column; gap: 1px;
}
.admin-nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 8px;
  color: var(--text-medium); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s ease;
  text-decoration: none; position: relative; user-select: none;
}
.admin-nav-item:hover { background: rgba(240, 100, 50, .06); color: var(--text-dark); }
.admin-nav-item.active { background: rgba(240, 100, 50, .1); color: var(--orange-primary); font-weight: 700; }
.admin-nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--orange-primary);
}
.admin-nav-icon { font-size: 14px; width: 20px; text-align: center; flex-shrink: 0; }
/* Content area */
.admin-content {
  flex: 1; min-width: 0; padding: 12px 16px; overflow-y: auto; overflow-x: auto;
}
.admin-tab-content { animation: adminFadeIn .2s var(--ease-out); }
@keyframes adminFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.admin-section-header { margin-bottom: 6px; }
.admin-section-title { font-size: 14px; font-weight: 800; color: var(--text-dark); margin: 0 0 2px; letter-spacing: -.02em; }
.admin-section-desc { font-size: 10px; color: var(--text-light); margin: 0; line-height: 1.3; }
/* Toolbar — single compact row */
.admin-toolbar {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 8px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(93, 105, 117, .08);
}
/* Buttons */
.admin-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 12px;
  border: none; border-radius: 7px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s ease; white-space: nowrap;
}
.admin-btn-primary {
  background: linear-gradient(135deg, var(--orange-primary), #e8542a); color: #fff;
  box-shadow: 0 1px 4px rgba(240, 100, 50, .25);
}
.admin-btn-primary:hover { box-shadow: 0 2px 8px rgba(240, 100, 50, .35); transform: translateY(-1px); }
.admin-btn-primary:active { transform: translateY(0); }
.admin-btn-ghost {
  background: transparent; color: var(--text-medium);
  border: 1px solid rgba(93, 105, 117, .15);
}
.admin-btn-ghost:hover { background: rgba(93, 105, 117, .05); border-color: rgba(93, 105, 117, .25); }
.admin-btn-danger { background: transparent; color: var(--sell-red); border: 1px solid rgba(215, 93, 81, .2); }
.admin-btn-danger:hover { background: var(--sell-red-soft); }
/* Inputs */
.admin-input {
  height: 30px; padding: 0 10px;
  border: 1px solid rgba(93, 105, 117, .15); border-radius: 7px;
  font-size: 12px; color: var(--text-dark); background: #fff;
  transition: all .15s ease;
}
.admin-input:focus { outline: none; border-color: var(--orange-primary); box-shadow: 0 0 0 2px rgba(240, 100, 50, .1); }
.admin-input::placeholder { color: var(--text-muted); }
.admin-select {
  height: 30px; padding: 0 24px 0 8px;
  border: 1px solid rgba(93, 105, 117, .15); border-radius: 7px;
  font-size: 12px; color: var(--text-dark); background: #fff;
  appearance: none; cursor: pointer; transition: all .15s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238d99a6' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
}
.admin-select:focus { outline: none; border-color: var(--orange-primary); box-shadow: 0 0 0 2px rgba(240, 100, 50, .1); }
/* Card container */
.admin-card {
  background: #fff; border: 1px solid rgba(93, 105, 117, .08);
  border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-xs);
}
/* Table */
.admin-table { width: 100%; border-collapse: collapse; }
/* 用户管理专用表格 */
.admin-user-table-wrap { width: 100%; overflow-x: auto; }
.admin-user-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.admin-user-table th {
  padding: 10px 12px; text-align: left; font-size: 11px; font-weight: 800;
  color: var(--text-light); background: var(--surface-soft);
  border-bottom: 1px solid rgba(93, 105, 117, .15);
  white-space: nowrap;
}
.admin-user-table td {
  padding: 10px 12px; font-size: 12px; text-align: left; color: var(--text-dark);
  border-bottom: 1px solid rgba(93, 105, 117, .08);
  vertical-align: middle; white-space: nowrap; background: #fff;
}
.admin-user-table tr:hover td { background: rgba(240, 100, 50, .02); }
.admin-user-table .user-row {
  display: table-row; align-items: unset; gap: unset; min-height: unset;
  border-bottom: 1px solid rgba(93, 105, 117, .08); padding: 0;
  font-size: inherit; white-space: nowrap; overflow: visible;
  transition: background .15s ease;
}
.admin-user-table .user-row:last-child { border-bottom: 0; }
.admin-user-table .user-row:hover td { background: rgba(240, 100, 50, .02); }
.admin-user-table col.col-name   { width: 18%; }
.admin-user-table col.col-phone  { width: 14%; }
.admin-user-table col.col-role   { width: 10%; }
.admin-user-table col.col-code   { width: 16%; }
.admin-user-table col.col-time   { width: 30%; }
.admin-user-table col.col-action { width: 8%; }
.adm-col-name { font-weight: 700; color: var(--text-dark); }
.adm-col-phone { color: var(--text-medium); font-size: 11px; }
.adm-col-code { font-family: monospace; font-size: 12px; color: var(--text-medium); }
.adm-col-time { font-size: 12px; color: var(--text-light); white-space: nowrap; }
.adm-search-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.adm-search-count { font-size: 11px; color: var(--text-light); white-space: nowrap; }
.adm-role-tag {
  display: inline-block; font-size: 11px; color: #fff; padding: 2px 8px;
  border-radius: 4px; white-space: nowrap; font-weight: 600;
}
.adm-action-delete {
  color: var(--sell-red); font-size: 12px; font-weight: 700; cursor: pointer;
}
.adm-action-delete:hover { text-decoration: underline; }
.adm-action-disabled { color: var(--text-muted); font-size: 11px; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: rgba(240, 100, 50, .02); }
.admin-table .mono { font-family: var(--font-mono); font-size: 12px; }
/* Badges */
.admin-badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 11px; font-weight: 600; white-space: nowrap;
}
.admin-badge-success { color: #065F46; background: #ECFDF5; }
.admin-badge-warning { color: #92400E; background: #FFFBEB; }
.admin-badge-info { color: #1E40AF; background: #EFF6FF; }
.admin-badge-muted { color: var(--text-light); background: var(--surface-soft); }
/* Empty state */
.admin-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; color: var(--text-light); text-align: center;
}
.admin-empty-icon { font-size: 36px; margin-bottom: 12px; opacity: .5; }
.admin-empty-text { font-size: 14px; font-weight: 500; }
/* Row styles for HMAC, Users, Settings */
.hmac-source-row, .admin-setting-row {
  display: grid; grid-template-columns: minmax(120px, 1fr) minmax(160px, 2fr) auto auto;
  align-items: center; gap: 10px; min-height: 44px;
  border-bottom: 1px solid rgba(93, 105, 117, .08); padding: 6px 0;
  transition: background .15s ease;
}
.hmac-source-row:last-child, .admin-setting-row:last-child { border-bottom: 0; }
.hmac-source-row:hover, .admin-setting-row:hover { background: rgba(240, 100, 50, .02); }
.hmac-source-row input {
  min-height: 34px !important; padding: 6px 9px !important;
  font-family: var(--font-mono); font-size: 11px;
}
.hsr-name, .ur-username, .asr-key {
  overflow: hidden; color: var(--text-dark); font-size: 12px; font-weight: 700;
  text-overflow: ellipsis; white-space: nowrap;
}
.hsr-status, .ur-role {
  display: inline-flex; width: max-content; min-height: 22px;
  align-items: center; border-radius: 6px; padding: 0 8px; font-size: 11px; font-weight: 600;
}
.hsr-status.configured { color: #065F46; background: #ECFDF5; }
.hsr-status.empty { color: var(--text-light); background: var(--surface-soft); }
.ur-role.admin { color: #92400E; background: #FFFBEB; }
.ur-role.signal { color: #1E40AF; background: #EFF6FF; }
.ur-role.user { color: #065F46; background: #ECFDF5; }
.hsr-save { color: var(--orange-primary); font-size: 12px; font-weight: 700; cursor: pointer; }
.hsr-save:hover { text-decoration: underline; }
.user-row {
  display: flex; align-items: center; gap: 8px; min-height: 36px;
  border-bottom: 1px solid rgba(93, 105, 117, .08); padding: 5px 0;
  font-size: 13px; white-space: nowrap; overflow: hidden;
  transition: background .15s ease;
}
.user-row:last-child { border-bottom: 0; }
.user-row:hover { background: rgba(240, 100, 50, .02); }
.asr-value { overflow: hidden; color: var(--text-medium); font-family: var(--font-mono); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.asr-category { color: var(--text-light); font-size: 11px; }
/* Export */
#exportResult {
  border: 1px solid rgba(93, 105, 117, .08) !important; color: var(--text-medium) !important;
  background: var(--surface-soft) !important; font-family: var(--font-mono); font-size: 12px;
  border-radius: 10px; padding: 14px; max-height: 340px; overflow-y: auto;
}
/* Mobile responsive */
@media (max-width: 768px) {
  .admin-sidebar { display: none; }
  .admin-content { padding: 16px; }
  .hmac-source-row, .admin-setting-row { grid-template-columns: 1fr auto; gap: 6px; }
  .hmac-source-row .hsr-key, .admin-setting-row .asr-value { grid-column: 1 / -1; }
  .hmac-source-row .hsr-save { grid-column: 2; grid-row: 1; }
  .user-row { flex-wrap: wrap; white-space: normal; }
  .admin-user-table .user-row { flex-wrap: nowrap; white-space: nowrap; }
}

/* Misc. states and helper classes */
.add-slot-btn { min-height: 34px; }
.slot-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(93, 105, 117, .12);
    border-radius: 15px;
    padding: 13px;
    background: rgba(255, 255, 255, .82);
    box-shadow: var(--shadow-xs);
    transition: transform .25s var(--ease-out), border-color .2s ease, box-shadow .25s var(--ease-out);
}
.slot-card:hover { border-color: rgba(240, 100, 50, .3); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.slot-card.followed { border-color: rgba(240, 100, 50, .46); background: var(--surface-tint); }
.slot-card .slot-top { margin-bottom: 10px; }
.slot-description { min-height: 68px; margin-top: 8px; font-size: 11px; }
.position-value-input label { min-width: 30px; color: var(--text-light); font-size: 10px; font-weight: 750; }
.position-value-input .unit { flex: 0 0 auto; color: var(--text-light); font-size: 10px; }
.tr-price, .tr-volume { color: var(--text-dark); font-family: var(--font-mono); font-weight: 700; }
.tr-price { color: var(--info); }
.tr-volume { color: var(--orange-primary); }
.history-item { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 6px; border-bottom-color: rgba(93, 105, 117, .09) !important; padding: 7px 0 !important; color: var(--text-medium); font-size: 10px; }
.h-code { color: var(--text-dark); font-family: var(--font-mono); font-weight: 800; }
.h-time { grid-column: 1 / -1; color: var(--text-light); font-family: var(--font-mono); font-size: 9px; }
#adminView, #signalView, #followerView { animation: view-in .42s var(--ease-out) both; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes soft-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .56; } }
@keyframes panel-in { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -50%) translateY(14px) scale(.97); } to { opacity: 1; transform: translate(-50%, -50%) translateY(0) scale(1); } }
@keyframes toast-out { from { opacity: 1; transform: translate(-50%, -50%) translateY(0); } to { opacity: 0; transform: translate(-50%, -50%) translateY(10px); } }

.source-card::before,
.source-card::after,
.strategy-card-admin::before,
.strategy-card-admin::after,
[id^="sc-"]::before,
[id^="sc-"]::after,
.public-container:has(.public-home) .public-home-card::before,
.public-container:has(.public-home) .public-home-card::after {
    position: absolute;
    z-index: 2;
    right: 0;
    left: 0;
    display: block;
    width: auto;
    height: 1px;
    border: 0;
    border-radius: 0;
    content: "";
    pointer-events: none;
    background: linear-gradient(90deg, rgba(93, 105, 117, .18) 0%, rgba(93, 105, 117, .18) 30%, rgba(93, 105, 117, .06) 50%, rgba(93, 105, 117, .18) 70%, rgba(93, 105, 117, .18) 100%);
    box-shadow: none;
    opacity: 1;
    transform: none;
}
.source-card::before,
.strategy-card-admin::before,
[id^="sc-"]::before,
.public-container:has(.public-home) .public-home-card::before { top: 0; }
.source-card::after,
.strategy-card-admin::after,
[id^="sc-"]::after,
.public-container:has(.public-home) .public-home-card::after { bottom: 0; }

.trade-records-body .trade-record-grid,
.strategy-card-log,
.follower-trade-log {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.trade-records-body .trade-record-item,
.strategy-card-log .trade-record-item,
.follower-trade-log .trade-record-item {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    overflow: hidden;
    border: 0;
    border-bottom: 1px solid rgba(93, 105, 117, .09);
    border-radius: 0;
    padding: 4px 6px;
    text-align: left;
    white-space: nowrap;
}
.trade-records-body .trade-record-item:last-child,
.strategy-card-log .trade-record-item:last-child,
.follower-trade-log .trade-record-item:last-child { border-bottom: 0; }
.trade-records-body .trade-record-item > span,
.strategy-card-log .trade-record-item > span,
.follower-trade-log .trade-record-item > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade-records-body .trade-record-item.latest,
.strategy-card-log .trade-record-item.latest,
.follower-trade-log .trade-record-item.latest { background: var(--buy-green-soft) !important; }

@media (min-width: 1920px) {
    body { font-size: 15px; }
    .strategy-grid { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 17px; }
    #mainContainer { padding-top: 54px; }
}

@media (min-width: 2560px) {
    :root { --content-width: 2048px; --page-gutter: clamp(48px, 4vw, 96px); }
    body { font-size: 16px; }
    .public-nav-bar { min-height: 68px; }
    #mainNav { min-height: 84px; background: linear-gradient(135deg, #FFF7ED 0%, #FFF3EB 100%); }
    .strategy-grid { grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 17px; }
    .strategy-card { padding: 24px !important; border-radius: 22px !important; }
    .source-card { border-radius: 22px; }
    .source-header { min-height: 78px; padding: 17px 24px; }
    .public-home-card { padding: 100px; }
}

@media (max-width: 1080px) {
    .public-nav-menu { gap: 0; }
    .public-nav-menu a { padding-right: 6px; padding-left: 6px; }
    .main-layout { grid-template-columns: minmax(0, 1fr) 290px; }
    .image-section { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .desc-section { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
    .signal-page-toolbar { justify-content: stretch; }
    .signal-page-toolbar .add-slot-btn { width: 100%; }
    .signal-strategy-grid { grid-template-columns: 1fr !important; }

    .public-nav-bar { width: calc(100% - 18px); min-height: 28px; flex-wrap: wrap; gap: 4px; margin-top: 4px; padding: 4px 6px; border-radius: 9px; }
    .public-nav-brand .logo { width: 19px; height: 19px; }
    .public-nav-menu { order: 3; width: 100%; flex: 1 0 100%; justify-content: flex-start; overflow-x: auto; gap: 8px; padding-top: 0; }
    .public-nav-menu a { padding: 3px 2px; font-size: 9px; }
    .public-nav-actions { margin-left: auto; }
    .public-container { padding-top: 14px; }
    .public-nav-actions .btn { min-height: 22px; padding: 0 5px; font-size: 8px; }
    .public-nav-actions .btn-ghost:not(:last-child) { display: none; }
    .public-home { padding-top: 18px; }
    .public-home-hero { margin-top: 8vh; }
    .public-home-actions { flex-wrap: wrap; }
    .public-home-principles { grid-template-columns: 1fr; }
    .public-home-principles div { border-right: 0; border-bottom: 1px solid rgba(93, 105, 117, .12); }
    .public-home-principles div:last-child { border-bottom: 0; }
    #mainContainer:has(#signalView) { padding-top: 9px; }
    #mainContainer:has(#signalView) #signalSlotsList { margin-top: 0; }
    .trade-record-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .navbar-stats { order: 3; width: 100%; justify-content: space-around; margin: 0; padding-top: 7px; border-top: 1px solid rgba(255, 255, 255, .1); }
    .navbar-status { margin-left: auto; }
    .navbar-status #connStatus, .consistency-badge, .logged-in-user-meta { display: none; }
    .main-layout { grid-template-columns: 1fr; }
    .right-panel { position: static; }
    #mainContainer { padding: clamp(9px, .9vw, 14px) 12px 55px; }
    .trade-records-section { width: calc(100% - 24px); margin-top: 12px; }
    .image-section { grid-template-columns: 1fr 1fr; }
    .desc-section { grid-column: 1 / -1; }
    .strategy-factors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .strategy-card-header, .strategy-card-header-admin { align-items: flex-start; }
    .tle-fields { grid-template-columns: 1fr; }
    .hmac-source-row, .admin-setting-row { grid-template-columns: 1fr auto; gap: 6px; }
    .hmac-source-row .hsr-key, .admin-setting-row .asr-value { grid-column: 1 / -1; }
    .hmac-source-row .hsr-save { grid-column: 2; grid-row: 1; }
    .user-row { flex-wrap: wrap; white-space: normal; }
    .admin-body, .trade-log-body { padding: 14px; }
}

@media (max-width: 480px) {
    .trade-record-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .public-nav-brand span:not(.logo) { display: none; }
    .public-nav-actions .btn-primary { padding: 0 9px; }
    .public-home-section:first-child h2 { font-size: 35px; }
    .image-section, .slot-images { gap: 7px; }
    .strategy-factors { gap: 5px; }
    .strategy-factors span { padding: 6px; font-size: 8px; }
    .source-header { flex-wrap: wrap; gap: 8px; padding: 12px; }
    .source-title { width: 100%; flex: 1 0 100%; }
    .source-meta { order: 3; }
    .source-actions { margin-left: auto; }
    .modal-overlay { padding: 10px; }
    .modal, .ratio-error-modal { padding: 22px 16px; border-radius: 18px; }
    .modal-actions { flex-wrap: wrap; }
    .modal-actions .btn { flex: 1; }
}

.public-container:has(.public-home) .public-home-card::before {
    position: absolute;
    z-index: 2;
    top: 0;
    right: 14%;
    left: 14%;
    display: block;
    width: auto;
    height: 5px;
    border: 0;
    border-radius: 0 0 8px 8px;
    content: "";
    pointer-events: none;
    background: linear-gradient(90deg, rgba(240, 100, 50, 0) 0%, rgba(240, 100, 50, .05) 8%, rgba(240, 100, 50, .12) 20%, rgba(240, 100, 50, .3) 35%, rgba(240, 100, 50, .72) 50%, rgba(240, 100, 50, .3) 65%, rgba(240, 100, 50, .12) 80%, rgba(240, 100, 50, .05) 92%, rgba(240, 100, 50, 0) 100%);
    box-shadow: none;
    opacity: .72;
    transform: none;
}
.public-container:has(.public-home) .public-home-card::after { position: absolute; z-index: 2; right: 14%; bottom: 0; left: 14%; display: block; width: auto; height: 5px; border: 0; border-radius: 8px 8px 0 0; content: ""; pointer-events: none; background: linear-gradient(90deg, rgba(240, 100, 50, 0) 0%, rgba(240, 100, 50, .05) 8%, rgba(240, 100, 50, .12) 20%, rgba(240, 100, 50, .3) 35%, rgba(240, 100, 50, .72) 50%, rgba(240, 100, 50, .3) 65%, rgba(240, 100, 50, .12) 80%, rgba(240, 100, 50, .05) 92%, rgba(240, 100, 50, 0) 100%); box-shadow: none; opacity: .72; transform: none; }

.signal-strategy-card { position: relative; display: flex; min-width: 0; flex-direction: column; overflow: hidden; border: 1px solid rgba(23, 33, 43, .12); border-radius: 14px; padding: 14px; color: var(--text-dark); background: #fffdfa; box-shadow: 0 6px 18px rgba(23, 33, 43, .06); transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease; }
.signal-strategy-card.signal-card-enabled { border-color: rgba(0, 184, 148, .28); }
.signal-strategy-card.signal-card-disabled { border-color: rgba(240, 100, 50, .2); }
.signal-strategy-card.is-saving { opacity: .86; }
.signal-strategy-card::before { position: absolute; top: 0; right: 12%; left: 12%; height: 2px; border-radius: 0 0 8px 8px; content: ""; background: linear-gradient(90deg, transparent, rgba(240, 100, 50, .72), transparent); }
.signal-card-header { display: flex; min-height: 38px; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(23, 33, 43, .1); padding-bottom: 9px; }
.signal-card-status { display: flex; align-items: center; gap: 8px; color: var(--text-medium); font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.signal-card-index { display: inline-grid; width: 26px; height: 26px; place-items: center; border-radius: 7px; color: #fff; background: var(--text-dark); font-family: var(--font-mono); font-size: 11px; }
.signal-card-actions { display: flex; align-items: center; gap: 6px; }
.signal-card-actions button, .signal-copy-btn, .signal-image-delete, .signal-delete-btn { border: 1px solid transparent; border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 800; line-height: 1; cursor: pointer; transition: background .2s ease, color .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.signal-card-actions button:hover, .signal-copy-btn:hover, .signal-image-delete:hover, .signal-delete-btn:hover { transform: translateY(-1px); box-shadow: 0 5px 12px rgba(23, 33, 43, .12); }
.signal-toggle-btn.is-enabled { color: #fff; border-color: var(--toast-green); background: var(--toast-green); box-shadow: none; }
.signal-toggle-btn.is-disabled { color: #fff; border-color: #111; background: #111; box-shadow: none; }
.signal-save-btn { color: #fff; border-color: #111; background: #111; box-shadow: none; }
.signal-card-name-row { display: flex; min-width: 0; align-items: center; gap: 8px; margin: 12px 0; }
.signal-card-name-label, .signal-card-section-label { color: var(--text-light); font-size: 11px; font-weight: 850; letter-spacing: .06em; white-space: nowrap; }
.signal-card-name-input { min-width: 0; flex: 1; border: 1px solid rgba(23, 33, 43, .17) !important; border-radius: 8px !important; padding: 7px 9px !important; color: var(--text-dark) !important; background: #fff !important; font-size: 15px !important; font-weight: 850; }
.signal-card-images { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 11px; }
.signal-card-image { position: relative; display: grid; min-width: 0; aspect-ratio: 16 / 9; overflow: hidden; place-items: center; border: 1px solid rgba(23, 33, 43, .12); border-radius: 9px; padding: 0; background: #f6f3ef; }
.signal-card-image img { display: block; width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.signal-image-empty { color: var(--text-light); background: #faf7f2; font-size: 12px; }
.signal-image-delete { position: absolute; right: 6px; bottom: 6px; color: #fff; background: rgba(23, 33, 43, .75); }
.signal-card-factors { margin-bottom: 9px; }
.signal-card-factors .strategy-factors { margin: 0; gap: 5px; }
.signal-card-factors .strategy-factors span { padding: 6px; font-size: 9px; }
.signal-card-section-label { display: block; margin: 8px 0 5px; }
.signal-strategy-card > textarea { min-height: 68px; margin: 0; border: 1px solid rgba(23, 33, 43, .14) !important; border-radius: 8px !important; padding: 8px !important; font-size: 12px !important; line-height: 1.55; }
.signal-card-log-wrap, .signal-card-endpoints { margin-top: 10px; border-top: 1px solid rgba(23, 33, 43, .1); padding-top: 5px; }
.signal-card-log-wrap .signal-card-section-label, .signal-card-endpoints .signal-card-section-label { margin-top: 0; }
.signal-strategy-card .strategy-card-log { min-height: 30px; max-height: 112px; margin-top: 0; padding: 3px 0; border: 0; background: transparent; font-size: 10px; }
.signal-strategy-card .strategy-card-log > div { padding: 4px 5px !important; font-size: 10px !important; }
.signal-endpoint-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 6px; min-width: 0; margin-top: 5px; }
.signal-endpoint-label { color: var(--text-light); font-size: 10px; font-weight: 800; white-space: nowrap; }
.signal-endpoint-row code { min-width: 0; overflow: hidden; color: #376b8e; font-family: var(--font-mono); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.signal-endpoint-row input { min-width: 0; min-height: 29px !important; padding: 5px 7px !important; font-family: var(--font-mono); font-size: 10px !important; }
.signal-copy-btn { color: var(--orange-primary); border-color: var(--orange-border); background: var(--orange-bg); }
.signal-card-footer { display: flex; justify-content: flex-end; margin-top: 8px; border-top: 1px dashed rgba(23, 33, 43, .14); padding-top: 6px; }
.signal-delete-btn { display: inline-grid; width: 24px; height: 24px; place-items: center; padding: 0; color: var(--sell-red); border-color: rgba(215, 93, 81, .28); background: var(--sell-red-soft); }
.signal-delete-btn svg { width: 13px; height: 13px; }
.signal-delete-btn:hover { color: #fff; border-color: var(--sell-red); background: var(--sell-red); }

    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
