:root {
    --ink: #10201d;
    --muted: #64748b;
    --line: #e2e8e6;
    --bg: #f5f8f7;
    --card: #fff;
    --accent: #0d9488;
    --accent-dark: #0f766e;
    --danger: #dc2626;
    --sidebar: #0b1f1c;
    --sidebar-soft: #12302b;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.55;
}
a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 232px;
    background: var(--sidebar);
    color: #cbe6df;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 20px 16px; color: #fff; font-weight: 800; letter-spacing: -.02em;
}
.brand .mark {
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, #2dd4bf, #0d9488);
    display: grid; place-items: center; font-size: 18px;
}
.brand small { display: block; font-size: 11px; font-weight: 500; color: #7fb8ab; letter-spacing: .04em; }
.nav { padding: 8px 12px; display: grid; gap: 2px; }
.nav a {
    display: flex; align-items: center; gap: 10px;
    color: #a7cfc5; padding: 10px 12px; border-radius: 9px; font-weight: 600; font-size: 13.5px;
}
.nav a:hover { background: var(--sidebar-soft); color: #fff; text-decoration: none; }
.nav a.active { background: #134e4a; color: #fff; box-shadow: inset 3px 0 0 #2dd4bf; }
.nav .ico { width: 18px; text-align: center; opacity: .9; }
.sidebar-bottom { margin-top: auto; padding: 14px 16px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #134e4a; display: grid; place-items: center; color: #5eead4; font-weight: 700; }
.sidebar-user .name { color: #e6f4f0; font-weight: 600; font-size: 13px; }
.sidebar-user .email { color: #7fb8ab; font-size: 11.5px; }
.sidebar-bottom .btn { width: 100%; }
.sidebar-bottom .links { display: flex; gap: 12px; margin-top: 10px; font-size: 12px; }
.sidebar-bottom .links a, .sidebar-bottom .links button { color: #7fb8ab; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.sidebar-bottom .links a:hover, .sidebar-bottom .links button:hover { color: #fff; }

.main { flex: 1; margin-left: 232px; min-width: 0; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 18px 28px; background: rgba(255,255,255,.82); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 19px; margin: 0; letter-spacing: -.02em; }
.topbar .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.menu-toggle { display: none; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 10px; cursor: pointer; }
.content { padding: 24px 28px 60px; max-width: 1500px; }

.alert { border-radius: 10px; padding: 11px 14px; margin-bottom: 16px; font-size: 13.5px; }
.alert.success { background: #e8f7f2; border: 1px solid #b6e6da; color: #0f766e; }
.alert.error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.alert ul { margin: 4px 0 0 18px; padding: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px -28px rgba(15, 23, 42, .28); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 15px; margin: 0; }
.card-head .hint { color: var(--muted); font-size: 12px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 0; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; position: relative; overflow: hidden; }
.kpi::after { content: ""; position: absolute; inset: auto -20px -30px auto; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, rgba(13,148,136,.14), transparent 70%); }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .value { font-size: 27px; font-weight: 800; letter-spacing: -.03em; margin-top: 4px; }
.kpi .foot { color: var(--muted); font-size: 11.5px; margin-top: 6px; }

.grid-2 { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stack { display: grid; gap: 16px; }

.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; min-height: 150px; padding-top: 10px; }
.bar-col { display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: end; height: 100%; }
.bar-stack { display: flex; flex-direction: column-reverse; gap: 2px; width: 100%; max-width: 30px; height: 120px; justify-content: start; }
.bar { width: 100%; border-radius: 4px 4px 2px 2px; min-height: 0; }
.bar.short { background: #14b8a6; }
.bar.view { background: #0ea5e9; }
.bar.cta { background: #f59e0b; }
.bar-col .day { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; background: #fafcfc; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }

.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: 11.5px; font-weight: 700; background: #eef2f1; color: #475569; white-space: nowrap; }
.badge.green { background: #dcfce7; color: #15803d; }
.badge.amber { background: #fef3c7; color: #b45309; }
.badge.red { background: #fee2e2; color: #b91c1c; }
.badge.blue { background: #e0f2fe; color: #0369a1; }
.badge.violet { background: #ede9fe; color: #6d28d9; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    background: var(--accent); color: #fff; border: 1px solid transparent; border-radius: 9px;
    padding: 9px 14px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; line-height: 1.2;
}
.btn:hover { background: var(--accent-dark); color: #fff; text-decoration: none; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: #f8faf9; color: var(--ink); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 7px; }
.btn.ghost { background: transparent; color: var(--muted); border-color: transparent; }
.btn.ghost:hover { background: #eef2f1; color: var(--ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 6px; color: #334155; }
.field .help { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=url], select, textarea {
    width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 9px;
    padding: 9px 11px; font: inherit; font-size: 13.5px; color: var(--ink); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #5eead4; box-shadow: 0 0 0 3px rgba(45, 212, 191, .15); }
textarea { resize: vertical; min-height: 80px; }
input[type=file] { font-size: 12.5px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.check input { width: 16px; height: 16px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions .spacer { flex: 1; }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filter-bar .field { min-width: 140px; }
.filter-bar .field.grow { flex: 1; min-width: 200px; }
.pagination { display: flex; gap: 6px; padding: 14px 18px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 5px 9px; border: 1px solid var(--line); border-radius: 7px; font-size: 12.5px; background: #fff; }
.pagination .active { background: var(--accent); color: #fff; border-color: var(--accent); }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }

.repeat-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 8px; margin-bottom: 8px; align-items: start; }
.repeat-row.faq-row { grid-template-columns: 1fr 2fr auto; }
.repeat-row.pixel-row { grid-template-columns: 150px 1fr 160px auto; }
.repeat-row.profile-row { grid-template-columns: 1.6fr .8fr 66px .8fr .9fr auto; }
.repeat-row.profile-row textarea { grid-column: 2 / -1; min-height: 56px; }
.repeat-row.profile-row input[type=file] { font-size: 11.5px; padding: 6px 0; }
.icon-btn { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 16px; line-height: 1; }
.icon-btn:hover { color: var(--danger); border-color: #fecaca; background: #fef2f2; }
.section-title { font-size: 13px; font-weight: 800; letter-spacing: .02em; color: #0f172a; margin: 22px 0 10px; display: flex; align-items: center; gap: 8px; }
.section-title .hint { font-weight: 500; color: var(--muted); font-size: 11.5px; }
details.target-box { border: 1px solid var(--line); border-radius: 11px; background: #fff; margin-bottom: 9px; }
details.target-box > summary { list-style: none; cursor: pointer; padding: 11px 13px; font-weight: 700; font-size: 13px; display: flex; justify-content: space-between; gap: 10px; }
details.target-box > summary::-webkit-details-marker { display: none; }
details.target-box > summary .tag { color: var(--muted); font-weight: 500; font-size: 11.5px; }
details.target-box[open] > summary { border-bottom: 1px solid var(--line); background: #fafcfc; border-radius: 11px 11px 0 0; }
details.target-box .box-body { padding: 13px; display: grid; gap: 10px; }
.target-grid { display: grid; grid-template-columns: 170px 1fr 1fr; gap: 9px; }
.target-grid .full { grid-column: 1 / -1; }
.code-chip { display: inline-flex; align-items: center; gap: 6px; background: #f1f5f4; border: 1px solid var(--line); border-radius: 7px; padding: 3px 7px; font-family: ui-monospace, monospace; font-size: 12px; }
.copy-btn { border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 0 2px; }
.copy-btn:hover { color: var(--accent-dark); }
.hero-note { font-size: 11.5px; color: var(--muted); }
.modal-mask {
    position: fixed; inset: 0; z-index: 100; background: rgba(8, 25, 22, .55);
    display: flex; align-items: center; justify-content: center; padding: 18px;
    backdrop-filter: blur(3px);
}
.modal-mask[hidden] { display: none !important; }
.modal {
    width: min(620px, 100%); max-height: calc(100vh - 36px); overflow: auto;
    background: #fff; border-radius: 16px; box-shadow: 0 30px 90px -30px rgba(0,0,0,.55);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-close { border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 6px; }
.modal-body { padding: 18px 20px; display: grid; gap: 14px; }
.modal-foot { display: flex; gap: 9px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: #fafcfc; }
.callout { background: #f1f8f6; border: 1px solid #cde9e1; color: #0f766e; border-radius: 9px; padding: 10px 12px; font-size: 12.5px; line-height: 1.55; }
.country-picker { position: relative; }
.country-trigger { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 9px 11px; font: inherit; font-size: 13.5px; cursor: pointer; text-align: start; }
.country-trigger .placeholder { color: #94a3b8; }
.country-panel { position: absolute; z-index: 20; inset-inline: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 22px 60px -24px rgba(0,0,0,.35); overflow: hidden; }
.country-panel[hidden] { display: none !important; }
.country-search { padding: 9px; border-bottom: 1px solid var(--line); }
.country-search input { width: 100%; }
.country-list { max-height: 260px; overflow: auto; padding: 5px; }
.country-option { width: 100%; display: flex; align-items: center; gap: 9px; border: 0; background: transparent; padding: 8px 9px; border-radius: 7px; cursor: pointer; font: inherit; font-size: 13px; text-align: start; }
.country-option:hover, .country-option.active { background: #f1f8f6; }
.country-option .flag { font-size: 17px; }
.country-option .name { flex: 1; }
.country-option .dial { color: var(--muted); font-family: ui-monospace, monospace; font-size: 12px; }
.phone-preview { color: var(--muted); font-size: 12px; margin-top: 4px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 0%, #d9f2ec, transparent 45%), radial-gradient(circle at 100% 100%, #cfe9e3, transparent 40%), #f5f8f7; }
.login-card { width: min(400px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 30px 80px -40px rgba(15, 23, 42, .35); padding: 30px; }
.login-card .brand { color: var(--ink); padding: 0 0 18px; }
.login-card h1 { font-size: 21px; margin: 0 0 4px; letter-spacing: -.02em; }
.login-card p.hint { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.login-card .field { margin-bottom: 13px; }
.login-card .btn { width: 100%; padding: 11px; }
.login-foot { text-align: center; color: var(--muted); font-size: 11.5px; margin-top: 18px; }

@media (max-width: 1100px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 20px 0 60px rgba(0,0,0,.2); }
    body.nav-open .sidebar { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .topbar { padding: 14px 16px; }
    .content { padding: 16px 14px 50px; }
    .form-grid { grid-template-columns: 1fr; }
    .target-grid, .repeat-row, .repeat-row.pixel-row, .repeat-row.profile-row { grid-template-columns: 1fr; }
    .repeat-row.profile-row textarea, .repeat-row.profile-row input[type=file] { grid-column: 1 / -1; }
    .kpis { gap: 10px; }
    .kpi .value { font-size: 23px; }
    .filter-bar .field { min-width: 120px; }
}
