:root {
    --graphite: #242238;
    --graphite-deep: #191824;
    --violet: #5c5aa7;
    --violet-dark: #46447f;
    --periwinkle: #7887dc;
    --accent: #4b91d4;
    --accent-dark: #5753ae;
    --ink: #252432;
    --muted: #737184;
    --line: #e7e4ea;
    --bg: #f8f7fa;
    --paper: #fffefd;
    --green: #26966d;
    --shadow: 0 24px 70px rgba(76, 69, 102, .11);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Inter, "Segoe UI", Arial, sans-serif; color: var(--ink); }
button, input, select { font: inherit; }
button, a { transition: .2s ease; }

.brand-lockup { display: flex; align-items: center; text-decoration: none; }
.brand-lockup img { display: block; }
.brand-lockup strong, .brand-lockup small { display: block; }

/* Login */
.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #f8f5f1, #f0eff8);
    display: grid;
    place-items: center;
    padding: 24px;
    overflow: hidden;
}

.login-shell {
    width: min(1180px, 100%);
    height: min(760px, calc(100dvh - 48px));
    min-height: 600px;
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    overflow: hidden;
    background: var(--paper);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.login-panel { min-width: 0; background: var(--paper); padding: clamp(32px, 4vw, 58px); }
.login-panel-inner { min-height: 100%; display: flex; flex-direction: column; }
.brand-lockup-dark { gap: 13px; color: var(--graphite); font-size: 22px; font-weight: 750; letter-spacing: -.035em; }
.brand-lockup-dark img { display: block; width: 40px; height: 40px; max-width: 40px; flex: 0 0 40px; }
.login-form-wrap { width: min(410px, 100%); margin: auto 0; padding: 24px 0; }
.eyebrow { color: var(--accent-dark); font-size: 11px; letter-spacing: .18em; font-weight: 800; text-transform: uppercase; }
.login-form-wrap h1 { margin: 12px 0 9px; font-size: clamp(34px, 3.2vw, 46px); line-height: 1.06; letter-spacing: -.045em; }
.muted, .login-help { color: var(--muted); }
.login-form-wrap > .muted { margin: 0 0 24px; font-size: 15px; }
.login-form-wrap label { display: block; margin: 15px 0 7px; font-size: 13px; font-weight: 700; }
input, select { width: 100%; height: 50px; padding: 0 16px; border: 1px solid #d8d4de; border-radius: 12px; outline: 0; background: #fff; color: var(--ink); }
input:hover, select:hover { border-color: #bcb7c6; }
input:focus, select:focus { border-color: var(--violet); box-shadow: 0 0 0 4px rgba(92, 90, 167, .12); }
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 88px; }
.show-password { position: absolute; right: 8px; top: 9px; height: 36px; border: 0; background: transparent; color: var(--violet); font-size: 12px; font-weight: 700; cursor: pointer; }
.login-options { display: flex; align-items: center; justify-content: space-between; margin: 16px 0; color: #9691a1; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.login-options .check { margin: 0; color: var(--ink); font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 500; }
.check { display: flex !important; align-items: center; gap: 9px; }
.check input { width: 18px; height: 18px; accent-color: var(--violet); }
.primary, .secondary { border: 0; border-radius: 11px; padding: 14px 20px; font-weight: 750; cursor: pointer; }
.primary { color: #fff; background: linear-gradient(135deg, var(--accent), var(--violet)); box-shadow: 0 8px 24px rgba(75, 105, 190, .2); }
.primary:hover { background: linear-gradient(135deg, #3684cb, var(--violet-dark)); transform: translateY(-1px); }
.primary:disabled { opacity: .5; }
.wide { width: 100%; display: flex; justify-content: space-between; }
.login-help { margin-top: 20px; text-align: center; font-size: 12px; }
.login-footer { color: #9a96a0; font-size: 11px; letter-spacing: .02em; }

.login-visual { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #f7f3ee; }
.login-visual > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 47%; }
.login-visual-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(250,247,243,0) 42%, rgba(250,247,243,.94) 82%, #faf7f3 100%); }
.visual-copy { position: absolute; z-index: 1; left: clamp(34px, 4vw, 58px); right: clamp(34px, 4vw, 58px); bottom: clamp(36px, 4vw, 58px); max-width: 560px; color: var(--graphite); }
.visual-copy .eyebrow { color: var(--accent-dark); }
.visual-copy h2 { margin: 12px 0 13px; font-size: clamp(40px, 4vw, 58px); line-height: .98; letter-spacing: -.05em; }
.visual-copy p { max-width: 520px; margin: 0; color: #666174; font-size: 15px; line-height: 1.55; }

.alert { padding: 13px 16px; border-radius: 10px; margin: 20px 0; font-size: 14px; }
.alert.error { background: #fff0ed; color: #a84435; }
.alert.success { background: #e9f8f1; color: #147a54; }

/* Administration */
.admin-body { min-height: 100vh; background: var(--bg); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 5; display: flex; flex-direction: column; color: var(--graphite); background: #f1eff7; border-right: 1px solid #e1deea; }
.sidebar-brand { height: 96px; gap: 13px; padding: 24px 26px; color: var(--graphite); border-bottom: 1px solid #e1deea; }
.sidebar-brand img { width: 42px; height: 42px; padding: 6px; border-radius: 50%; background: #fff; box-shadow: 0 5px 16px rgba(77,74,145,.12); }
.sidebar-brand strong { font-size: 18px; letter-spacing: -.025em; }
.sidebar-brand small { margin-top: 3px; color: #7c7890; font-size: 11px; }
.sidebar nav { flex: 1; padding: 26px 16px; }
.nav-caption { display: block; margin: 14px 14px 8px; color: #9893aa; font-size: 9px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; }
.sidebar nav a { display: flex; align-items: center; gap: 13px; margin: 4px 0; padding: 13px 14px; color: #625f70; text-decoration: none; border-radius: 12px; }
.sidebar nav a:hover { color: var(--graphite); background: rgba(255,255,255,.7); }
.sidebar nav a.active { color: var(--graphite); background: #fff; box-shadow: inset 3px 0 var(--accent), 0 5px 18px rgba(73,66,97,.08); }
.nav-icon { width: 22px; color: var(--violet); text-align: center; font-size: 19px; }
.sidebar nav a.active .nav-icon { color: var(--accent-dark); }
.sidebar-user { display: flex; align-items: center; gap: 11px; padding: 20px; border-top: 1px solid #e1deea; background: #ebe8f3; }
.sidebar-user > div:nth-child(2) { min-width: 0; flex: 1; }
.sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-user small { margin-top: 3px; color: #7f7a91; font-size: 12px; }
.sidebar-user form button { border: 0; background: none; color: var(--violet); cursor: pointer; }
.avatar, .mini-avatar { display: grid; place-items: center; border-radius: 50%; background: linear-gradient(145deg, var(--accent), var(--violet)); color: #fff; font-weight: 750; }
.avatar { width: 42px; height: 42px; flex: 0 0 auto; }
.avatar.large { width: 74px; height: 74px; font-size: 23px; }
.admin-shell { min-height: 100vh; padding-left: 280px; }
.topbar { position: sticky; top: 0; z-index: 4; height: 76px; display: flex; align-items: center; justify-content: space-between; padding: 0 38px; background: rgba(255,254,253,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.breadcrumb { color: var(--muted); font-size: 13px; }
.breadcrumb strong { color: var(--graphite); }
.breadcrumb span { margin: 0 10px; color: var(--accent); }
.top-actions { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.mini-avatar { width: 36px; height: 36px; margin-left: 14px; text-decoration: none; font-size: 11px; }
.admin-content { max-width: 1380px; margin: auto; padding: 46px; }
.page-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 30px; }
.page-head h1 { margin: 9px 0; font-size: 38px; letter-spacing: -.035em; }
.page-head p, .panel p { margin: 0; color: var(--muted); }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 17px; margin-bottom: 24px; }
.stat-row div { padding: 21px; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; }
.stat-row span, .stat-row strong { display: block; }
.stat-row span { color: var(--muted); font-size: 13px; }
.stat-row strong { margin-top: 8px; font-size: 28px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 6px 24px rgba(39, 35, 49, .04); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 28px; border-bottom: 1px solid var(--line); }
.panel h2 { margin: 0 0 6px; }
.search { width: 260px; height: 42px; }
.plugin-item { display: flex; align-items: center; gap: 18px; padding: 22px 28px; border-bottom: 1px solid var(--line); }
.plugin-item:last-child { border-bottom: 0; }
.plugin-symbol { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 14px; color: var(--violet); font-weight: 750; background: #f0eff9; }
.plugin-info { flex: 1; }
.plugin-info h3 { margin: 0 0 5px; }
.plugin-info p { margin-bottom: 6px; font-size: 14px; }
.plugin-info small { color: #9994a2; }
.badge, .state { padding: 5px 8px; border-radius: 99px; font-size: 10px; font-weight: 750; letter-spacing: .08em; }
.badge { color: var(--violet-dark); background: #efedf9; vertical-align: middle; }
.state { color: #706d78; background: #f0eef1; }
.state.on { color: var(--green); background: #e9f8f1; }
.secondary { color: #514e5c; background: #fff; border: 1px solid #d7d3dc; }
.secondary:hover { border-color: var(--violet); color: var(--violet); }
.form-panel { max-width: 800px; }
.profile-header { display: flex; align-items: center; gap: 18px; padding: 28px; border-bottom: 1px solid var(--line); }
.profile-header h2, .profile-header p { margin: 0; }
.admin-form { padding: 6px 28px 28px; }
.admin-form label { display: block; max-width: 620px; margin: 24px 0 8px; font-size: 14px; font-weight: 650; }
.form-actions { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.mobile-menu { display: none; border: 0; background: none; font-size: 22px; }
.admin-form input:disabled { color: #8a8692; background: #f2f0f2; }

@media (min-width: 851px) and (max-height: 680px) {
    .login-body { padding: 14px; }
    .login-shell { height: calc(100dvh - 28px); min-height: 540px; }
    .login-panel { padding-top: 26px; padding-bottom: 26px; }
    .login-form-wrap { padding: 14px 0; }
    .login-form-wrap h1 { font-size: 34px; }
    .login-form-wrap > .muted { margin-bottom: 16px; }
    .login-form-wrap label { margin-top: 10px; }
    .login-help { margin-top: 12px; }
    .visual-copy h2 { font-size: 40px; }
}

@media (max-width: 850px) {
    .login-body { padding: 0; }
    .login-shell { width: 100%; height: auto; min-height: 100vh; grid-template-columns: 1fr; border-radius: 0; }
    .login-visual { display: none; }
    .login-panel { min-height: 100vh; padding: 34px; }
    .login-panel-inner { min-height: calc(100vh - 68px); }
    .login-form-wrap { margin: auto; }
}

@media (max-width: 800px) {
    .sidebar { transform: translateX(-100%); transition: .2s; }
    .menu-open .sidebar { transform: translateX(0); }
    .admin-shell { padding-left: 0; }
    .mobile-menu { display: block; }
    .topbar { padding: 0 18px; }
    .breadcrumb { display: none; }
    .admin-content { padding: 28px 18px; }
    .page-head { align-items: start; }
    .page-head .primary { display: none; }
    .stat-row { grid-template-columns: 1fr; }
    .panel-head { align-items: start; flex-direction: column; }
    .search { width: 100%; }
    .plugin-item { align-items: flex-start; flex-wrap: wrap; }
    .plugin-info { min-width: calc(100% - 70px); }
    .state { margin-left: 68px; }
}

@media (max-width: 480px) {
    .login-panel { padding: 25px; }
    .login-form-wrap { padding: 38px 0; }
    .login-options > span { display: none; }
}
