:root {
    --ink: #102a2f;
    --muted: #688087;
    --paper: #f4f7f5;
    --card: #ffffff;
    --line: #dce7e3;
    --brand: #0b6e69;
    --brand-dark: #07514e;
    --accent: #ef8d32;
    --danger: #bd3e42;
    --shadow: 0 18px 45px rgba(22, 57, 59, .09);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); }
body { margin: 0; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.shell { display: grid; grid-template-columns: 270px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; background: #0d2f32; color: #dcebea; padding: 26px 18px 20px; }
.brand { display: flex; align-items: center; min-height: 40px; margin-bottom: 38px; }
.brand-logo { display: block; width: min(205px, 100%); height: auto; }
.nav { display: grid; gap: 7px; }
.nav a { padding: 10px 12px; border-radius: 9px; color: #afc8c7; font-size: 14px; font-weight: 650; }
.nav a:hover, .nav a.active { color: white; background: rgba(255,255,255,.09); }
.nav-home { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.nav-symbol { display: inline-grid; place-items: center; width: 20px; margin-right: 7px; color: #82aaa7; font-size: 14px; }
.nav-group { border-radius: 11px; }
.nav-group summary { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; color: #c6d8d7; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 800; list-style: none; user-select: none; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary:hover, .nav-group[open] > summary { color: white; background: rgba(255,255,255,.045); }
.nav-chevron { color: #749492; font-size: 19px; transition: transform .18s ease; }
.nav-group[open] .nav-chevron { transform: rotate(90deg); }
.nav-submenu { display: grid; gap: 3px; margin: 3px 0 7px 20px; padding-left: 10px; border-left: 1px solid rgba(255,255,255,.11); }
.nav-submenu a { padding: 8px 10px; font-size: 13px; font-weight: 600; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding-top: 18px; }
.sidebar-foot small { display: block; color: #8eaeac; margin-top: 4px; }
.logout { padding: 0; border: 0; background: none; color: #efb3a9; margin-top: 15px; cursor: pointer; font-weight: 650; }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 25px 36px 10px; }
.topbar h1 { margin: 0; font-size: 27px; letter-spacing: -.04em; }
.page-context { display: block; margin-bottom: 3px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.env-pill { font-size: 12px; color: var(--brand-dark); background: #d9efeb; padding: 7px 11px; border-radius: 999px; font-weight: 700; }
.content { padding: 20px 36px 50px; max-width: 1450px; }

.hero { border-radius: 20px; padding: 28px 30px; color: white; background: linear-gradient(120deg, #0b6e69, #11494d); box-shadow: var(--shadow); margin-bottom: 22px; }
.hero h2 { margin: 0 0 7px; font-size: 24px; }
.hero p { margin: 0; color: #d2e9e6; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 22px; }
.context-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 22px; }
.context-card { position: relative; min-width: 0; padding: 19px; background: var(--card); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.context-card h3 { margin: 0 0 6px; font-size: 16px; }
.context-card p { min-height: 38px; margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.context-card > div { display: flex; flex-wrap: wrap; gap: 6px; }
.context-card a { padding: 6px 8px; color: var(--brand-dark); background: #e8f2ef; border-radius: 7px; font-size: 11px; font-weight: 750; }
.context-card a:hover { color: white; background: var(--brand); }
.context-icon { float: right; color: var(--brand); opacity: .7; font-size: 20px; }
.stat, .card { background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 16px; }
.stat { padding: 20px; }
.stat span { display: block; color: var(--muted); font-size: 13px; font-weight: 650; }
.stat strong { display: block; font-size: 29px; margin-top: 6px; letter-spacing: -.05em; }
.card { padding: 22px; }
.card-head, .page-actions { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.card h2, .card h3 { margin: 0; }
.page-actions p { margin: 5px 0 0; color: var(--muted); }

.btn { border: 0; border-radius: 10px; padding: 10px 15px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-weight: 750; font-size: 14px; }
.btn-primary { background: var(--brand); color: white; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #e7efed; color: var(--ink); }
.btn-danger { background: #fae4e4; color: var(--danger); }
.btn-sm { padding: 7px 10px; font-size: 12px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 11px 12px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; border-bottom: 1px solid var(--line); }
td { padding: 14px 12px; border-bottom: 1px solid #edf2f0; }
tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: 7px; justify-content: flex-end; }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: #e4f3ef; color: var(--brand-dark); font-size: 11px; font-weight: 800; }
.badge.off { background: #f1e8e8; color: #985050; }
.badge.status-online { background: #dff2ec; color: #175e51; }
.badge.status-offline, .badge.status-inactive { background: #f1e8e8; color: #985050; }
.badge.status-error { background: #fff0d5; color: #8a5a0a; }
.badge.status-unknown { background: #e9edf3; color: #566273; }
.badge.status-scheduled, .badge.status-pending { background: #e9edf3; color: #566273; }
.badge.status-running, .badge.status-originating, .badge.status-connected { background: #fff0d5; color: #8a5a0a; }
.badge.status-paused, .badge.status-no_answer, .badge.status-busy { background: #f1e8e8; color: #985050; }
.badge.status-completed, .badge.status-answered { background: #dff2ec; color: #175e51; }
.badge.status-cancelled, .badge.status-failed { background: #fbe5e5; color: #953e43; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 6px; }
.status-section { margin-top: 28px; }
.status-service { font-size: 22px !important; letter-spacing: -.03em !important; }
.status-service.online { color: #175e51; }
.status-service.offline { color: #985050; }
.member-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
.member-option { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; cursor: pointer; }
.member-option input { width: auto; }
.member-option span { font-size: 13px; }
.member-option small { display: block; color: var(--muted); margin-top: 2px; }
audio { height: 34px; max-width: 260px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 7px; }
.field.full { grid-column: 1 / -1; }
label { font-size: 13px; font-weight: 750; }
input, select { width: 100%; border: 1px solid #cddbd7; background: white; border-radius: 10px; padding: 11px 12px; color: var(--ink); outline: none; }
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,110,105,.11); }
.help { color: var(--muted); font-size: 12px; margin: 0; }
.check { display: flex; gap: 9px; align-items: center; }
.check input { width: auto; }
.check label { font-weight: 600; }
.form-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.filter-bar { display: flex; align-items: end; gap: 12px; margin-bottom: 18px; padding: 15px 18px; }
.filter-bar .field { min-width: 210px; }
.muted { color: var(--muted); }
.upload-zone { padding: 17px; border: 1px dashed #b8ccc6; border-radius: 12px; background: #f9fbfa; }
.upload-zone .code-box { margin-top: 4px; padding: 12px 14px; font-size: 12px; }
.status-text { font-size: 20px !important; letter-spacing: -.02em !important; }

.alert { border-radius: 11px; padding: 13px 15px; margin-bottom: 18px; font-size: 14px; }
.alert-ok { background: #dff2ec; color: #175e51; }
.alert-error { background: #fbe5e5; color: #953e43; }
.alert-secret { background: #fff3d8; color: #664813; border: 1px solid #f2d58e; }
.alert ul { margin: 5px 0 0 18px; padding: 0; }
.empty { text-align: center; color: var(--muted); padding: 34px !important; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; background: #0d2f32; }
.login-art { padding: 8vw; display: flex; flex-direction: column; justify-content: center; color: white; background: radial-gradient(circle at 25% 25%, #177d76, #0d2f32 60%); }
.login-logo { width: min(290px, 70%); height: auto; margin-bottom: 30px; }
.login-art h1 { font-size: clamp(42px, 6vw, 78px); letter-spacing: -.065em; line-height: .95; margin: 18px 0; max-width: 650px; }
.login-art p { color: #c0d9d7; font-size: 18px; max-width: 530px; line-height: 1.6; }
.login-panel { display: grid; place-items: center; background: var(--paper); padding: 30px; }
.login-card { width: min(430px, 100%); }
.login-card h2 { margin: 0; font-size: 30px; letter-spacing: -.04em; }
.login-card > p { color: var(--muted); margin-bottom: 30px; }
.login-card .field { margin-bottom: 16px; }
.login-card .btn { width: 100%; margin-top: 8px; padding: 13px; }
.code-box { border-radius: 12px; background: #102a2f; color: #c7eee8; padding: 16px; font-family: ui-monospace, monospace; overflow-wrap: anywhere; }

nav[role="navigation"] { margin-top: 18px; }
nav[role="navigation"] svg { width: 18px; }

@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: static; height: auto; padding: 18px; }
    .brand { margin-bottom: 15px; }
    .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .nav-home { grid-column: 1 / -1; }
    .nav-group { align-self: start; }
    .nav-submenu { margin-left: 8px; }
    .sidebar-foot { margin-top: 16px; }
    .topbar, .content { padding-left: 18px; padding-right: 18px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .context-grid { grid-template-columns: repeat(2, 1fr); }
    .login-page { grid-template-columns: 1fr; }
    .login-art { display: none; }
}

@media (max-width: 620px) {
    .stats, .form-grid, .context-grid, .nav { grid-template-columns: 1fr; }
    .member-grid { grid-template-columns: 1fr; }
    .page-actions { align-items: flex-start; flex-direction: column; }
    .filter-bar { align-items: stretch; flex-direction: column; }
    .content { padding-top: 10px; }
}
