:root {
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-dark: #0f172a;
    --color-sidebar: #1e293b;
    --color-sidebar-hover: #334155;
    --color-bg: #f1f5f9;
    --color-card: #ffffff;
    --color-border: #e2e8f0;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --sidebar-width: 250px;
    --header-height: 72px;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    font-size: 16px;
    line-height: 1.6;
}

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

h1 { font-size: 1.9rem; }
h2 { font-size: 1.2rem; margin-bottom: 0.75rem; }

/* ---------- Logo ---------- */

.logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--color-dark);
    letter-spacing: -0.02em;
}

.logo span {
    color: var(--color-primary);
}

.logo-invert {
    color: #f8fafc;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-block;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    text-align: center;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    color: #fff;
}

.btn-outline {
    border-color: var(--color-border);
    color: var(--color-text);
    background: transparent;
}

.btn-outline:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-ghost {
    color: var(--color-text-muted);
    background: transparent;
}

.btn-ghost:hover {
    color: var(--color-text);
}

.btn-lg {
    padding: 0.8rem 1.6rem;
    font-size: 1.05rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ---------- Guest layout ---------- */

.guest {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--color-card);
}

.guest-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--color-border);
    background: #fff;
}

.guest-nav {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.guest-content {
    flex: 1;
}

.guest-footer {
    padding: 1.25rem 2rem;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

/* ---------- Hero / features ---------- */

.hero {
    max-width: 780px;
    margin: 0 auto;
    padding: 5rem 1.5rem 3rem;
    text-align: center;
}

.hero h1 {
    font-size: 2.6rem;
    margin-bottom: 1rem;
}

.lead {
    font-size: 1.15rem;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

.hero-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    max-width: 980px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
}

.feature-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.feature-icon {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

.feature-card h3 {
    margin-bottom: 0.35rem;
}

.feature-card p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

/* ---------- Auth ---------- */

.auth-card {
    max-width: 440px;
    margin: 3.5rem auto;
    padding: 2.25rem;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.auth-card h1 {
    font-size: 1.4rem;
    margin-bottom: 1.25rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.form-group input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: #fff;
    color: var(--color-text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin: 0 0 1.25rem;
}

.auth-card .btn {
    margin-top: 0.25rem;
}

.auth-alt {
    margin-top: 1.25rem;
    font-size: 0.9rem;
    text-align: center;
    color: var(--color-text-muted);
}

.alert {
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert ul {
    list-style: none;
}

/* ---------- App layout (ЛК) ---------- */

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

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--color-sidebar);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 0.9rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar .logo {
    padding: 0 0.6rem 1.25rem;
    border-bottom: 1px solid var(--color-sidebar-hover);
    margin-bottom: 1rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    color: #cbd5e1;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav a:hover {
    background: var(--color-sidebar-hover);
    color: #fff;
}

.sidebar-nav a.active {
    background: var(--color-primary);
    color: #fff;
}

.nav-icon {
    width: 1.2em;
    text-align: center;
}

.sidebar-footer {
    border-top: 1px solid var(--color-sidebar-hover);
    padding-top: 0.9rem;
}

.sidebar-footer .btn-ghost {
    color: #94a3b8;
}

.sidebar-footer .btn-ghost:hover {
    color: #fff;
}

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-header {
    height: var(--header-height);
    background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    text-transform: uppercase;
}

.user-name {
    font-weight: 600;
    line-height: 1.3;
}

.user-email {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    line-height: 1.3;
}

.app-content {
    padding: 2rem;
    flex: 1;
}

/* ---------- Content blocks ---------- */

.page-head {
    margin-bottom: 1.5rem;
}

.page-head h1 {
    font-size: 1.6rem;
}

.page-head p {
    color: var(--color-text-muted);
}

.card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.25rem;
}

.card-muted p {
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

.card .muted {
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

/* ---------- Brandside iframe ---------- */

.iframe-wrap {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.brandside-frame {
    display: block;
    width: 100%;
    height: calc(100vh - var(--header-height));
    min-height: 480px;
    border: 0;
    background: #fff;
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    margin-bottom: 1.25rem;
}

.profile {
    display: grid;
    gap: 0;
}

.profile-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--color-border);
}

.profile-row:last-child {
    border-bottom: none;
}

.profile-row dt {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.profile-row dd {
    font-weight: 500;
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        padding: 0.9rem 1rem;
    }

    .sidebar .logo {
        padding: 0 0.6rem 0.6rem;
        display: inline-block;
    }

    .sidebar-nav {
        flex-direction: row;
    }

    .app-header {
        padding: 0 1rem;
    }

    .app-content {
        padding: 1.25rem;
    }

    .guest-header,
    .guest-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
