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

:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --panel-soft: #eef2f6;
    --ink: #16202a;
    --muted: #657282;
    --line: #d8dee6;
    --blue: #2563eb;
    --green: #16805b;
    --amber: #b86b00;
    --red: #b42318;
    --shadow: 0 18px 45px rgba(24, 32, 42, 0.08);
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    letter-spacing: 0;
}

button,
input,
select,
textarea {
    font: inherit;
}

.shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
    background: #111827;
    color: #e5e7eb;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 2px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: linear-gradient(135deg, #2563eb, #16a34a);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
}

.brand strong {
    display: block;
    font-size: 16px;
}

.brand span {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: #9ca3af;
}

.nav {
    display: grid;
    gap: 6px;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
}

.nav a.active,
.nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-icon {
    width: 20px;
    height: 20px;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(203, 213, 225, 0.55);
    border-radius: 6px;
    color: #e5e7eb;
    font-size: 12px;
    line-height: 1;
    flex: 0 0 auto;
}

main {
    min-width: 0;
    padding: 24px;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

h1 {
    margin: 0 0 6px;
    font-size: 26px;
    line-height: 1.2;
}

.lead {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 8px;
    padding: 10px 13px;
    cursor: pointer;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    font-size: 14px;
}

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

.btn.danger {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.btn.sm {
    padding: 5px 10px;
    min-height: 0;
    font-size: 12px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.panel-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.status-bar {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    display: none;
}

.status-bar.info {
    background: #eff6ff;
    color: #1d4ed8;
    display: block;
}

.status-bar.ok {
    background: #e7f7ef;
    color: var(--green);
    display: block;
}

.status-bar.error {
    background: #fff1f2;
    color: var(--red);
    display: block;
}

@media (max-width: 900px) {
    .shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        min-height: auto;
    }
}

@media (max-width: 620px) {
    main {
        padding: 16px;
    }

    .topbar,
    .panel-title {
        display: grid;
        justify-content: stretch;
    }

    .actions,
    .btn {
        width: 100%;
    }
}

.nav a.nav-account-start {
    margin-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 0 8px 8px;
    padding-top: 14px;
}
