* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body {
    font-family: var(--tsh-font);
    background: var(--tsh-bg);
    color: var(--tsh-text);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
body.tsh-app-body,
body.tsh-login-body {
    background:
            radial-gradient(circle at 52% 32%, rgba(34, 211, 238, .075), transparent 17rem),
            linear-gradient(135deg, transparent 0 42%, rgba(255,255,255,.30) 42.2% 42.35%, transparent 42.6%),
            var(--tsh-bg);
}
a { color: var(--tsh-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.tsh-app-shell {
    height: 100vh;
    display: grid;
    grid-template-columns: var(--tsh-sidebar-width) minmax(0, 1fr);
    overflow: hidden;
}

/* Sidebar — intentionally aligned with AutoHub shell proportions. */
.tsh-sidebar {
    height: 100vh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(170deg, var(--tsh-sidebar-bg) 0%, var(--tsh-sidebar-bg-2) 100%);
    color: var(--tsh-sidebar-text);
    border-right: 1px solid rgba(255,255,255,.055);
    position: relative;
}
.tsh-sidebar::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, transparent 10%, var(--tsh-primary) 45%, transparent 90%);
    opacity: .5;
    pointer-events: none;
}
.tsh-brand-row {
    height: 54px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 13px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.tsh-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    color: #fff;
    font-weight: 800;
    font-size: 16.5px;
    letter-spacing: -.025em;
    text-decoration: none;
}
.tsh-brand:hover { text-decoration: none; opacity: .92; }
.tsh-brand-logo {
    width: 29px;
    height: 29px;
    border-radius: 5px;
    object-fit: contain;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.20);
}
.tsh-brand-name { color: #fff; font-weight: 850; }
.tsh-brand-subtitle { color: var(--tsh-sidebar-muted); font-size: 11.5px; margin-top: 1px; }
.tsh-user-card {
    margin: 10px 10px 5px;
    padding: 9px 10px;
    border: 1px solid rgba(255,255,255,.075);
    border-radius: 6px;
    background: rgba(255,255,255,.042);
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
}
.tsh-user-card strong { display: block; color: #fff; font-size: 12.5px; letter-spacing: -.01em; }
.tsh-user-card small { display: block; color: var(--tsh-sidebar-muted); font-size: 11.5px; margin-top: 1px; }
.tsh-avatar {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border-radius: 5px;
    background: linear-gradient(135deg, #1d4b91, #2563eb);
    color: #fff;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
    letter-spacing: -.02em;
}
.tsh-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 7px 8px 18px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.12) transparent;
}
.tsh-nav-skeleton {
    color: var(--tsh-sidebar-muted);
    font-size: 12px;
    padding: 9px 10px;
}
.tsh-nav-group {
    margin: 14px 8px 5px;
    color: var(--tsh-sidebar-muted);
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: .13em;
    font-weight: 800;
    opacity: .72;
}
.tsh-nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--tsh-sidebar-text);
    padding: 7px 9px;
    border-radius: 5px;
    margin: 1px 0;
    font-weight: 650;
    font-size: 12.5px;
    border: 1px solid transparent;
    transition: background 100ms ease, border-color 100ms ease, color 100ms ease;
    position: relative;
    text-decoration: none;
}
.tsh-nav-item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.tsh-nav-item.is-active {
    background: rgba(37,99,235,.20);
    border-color: rgba(99,148,235,.18);
    color: #e0eaff;
    box-shadow: inset 2px 0 0 var(--tsh-primary);
}
.tsh-nav-child { padding-left: 22px; }
.tsh-nav-icon { width: 16px; display: inline-grid; place-items: center; opacity: .88; flex-shrink: 0; }
.tsh-nav-icon img { width: 14px; height: 14px; object-fit: contain; display: block; }

