:root {
    --primary: #1a365d;
    --primary-light: #2c5282;
    --accent: #c53030;
    --accent-light: #e53e3e;
    --bg: #f7fafc;
    --bg-dark: #edf2f7;
    --text: #2d3748;
    --text-light: #718096;
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
    --sidebar-width: 260px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body.app-body {
    font-family: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    min-height: 100vh;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
}

.app-sidebar-brand {
    padding: 1.5rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.app-sidebar-brand a {
    font-family: 'Playfair Display', serif;
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--white);
    text-decoration: none;
}

.app-sidebar-brand .z { color: var(--accent-light); }

.app-sidebar-user {
    padding: 1rem 1.25rem;
    font-size: .8rem;
    opacity: .75;
    border-bottom: 1px solid rgba(255,255,255,.1);
    word-break: break-all;
}

.app-sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    list-style: none;
}

.app-sidebar-nav a {
    display: block;
    padding: .75rem 1.25rem;
    color: rgba(255,255,255,.85);
    text-decoration: none;
    font-weight: 500;
    font-size: .95rem;
    border-left: 3px solid transparent;
    transition: all .2s;
}

.app-sidebar-nav a:hover {
    background: rgba(255,255,255,.08);
    color: var(--white);
}

.app-sidebar-section {
    padding: .5rem 1.25rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.45);
    font-weight: 700;
}

.app-sidebar-back {
    font-size: .8rem !important;
    opacity: .85;
}

.app-sidebar-back:hover { opacity: 1; }

.app-sidebar-nav a.active {
    background: rgba(255,255,255,.12);
    border-left-color: var(--accent-light);
    color: var(--white);
}

.app-sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.1);
}

.app-sidebar-footer a,
.app-sidebar-footer button {
    display: block;
    width: 100%;
    padding: .6rem 1rem;
    background: transparent;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: 6px;
    color: var(--white);
    font-family: inherit;
    font-size: .85rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all .2s;
}

.app-sidebar-footer a:hover,
.app-sidebar-footer button:hover {
    background: rgba(255,255,255,.1);
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.app-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: none;
}

.app-content {
    padding: 2.5rem 2rem;
    max-width: 1100px;
}

.app-content h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.75rem;
    color: var(--primary);
    margin-bottom: .5rem;
}

.app-content .subtitle {
    color: var(--text-light);
    margin-bottom: 2rem;
}

.app-placeholder {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-light);
}

.app-placeholder svg {
    width: 48px;
    height: 48px;
    stroke: var(--text-light);
    fill: none;
    stroke-width: 1.5;
    margin-bottom: 1rem;
    opacity: .5;
}

/* Intranet hub */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.hub-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s, border-color .2s;
}

.hub-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-light);
    box-shadow: 0 12px 28px rgba(44,82,130,.18);
}

.hub-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: rgba(44,82,130,.08);
    margin-bottom: 1.25rem;
}

.hub-card-icon svg {
    width: 28px;
    height: 28px;
    stroke: var(--primary);
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hub-card h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: var(--primary);
    margin-bottom: .5rem;
}

.hub-card p {
    color: var(--text-light);
    font-size: .92rem;
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.hub-card-go {
    margin-top: auto;
    font-weight: 600;
    font-size: .9rem;
    color: var(--accent);
}

/* Login page */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.login-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: .75rem 2rem;
}

.login-header a {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.login-header .z { color: var(--accent); }

.login-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow);
}

.login-card h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--primary);
    margin-bottom: .5rem;
    text-align: center;
}

.login-card .login-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: .9rem;
    margin-bottom: 2rem;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form label {
    display: block;
    font-weight: 600;
    font-size: .85rem;
    margin-bottom: .4rem;
    color: var(--text);
}

.login-form input {
    width: 100%;
    padding: .75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color .2s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(44,82,130,.15);
}

.login-error {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    color: #c53030;
    padding: .75rem 1rem;
    border-radius: 6px;
    font-size: .875rem;
    margin-bottom: 1rem;
    display: none;
}

.login-error.visible { display: block; }

.btn-login {
    width: 100%;
    padding: .875rem;
    background: var(--accent);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}

.btn-login:hover { background: var(--accent-light); }
.btn-login:disabled { opacity: .6; cursor: not-allowed; }

.auth-link a {
    display: flex;
    align-items: center;
    padding: .35rem;
    border-radius: 6px;
}

.auth-link a::after { display: none; }

.auth-link svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (max-width: 768px) {
    .app-sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }

    .app-layout { flex-direction: column; }

    .app-main {
        margin-left: 0;
    }

    .app-sidebar-nav {
        display: flex;
        padding: 0;
    }

    .app-sidebar-nav li { flex: 1; }

    .app-sidebar-nav a {
        text-align: center;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: .875rem .5rem;
        font-size: .85rem;
    }

    .app-sidebar-nav a.active {
        border-left: none;
        border-bottom-color: var(--accent-light);
    }

    .app-sidebar-user,
    .app-sidebar-section,
    .app-sidebar-footer { display: none; }

    .app-sidebar-nav li { flex: 1; }

    .app-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .app-header .logout-btn {
        padding: .4rem .75rem;
        background: transparent;
        border: 1px solid var(--border);
        border-radius: 4px;
        font-family: inherit;
        font-size: .8rem;
        cursor: pointer;
        color: var(--text);
    }
}
