/* Desh messaging gateway panels: one hand-written file, no build step (cPanel has no Node). */
:root {
    --ink: #1c2430; --muted: #667085; --line: #e4e7ec; --bg: #f5f7f6; --card: #fff;
    --brand: #0f766e; --brand-dark: #115e59; --brand-soft: #e6f4f1;
    --ok: #067647; --ok-bg: #ecfdf3; --bad: #b42318; --bad-bg: #fef3f2; --warn: #b54708; --warn-bg: #fffaeb;
    --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0; background: var(--bg); color: var(--ink);
    font: 16px/1.55 "Baloo Da 2", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 16px; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86rem; }
pre { background: #101828; color: #d1fadf; padding: 14px; border-radius: var(--radius); overflow-x: auto; white-space: pre; }
.muted { color: var(--muted); font-size: .9rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Top bar + side navigation */
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; line-height: 1.15; }
.brand:hover { text-decoration: none; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: .8rem; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 1.1rem; }
.top-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.top-actions form { margin: 0; }
.who { color: var(--ink); font-weight: 500; }
.lang a { padding: 2px 8px; border-radius: 6px; color: var(--muted); font-size: .9rem; }
.lang a.on { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.shell { display: grid; grid-template-columns: 210px 1fr; min-height: calc(100vh - 58px); }
.sidenav { background: var(--card); border-right: 1px solid var(--line); padding: 16px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidenav a { padding: 8px 12px; border-radius: 8px; color: var(--ink); }
.sidenav a:hover { background: var(--bg); text-decoration: none; }
.sidenav a.on { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.content { padding: 24px; min-width: 0; max-width: 1200px; }

/* Cards, stats, grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: .88rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat.bad .value { color: var(--bad); }
.stat.ok .value { color: var(--ok); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.head-row h1, .head-row h2 { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; word-break: break-word; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .94rem; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f9fafb; color: var(--muted); font-weight: 600; font-size: .85rem; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }

/* Badges */
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: #f2f4f7; color: #344054; white-space: nowrap; }
.badge.sent, .badge.on { background: #eff8ff; color: #175cd3; }
.badge.delivered, .badge.read, .badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.failed, .badge.off { background: var(--bad-bg); color: var(--bad); }
.badge.queued { background: var(--warn-bg); color: var(--warn); }

/* Forms */
label { display: grid; gap: 4px; font-size: .92rem; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], input[type=date], input[type=number], input:not([type]), select, textarea {
    width: 100%; padding: 9px 11px; border: 1px solid #d0d5dd; border-radius: 8px; font: inherit; font-size: .95rem; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid #99d6cd; border-color: var(--brand); }
textarea { min-height: 110px; resize: vertical; }
.form { display: grid; gap: 14px; max-width: 720px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 0; display: grid; gap: 12px; }
legend { padding: 0 6px; font-weight: 600; }
.hint { color: var(--muted); font-size: .84rem; font-weight: 400; }
.btn, button.btn {
    display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border: 0; border-radius: 8px;
    background: var(--brand); color: #fff; font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid #d0d5dd; }
.btn.ghost:hover { background: var(--bg); }
.btn.danger { background: var(--bad); }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn-link { background: none; border: 0; color: var(--brand); font: inherit; cursor: pointer; padding: 0; }

/* Messages */
.flash { padding: 11px 14px; border-radius: var(--radius); margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: var(--ok-bg); color: var(--ok); border-color: #abefc6; }
.flash.bad { background: var(--bad-bg); color: var(--bad); border-color: #fecdca; }
.flash ul { margin: 0; padding-left: 18px; }
.newkey { background: #101828; color: #fff; padding: 16px; border-radius: var(--radius); margin-bottom: 18px; }
.newkey p { margin: 4px 0 10px; color: #d0d5dd; font-size: .9rem; }
.newkey code { display: block; background: #1d2939; padding: 10px; border-radius: 8px; word-break: break-all; margin-bottom: 10px; color: #a6f4c5; font-size: .95rem; }

/* List screens: search, Advanced, chips, pager */
.filters { margin-bottom: 10px; }
.searchrow { display: flex; gap: 8px; }
.searchrow input { flex: 1; }
.advanced { margin-top: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.advanced summary { cursor: pointer; font-weight: 600; color: var(--brand-dark); }
.advanced[open] summary { margin-bottom: 12px; }
.adv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.chip { background: var(--brand-soft); color: var(--brand-dark); padding: 3px 12px; border-radius: 999px; font-size: .88rem; }
.chip span { font-weight: 700; margin-left: 4px; }
.chip.clear { background: transparent; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 2px; }
.pages { display: flex; gap: 4px; flex-wrap: wrap; }
.pages a, .pages span { min-width: 34px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; text-align: center; background: #fff; }
.pages .cur { background: var(--brand); color: #fff; border-color: var(--brand); }
.pages .off { color: #98a2b3; }
.perpage { margin: 0; }
.perpage label { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--muted); }
.perpage select { width: auto; padding: 5px 8px; }

/* Sign-in */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.auth-card .brand { margin-bottom: 18px; }
.auth-card .lang { display: block; text-align: right; margin-bottom: 6px; }

/* Phones */
@media (max-width: 820px) {
    .shell { grid-template-columns: 1fr; }
    .sidenav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px; gap: 4px; }
    .sidenav a { white-space: nowrap; padding: 6px 12px; }
    .content { padding: 16px; }
    .two, .form-grid { grid-template-columns: 1fr; }
    .topbar { padding: 8px 16px; position: static; }
    h1 { font-size: 1.3rem; }
}