/* Main shell */
.tsh-main {
    height: 100vh;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--tsh-bg);
}
.tsh-topbar {
    height: 54px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: #fff;
    border-bottom: 1px solid var(--tsh-border);
    box-shadow: 0 1px 0 rgba(15,23,42,.03), var(--tsh-shadow);
    z-index: 10;
    gap: 10px;
}
.tsh-topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tsh-topbar h1 { font-size: 18px; line-height: 1.1; margin: 2px 0 0; color: #0f172a; letter-spacing: -.02em; }
.tsh-page-kicker { color: var(--tsh-muted); font-size: 10.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .075em; line-height: 1; }
.tsh-topbar-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.tsh-content {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 18px 16px 28px;
    display: grid;
    gap: 16px;
    background:
            radial-gradient(circle at 50% 28%, rgba(34,211,238,.06), transparent 18rem),
            var(--tsh-bg);
}
.tsh-card {
    background: rgba(255,255,255,.92);
    border: 1px solid var(--tsh-border);
    border-radius: 8px;
    box-shadow: var(--tsh-shadow);
    padding: 16px;
}
.tsh-card h2 { margin: 0 0 10px; font-size: 16px; letter-spacing: -.02em; }
.tsh-card p { color: var(--tsh-muted); line-height: 1.65; margin: 0; }
.tsh-hero-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: center;
    gap: 20px;
    background: linear-gradient(120deg, #122247 0%, #1a3269 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
    min-height: 92px;
}
.tsh-hero-card::after {
    content: '';
    position: absolute;
    inset: -60px -90px auto auto;
    width: 260px;
    height: 180px;
    border-radius: 50%;
    background: rgba(64,130,255,.18);
    transform: rotate(-18deg);
}
.tsh-hero-card h2 { font-size: 19px; color: #fff; }
.tsh-hero-card p { color: #d9e6ff; }
.tsh-hero-card .tsh-page-kicker { color: #8db8ff; }
.tsh-status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; position: relative; z-index: 1; }
.tsh-status-card {
    display: grid;
    gap: 5px;
    padding: 11px 12px;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 6px;
    color: #fff;
    text-decoration: none;
}
.tsh-status-card:hover { background: rgba(255,255,255,.14); text-decoration: none; }
.tsh-status-card span { color: #cbd7eb; font-size: 11.5px; }
.tsh-status-card strong { font-size: 13px; }
.tsh-dashboard-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.tsh-metric-card { padding: 12px; background: #fff; border: 1px solid var(--tsh-border); border-radius: 7px; box-shadow: var(--tsh-shadow); }
.tsh-metric-card span { display: block; color: var(--tsh-muted); font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .075em; }
.tsh-metric-card strong { display: block; margin-top: 6px; font-size: 24px; line-height: 1; color: #0f172a; }
.tsh-two-column { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); gap: 12px; }
.tsh-list { display: grid; gap: 7px; margin-top: 12px; }
.tsh-list-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px; border: 1px solid var(--tsh-border); background: #f8fafc; border-radius: 5px; }
.tsh-list-item strong { font-size: 12.5px; }
.tsh-list-item small { color: var(--tsh-muted); }
.tsh-badge { padding: 3px 7px; border-radius: 999px; font-weight: 800; font-size: 10px; border: 1px solid var(--tsh-border); background: #eef2f7; color: #334155; }
.tsh-badge.ok { background: #ecfdf5; border-color: #bbf7d0; color: #166534; }
.tsh-badge.warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.tsh-pill {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 0 10px;
    border-radius: 999px;
    background: #eef2f7;
    border: 1px solid var(--tsh-border);
    color: #334155;
    font-weight: 750;
    font-size: 12px;
}
.tsh-top-button,
.tsh-form button,
.tsh-link-button {
    min-height: var(--tsh-control-h);
    border: 1px solid var(--tsh-border-strong);
    background: #fff;
    border-radius: 5px;
    padding: 0 10px;
    cursor: pointer;
    font-weight: 750;
    font-size: 12.5px;
    color: #1a2b42;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-decoration: none;
}
.tsh-top-button:hover,
.tsh-link-button:hover { background: #f4f7fb; text-decoration: none; }
.tsh-top-button.danger { border-color: #f3b5ae; color: var(--tsh-danger); }
.tsh-top-button img,
.tsh-form button img { width: 14px; height: 14px; object-fit: contain; }

/* Login */
.tsh-login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.tsh-login-shell { width: min(100%, 382px); }
.tsh-login-card {
    display: grid;
    gap: 13px;
    background: rgba(255,255,255,.94);
    border: 1px solid #d9e2ee;
    border-top: 3px solid var(--tsh-primary);
    border-radius: 6px;
    box-shadow: 0 18px 38px rgba(15,23,42,.22), 0 3px 10px rgba(15,23,42,.10);
    padding: 22px 24px 24px;
    position: relative;
    overflow: hidden;
}
.tsh-login-card::after {
    content: '';
    position: absolute;
    right: -65px;
    top: -24px;
    width: 155px;
    height: 155px;
    border: 16px solid rgba(34,211,238,.08);
    border-radius: 50%;
    pointer-events: none;
}
.tsh-login-brand { display: flex; align-items: center; gap: 9px; padding-bottom: 12px; border-bottom: 1px solid #e5edf6; position: relative; z-index: 1; }
.tsh-login-brand img { width: 30px; height: 30px; border-radius: 6px; }
.tsh-login-brand strong { display:block; color: #0f172a; font-size: 13px; }
.tsh-login-brand span { display:block; color: var(--tsh-muted); font-size: 10.5px; margin-top: 1px; }
.tsh-login-copy { position: relative; z-index: 1; }
.tsh-login-copy h1 { margin: 0; font-size: 22px; letter-spacing: -.04em; }
.tsh-login-copy p { color: var(--tsh-muted); font-size: 12.5px; margin: 7px 0 0; }
.tsh-form { display: grid; gap: 10px; position: relative; z-index: 1; }
.tsh-form label { display: grid; gap: 5px; }
.tsh-form label span { font-weight: 800; font-size: 11.5px; color: #283a52; }
.tsh-form input {
    width: 100%;
    min-height: var(--tsh-control-h);
    border: 1px solid #cfd9e6;
    border-radius: 5px;
    padding: 0 10px;
    font: inherit;
    color: #0f172a;
    background: #fff;
}
.tsh-form input:focus { outline: 2px solid var(--tsh-primary-ring); border-color: var(--tsh-primary); }
.tsh-form button { background: var(--tsh-primary); border-color: var(--tsh-primary-2); color: #fff; width: 100%; }
.tsh-form button:hover { background: var(--tsh-primary-2); }
.tsh-login-note { color: var(--tsh-muted); font-size: 11.5px; line-height: 1.45; }
.tsh-link { font-size: 12px; font-weight: 700; }
.tsh-alert { padding: 9px 10px; border-radius: 5px; font-size: 12.5px; }
.tsh-alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d; }

.tsh-toast-root { position: fixed; right: 16px; bottom: 16px; z-index: 1000; display: grid; gap: 8px; }
.tsh-toast { padding: 10px 12px; border-radius: 6px; background: #0f172a; color: #fff; box-shadow: var(--tsh-shadow-lg); font-size: 12.5px; }
code { font-family: var(--tsh-mono); background: #eef2f7; border: 1px solid #dde5ee; border-radius: 3px; padding: 1px 5px; font-size: 12px; color: #1e3a5f; }

@media (max-width: 1100px) {
    .tsh-dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tsh-hero-card, .tsh-two-column { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .tsh-app-shell { grid-template-columns: 1fr; }
    .tsh-sidebar { display: none; }
    .tsh-topbar { height: auto; min-height: 54px; align-items: flex-start; flex-direction: column; padding: 12px 14px; }
    .tsh-topbar-actions { flex-wrap: wrap; }
    .tsh-dashboard-grid { grid-template-columns: 1fr; }
    .tsh-status-grid { grid-template-columns: 1fr; }
}
.mini-spinner {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255,255,255,.45);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    animation: tsh-spin .8s linear infinite;
}
@keyframes tsh-spin { to { transform: rotate(360deg); } }
