/* ========================================
   AUXILIUM PLATFORM — Notion-style legal
   ======================================== */

:root {
    --bg:         #ffffff;
    --bg-sidebar: #fbfbfa;
    --bg-hover:   #f1f1f0;
    --bg-active:  #ededec;
    --border:     #e8e8e6;
    --text:       #1a1a1a;
    --text-secondary: #6b6b6b;
    --text-muted: #9b9b9b;
    --accent:     #1a1a1a;
    --radius:     6px;
    --sidebar-w:  260px;
    --transition: 150ms ease;
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

body {
    display: flex;
    overflow: hidden;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-top {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px;
    margin-bottom: 24px;
}

.brand-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.brand-name {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: var(--text);
}

/* Nav */
.nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 8px 8px 6px;
    margin-top: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 8px;
    border: none;
    background: none;
    border-radius: var(--radius);
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    text-align: left;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.nav-item.active {
    background: var(--bg-active);
    color: var(--text);
    font-weight: 500;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active .nav-icon {
    opacity: 1;
}

.badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    background: var(--bg-hover);
    padding: 2px 6px;
    border-radius: 4px;
}

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 8px;
}

/* Sidebar bottom */
.sidebar-bottom {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.powered-by {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.powered-logo {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* ========================================
   MOBILE HEADER
   ======================================== */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    align-items: center;
    gap: 12px;
    z-index: 90;
}

.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.menu-toggle svg {
    width: 22px;
    height: 22px;
    color: var(--text);
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 15px;
}

.mobile-brand-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 99;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
.main {
    flex: 1;
    height: 100vh;
    overflow: hidden;
    position: relative;
    background: var(--bg);
}

/* ---- Welcome ---- */
.welcome {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
}

.welcome-inner {
    text-align: center;
    max-width: 640px;
}

.welcome-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    opacity: 0.15;
}

.welcome h1 {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.8px;
    color: var(--text);
    margin-bottom: 8px;
}

.welcome-sub {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 40px;
}

.welcome-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    text-align: left;
}

.welcome-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
    text-align: left;
}

.welcome-card:hover {
    border-color: #ccc;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.wc-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.wc-desc {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ---- Iframe ---- */
.iframe-wrap {
    display: none;
    flex-direction: column;
    height: 100%;
}

.iframe-wrap.active {
    display: flex;
}

.iframe-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 44px;
    min-height: 44px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-sidebar);
}

.iframe-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
}

.iframe-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background var(--transition);
}

.iframe-close:hover {
    background: var(--bg-hover);
}

.iframe-close svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

#toolFrame {
    flex: 1;
    width: 100%;
    border: none;
    background: var(--bg);
}

/* ---- Download page ---- */
.download-page {
    display: none;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
}

.download-page.active {
    display: flex;
}

.download-inner {
    text-align: center;
    max-width: 380px;
}

.download-icon {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.download-inner h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.4px;
    margin-bottom: 8px;
}

.download-inner p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 24px;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 28px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: opacity var(--transition);
}

.download-btn:hover {
    opacity: 0.85;
}

.download-btn.disabled {
    background: var(--bg-active);
    color: var(--text-muted);
    pointer-events: none;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .overlay.open {
        display: block;
    }

    .mobile-header {
        display: flex;
    }

    .main {
        padding-top: 52px;
    }

    .welcome-grid {
        grid-template-columns: 1fr;
    }

    .welcome {
        padding: 24px 20px;
    }

    .welcome h1 {
        font-size: 26px;
    }
}
