/* AgentElite internal-tools shell - consumes the design tokens in /assets/ae/tokens.css.
   Requires data-ae-theme="light|dark" on <body> (set by ae-shell.js before paint). */

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

html, body { height: 100%; }

/* Early-paint background (before body vars resolve) to avoid a theme flash. */
html[data-ae-theme="light"] { background: #F6F9FC; color-scheme: light; }
html[data-ae-theme="dark"]  { background: #15171B; color-scheme: dark; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--ae-font-body);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background var(--ae-duration) var(--ae-ease), color var(--ae-duration) var(--ae-ease);
}

h1, h2, h3, h4 { font-family: var(--ae-font-heading); font-weight: 600; margin: 0; color: var(--ink); }

a { color: var(--ae-action); text-decoration: none; }

.ae-mono { font-family: var(--ae-font-mono); }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.ae-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--ae-font-body); font-size: 14px; font-weight: 600;
    padding: 10px 16px; border-radius: var(--ae-radius-input);
    border: 1px solid transparent; cursor: pointer; text-decoration: none;
    transition: background var(--ae-duration) var(--ae-ease),
                border-color var(--ae-duration) var(--ae-ease),
                color var(--ae-duration) var(--ae-ease),
                transform var(--ae-duration) var(--ae-ease);
}
.ae-btn:focus-visible { outline: none; box-shadow: var(--ae-focus-ring); }
.ae-btn-primary { background: var(--ae-action); color: #fff; }
.ae-btn-primary:hover { background: #1f7fe0; }
.ae-btn-ghost { background: var(--surface2); color: var(--ink); border-color: var(--border); }
.ae-btn-ghost:hover { border-color: var(--ae-action); color: var(--ae-action); }
.ae-btn-google { background: #fff; color: #2b2b2e; border-color: #dfe3e8; }
.ae-btn-google:hover { background: #f6f8fa; border-color: #c9cfd6; }
.ae-btn-block { width: 100%; }

/* ── Cards ───────────────────────────────────────────────────────────── */
.ae-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--ae-radius-card); padding: var(--ae-card-padding);
    box-shadow: var(--shadow);
}

/* ── App shell: sidebar rail + content ───────────────────────────────── */
.ae-app { display: flex; min-height: 100vh; }

.ae-sidebar {
    position: sticky; top: 0; align-self: flex-start;
    height: 100vh; flex-shrink: 0;
    width: var(--ae-sidebar-width);
    background: var(--ae-rail-gradient); color: var(--ae-rail-text);
    display: flex; flex-direction: column;
    transition: width var(--ae-duration) var(--ae-ease);
    overflow: hidden;
}
.ae-sidebar.is-collapsed { width: var(--ae-sidebar-width-collapsed); }

.ae-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 18px; white-space: nowrap;
}
.ae-brand img { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; }
.ae-brand-text { font-family: var(--ae-font-heading); font-weight: 700; font-size: 16px; color: #fff; }
.ae-sidebar.is-collapsed .ae-brand { padding: 20px 0; justify-content: center; }
.ae-sidebar.is-collapsed .ae-brand-text { display: none; }

.ae-nav { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; flex: 1; }
.ae-nav-item {
    display: flex; align-items: center; gap: 12px; position: relative;
    padding: 10px 12px; border-radius: 10px; color: var(--ae-rail-text);
    white-space: nowrap; transition: background var(--ae-duration) var(--ae-ease), color var(--ae-duration) var(--ae-ease);
}
.ae-nav-item:hover { background: var(--ae-rail-item-hover); color: #fff; }
.ae-nav-item.is-active { background: var(--ae-rail-item-active); color: var(--ae-rail-text-active); }
.ae-nav-item.is-active::before {
    content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
    background: var(--ae-rail-accent); border-radius: 0 3px 3px 0;
}
.ae-nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.ae-nav-label { font-size: 13.5px; font-weight: 500; }
.ae-sidebar.is-collapsed .ae-nav-item { justify-content: center; padding: 10px 0; }
.ae-sidebar.is-collapsed .ae-nav-label { display: none; }

.ae-sidebar-foot { padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid rgba(255,255,255,.12); }

/* Signed-in user, shown by the sign-out button */
.ae-user { display: flex; align-items: center; gap: 10px; padding: 8px 12px 12px; white-space: nowrap; }
.ae-user-avatar {
    width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: var(--ae-rail-accent); color: #0B2A3C;
    font-family: var(--ae-font-heading); font-weight: 700; font-size: 12px;
}
.ae-user-meta { min-width: 0; }
.ae-user-name { color: var(--ae-rail-text-active); font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.ae-user-sub { color: var(--ae-rail-text); font-size: 11px; }
.ae-sidebar.is-collapsed .ae-user { justify-content: center; padding: 8px 0 12px; }
.ae-sidebar.is-collapsed .ae-user-meta { display: none; }
.ae-rail-btn {
    display: flex; align-items: center; gap: 12px; width: 100%; white-space: nowrap;
    background: transparent; border: none; cursor: pointer; color: var(--ae-rail-text);
    padding: 10px 12px; border-radius: 10px; font: inherit; font-size: 13.5px;
    transition: background var(--ae-duration) var(--ae-ease), color var(--ae-duration) var(--ae-ease);
}
.ae-rail-btn:hover { background: var(--ae-rail-item-hover); color: #fff; }
.ae-rail-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.ae-sidebar.is-collapsed .ae-rail-btn { justify-content: center; padding: 10px 0; }
.ae-sidebar.is-collapsed .ae-rail-btn span { display: none; }

/* ── Content ─────────────────────────────────────────────────────────── */
.ae-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ae-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 22px 32px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.ae-topbar .ae-page-title { font-family: var(--ae-font-heading); font-size: 20px; font-weight: 700; }
.ae-topbar .ae-page-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.ae-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
    background: var(--surface2); border: 1px solid var(--border); color: var(--muted);
    transition: color var(--ae-duration) var(--ae-ease), border-color var(--ae-duration) var(--ae-ease);
}
.ae-icon-btn:hover { color: var(--ae-action); border-color: var(--ae-action); }
.ae-icon-btn svg { width: 18px; height: 18px; }
.ae-main { padding: 32px; }

/* ── Tool-card grid (hub) ────────────────────────────────────────────── */
.ae-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ae-grid-gap); max-width: 860px; }
@media (max-width: 720px) { .ae-grid { grid-template-columns: 1fr; } }
.ae-tool {
    display: flex; gap: 16px; align-items: flex-start; text-decoration: none; color: inherit;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--ae-radius-card); padding: var(--ae-card-padding); box-shadow: var(--shadow);
    transition: transform var(--ae-duration) var(--ae-ease), border-color var(--ae-duration) var(--ae-ease), box-shadow var(--ae-duration) var(--ae-ease);
}
.ae-tool:hover { transform: translateY(-2px); border-color: var(--ae-action); }
.ae-tool-icon {
    width: 44px; height: 44px; flex-shrink: 0; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(45,143,240,.10); color: var(--ae-action);
}
.ae-tool-icon svg { width: 22px; height: 22px; }
.ae-tool h3 { font-size: 16px; margin-bottom: 4px; }
.ae-tool p { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.ae-tool .ae-route { font-family: var(--ae-font-mono); font-size: 12px; color: var(--faint); }

/* ── Centered card screens (login / signed-out) ─────────────────────── */
.ae-center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.ae-center.on-brand { background: var(--ae-login-backdrop, linear-gradient(150deg,#0B2A3C 0%,#0E5E86 70%,#11A7E0 130%)); }
.ae-authcard {
    width: 100%; max-width: 400px; text-align: center;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--ae-radius-card-lg); padding: 40px 32px; box-shadow: var(--shadow);
}
.ae-authcard .ae-logo { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 18px; display: block; }
.ae-authcard h1 { font-size: 20px; margin-bottom: 6px; }
.ae-authcard .ae-sub { color: var(--muted); font-size: 14px; margin: 0 0 26px; }
.ae-authcard .ae-note { margin-top: 22px; font-size: 12.5px; color: var(--faint); line-height: 1.5; }
.ae-badge {
    width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 16px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(229,72,77,.12); color: var(--ae-danger);
}
.ae-badge svg { width: 26px; height: 26px; }
.ae-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
