:root {
    --ink: #181818;
    --muted: #687582;
    --line: #dce5ee;
    --panel: #ffffff;
    --canvas: #f4f7fa;
    --brand: #109ede;
    --brand-dark: #087bb0;
    --danger: #c63c3c;
    --success: #117a4b;
}

* { box-sizing: border-box; }
html { font-family: Inter, "Segoe UI", Arial, sans-serif; color: var(--ink); background: var(--canvas); }
body { margin: 0; min-height: 100vh; font-size: 15px; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
.sidebar { background: var(--ink); color: white; padding: 30px 22px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 11px; font-size: 21px; font-weight: 800; letter-spacing: .02em; margin-bottom: 44px; }
.brand-mark { width: 17px; height: 17px; background: var(--brand); border-radius: 50%; box-shadow: 9px 0 0 rgba(16,158,222,.45); }
.brand small { display: block; color: #a9b4bf; font-size: 10px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; margin-top: 3px; }
.nav { display: grid; gap: 8px; }
.nav a { text-decoration: none; color: #bfc8d0; border-radius: 9px; padding: 12px 14px; font-weight: 650; }
.nav a:hover, .nav a.active { background: #2b2b2b; color: white; }
.sidebar-footer { margin-top: auto; }
.logout { border: 0; background: transparent; color: #a9b4bf; cursor: pointer; padding: 12px 14px; }
.content { padding: 42px clamp(24px, 5vw, 72px) 80px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 28px; }
h1 { font-size: clamp(30px, 4vw, 48px); line-height: 1.02; margin: 0 0 8px; letter-spacing: -.035em; }
h2 { font-size: 24px; margin: 0 0 20px; letter-spacing: -.02em; }
.lead, .muted { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; box-shadow: 0 6px 24px rgba(24,24,24,.04); }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: grid; gap: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 9px; padding: 11px 16px; text-decoration: none; cursor: pointer; font-weight: 700; background: white; color: var(--ink); }
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { border-color: var(--line); }
.btn-danger { border-color: #f0caca; color: var(--danger); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: white; }
.btn-danger-solid:hover { background: #a82f2f; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.field { display: grid; gap: 7px; }
.field label, .label { font-weight: 750; }
.field input:not([type="checkbox"]):not([type="radio"]), .field textarea, .field select { width: 100%; border: 1px solid #cbd6df; background: white; border-radius: 9px; padding: 11px 12px; color: var(--ink); }
.field textarea { min-height: 110px; resize: vertical; }
.field input:not([type="checkbox"]):not([type="radio"]):focus, .field textarea:focus, .field select:focus { outline: 3px solid rgba(16,158,222,.16); border-color: var(--brand); }
.hint { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
.status { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 800; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-on { color: var(--success); background: #e8f7ef; }
.status-off { color: #7b858e; background: #eef1f4; }
.alert { border-radius: 10px; padding: 14px 16px; margin-bottom: 20px; }
.alert-success { background: #e8f7ef; color: var(--success); border: 1px solid #bfe7d2; }
.alert-error { background: #fff0f0; color: #972d2d; border: 1px solid #f0caca; }
.credentials { background: #eef8fd; border: 2px solid var(--brand); }
.credentials-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 34px; }
.credential-item { display: grid; align-content: start; gap: 8px; min-width: 0; }
.credential-item-wide { grid-column: 1 / -1; }
.copy-field { display: flex; align-items: stretch; min-width: 0; }
.copy-field .code { display: flex; align-items: center; min-width: 0; border-radius: 7px 0 0 7px; padding: 9px 11px; }
.copy-button { flex: 0 0 auto; border: 0; border-radius: 0 7px 7px 0; padding: 8px 12px; background: var(--ink); color: white; cursor: pointer; font-size: 13px; font-weight: 750; }
.copy-button:hover { background: #343434; }
.copy-button.is-copied { background: var(--success); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #eef2f5; border-radius: 6px; padding: 3px 6px; word-break: break-all; }
.checkboxes { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; max-height: 260px; overflow: auto; }
.checkbox { display: flex; align-items: flex-start; gap: 9px; }
.checkbox input { flex: 0 0 auto; margin-top: 3px; }
.empty { padding: 54px 20px; text-align: center; color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.metric { position: relative; overflow: hidden; }
.metric::after { content: ""; position: absolute; width: 90px; height: 90px; border-radius: 50%; background: rgba(16,158,222,.1); right: -30px; top: -35px; }
.metric-label { color: var(--muted); font-size: 13px; font-weight: 750; }
.metric-value { display: block; font-size: 38px; line-height: 1; font-weight: 850; margin: 14px 0 8px; letter-spacing: -.04em; }
.section-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 16px; }
.section-heading h2 { margin: 0; }
.icon-btn { width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: white; cursor: pointer; font-size: 20px; }
.modal { width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 40px); border: 0; border-radius: 16px; padding: 0; color: var(--ink); box-shadow: 0 24px 90px rgba(24,24,24,.28); }
.modal-wide { width: min(920px, calc(100vw - 32px)); }
.modal-confirm { width: min(520px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(16, 25, 32, .62); backdrop-filter: blur(3px); }
.modal-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 26px 18px; background: white; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0 0 5px; }
.modal-body { padding: 24px 26px 28px; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; padding-top: 6px; }
.modal-section { padding-top: 22px; margin-top: 22px; border-top: 1px solid var(--line); }
.confirm-copy { margin: 0; color: #3e4851; font-size: 16px; line-height: 1.6; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px; margin-top: 4px; border: 1px solid #f0caca; border-radius: 10px; background: #fff7f7; }
.button-link { border: 0; padding: 0; background: none; color: var(--brand-dark); cursor: pointer; font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }
.compact-list { display: grid; gap: 10px; }
.compact-item { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.compact-item:last-child { border-bottom: 0; }
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; background: white; }
.login-art { background: var(--brand); color: white; padding: clamp(40px, 8vw, 110px); display: flex; flex-direction: column; justify-content: space-between; }
.login-art h1 { font-size: clamp(46px, 7vw, 88px); max-width: 760px; }
.login-form { display: grid; place-items: center; padding: 32px; }
.login-form > div { width: min(420px, 100%); }
.login-form .brand { color: var(--ink); }

@media (max-width: 560px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { padding: 18px; position: static; }
    .brand { margin-bottom: 16px; }
    .nav { grid-template-columns: repeat(3, 1fr); }
    .sidebar-footer { display: none; }
    .content { padding: 28px 18px 60px; }
    .grid.two, .credentials-grid, .login-page, .metric-grid { grid-template-columns: 1fr; }
    .credential-item-wide { grid-column: auto; }
    .copy-field { align-items: stretch; }
    .copy-field .code { flex: 1 1 auto; }
    .danger-zone { align-items: flex-start; flex-direction: column; }
    .login-art { min-height: 280px; }
    .modal-head, .modal-body { padding-left: 18px; padding-right: 18px; }
}

@media (min-width: 561px) and (max-width: 900px) {
    .shell { grid-template-columns: 190px minmax(0, 1fr); }
    .sidebar { padding: 24px 14px; }
    .content { padding: 28px 16px 60px; }
    .metric-grid { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; }
}

@media (min-width: 901px) and (max-width: 1120px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
