:root {
    --bg: #f4f7fb;
    --panel: #ffffff;
    --text: #162033;
    --muted: #667085;
    --line: #d9e2ef;
    --primary: #145c9e;
    --primary-dark: #0f4779;
    --danger: #b42318;
    --success-bg: #e6f4ea;
    --success-text: #146c2e;
    --warning-bg: #fff8e1;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Segoe UI, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
    background: #0f3558;
    color: #fff;
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}
.brand { color: #fff; font-weight: 700; font-size: 22px; }
.subtitle { display: block; color: #c9d8e8; margin-top: 4px; font-size: 13px; }
.topbar nav { display: flex; gap: 14px; flex-wrap: wrap; }
.topbar nav a { color: #f8fbff; font-weight: 600; }
.page { max-width: 1240px; margin: 0 auto; padding: 24px; }
.footer { max-width: 1240px; margin: 0 auto 32px; padding: 0 24px; color: var(--muted); font-size: 13px; }
.hero {
    background: linear-gradient(135deg, #ffffff, #e7f0fb);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 28px;
    margin-bottom: 20px;
}
.hero.compact { padding: 20px 24px; }
.hero h1 { margin: 0 0 8px; }
.hero p { margin: 0; color: var(--muted); }
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.card, .panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, .05);
}
.card { padding: 18px; }
.card span { color: var(--muted); display: block; font-size: 14px; }
.card strong { font-size: 34px; display: block; margin-top: 6px; }
.panel { padding: 20px; margin-bottom: 20px; overflow-x: auto; }
.panel.warning { background: var(--warning-bg); }
.panel-title { display: flex; justify-content: space-between; gap: 14px; align-items: center; }
.panel h2 { margin-top: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: #344054; font-size: 13px; background: #f8fafc; }
small { color: var(--muted); }
code { background: #eef4fb; padding: 2px 5px; border-radius: 5px; word-break: break-all; }
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: #eef4fb;
}
.badge.trial { background: #e0f2fe; color: #075985; }
.badge.pro { background: #dcfce7; color: #166534; }
.badge.expired { background: #fee2e2; color: #991b1b; }
.badge.blocked { background: #111827; color: #fff; }
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 14px;
    border: 0;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}
.button:hover { background: var(--primary-dark); text-decoration: none; }
.button.secondary { background: #e6eef7; color: var(--primary-dark); }
.button.danger { background: var(--danger); }
.toolbar, .form-grid {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 18px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}
input, select, textarea {
    width: 100%;
    min-height: 38px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 8px 10px;
    font: inherit;
}
.toolbar input { min-width: 320px; flex: 1; }
.toolbar select { width: 180px; }
.grid.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 20px; }
.details { display: grid; grid-template-columns: 160px 1fr; gap: 10px 14px; }
.details dt { color: var(--muted); font-weight: 600; }
.details dd { margin: 0; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.form-card { display: grid; gap: 10px; padding: 14px; border: 1px dashed var(--line); border-radius: 14px; margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: end; }
.form-grid label { display: grid; gap: 6px; color: var(--muted); font-weight: 600; }
.form-grid .wide { grid-column: 1 / -1; }
.checkbox { display: flex !important; flex-direction: row; align-items: center; gap: 8px !important; }
.checkbox input { width: auto; min-height: auto; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { min-width: 260px; }
.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-weight: 600; }
.alert.success { background: var(--success-bg); color: var(--success-text); }
.alert.error { background: #fee2e2; color: #991b1b; }
@media (max-width: 720px) {
    .page { padding: 16px; }
    .topbar { padding: 14px 18px; }
    .details { grid-template-columns: 1fr; }
    .toolbar input { min-width: 100%; }
}

.logout-form { display: inline; margin: 0; }
.logout-form button {
    border: 0;
    background: transparent;
    color: #f8fbff;
    font-weight: 600;
    cursor: pointer;
    font: inherit;
    padding: 0;
}
.logout-form button:hover { text-decoration: underline; }
.login-shell { display: grid; place-items: center; min-height: 60vh; }
.login-card {
    width: min(100%, 440px);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, .08);
    padding: 28px;
}
.login-card h1 { margin-top: 0; }
.login-card p { color: var(--muted); }
.login-form { display: grid; gap: 14px; }
.login-form label { display: grid; gap: 6px; color: var(--muted); font-weight: 600; }
