/* Hbsms design system: shared by the auth pages and the dashboard */

:root {
    --ink: #0e0f2c;
    --ink-2: #1a1c45;
    --ink-3: #2a2d63;
    --indigo: #656fe0;
    --indigo-dark: #4d57cf;
    --indigo-soft: #e7e8fc;
    --lime: #d6ff3d;
    --lime-soft: #f0ffc2;
    --coral: #ff7a59;
    --coral-soft: #ffe3da;
    --green: #1d8a52;
    --green-soft: #dff7e9;
    --amber: #9a6a00;
    --amber-soft: #fff2d8;
    --red: #c53b2a;
    --red-soft: #fde4e0;
    --paper: #f6f5f0;
    --white: #ffffff;
    --text: #1d1e33;
    --muted: #62647e;
    --line: #e2e1da;
    --radius: 22px;
    --radius-sm: 14px;
    --font-display: "Bricolage Grotesque", system-ui, sans-serif;
    --font-body: "Instrument Sans", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;
    --sidebar: 264px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body.hb {
    background: var(--paper);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

.hb img { max-width: 100%; }
.hb a { color: var(--indigo-dark); }

.hb h1, .hb h2, .hb h3, .hb h4 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin: 0;
    color: var(--ink);
}

.hb code {
    font-family: var(--font-mono);
    font-size: .9em;
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--indigo-soft);
    color: var(--ink-3);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--indigo);
}

.eyebrow::before {
    content: "";
    width: 18px;
    height: 2px;
    background: currentColor;
}

.muted { color: var(--muted); }

.icon {
    width: 20px;
    height: 20px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Buttons ---------- */

.hb .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 999px;
    border: 2px solid transparent;
    background: var(--ink);
    color: var(--white);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
}

.hb .btn:hover { transform: translateY(-1px); }
.hb .btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.hb .btn-lime { background: var(--lime); color: var(--ink); }
.hb .btn-primary { background: var(--indigo); color: var(--white); }
.hb .btn-primary:hover { background: var(--indigo-dark); }
.hb .btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.hb .btn-ghost:hover { border-color: var(--ink); }
.hb .btn-danger { background: var(--red-soft); color: var(--red); }
.hb .btn-danger:hover { background: var(--red); color: var(--white); }
.hb .btn-sm { padding: 7px 14px; font-size: 13px; }
.hb .btn-block { width: 100%; }

/* Delete buttons rendered by the DataTables controllers */
.hb .rounded-pill.lh-0.p-10 { padding: 6px 14px; font-size: 13px; }
.hb td form { margin: 0; display: inline-block; }

/* ---------- Forms ---------- */

.field { margin-bottom: 18px; }

.field label,
.field .label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
}

.field .hint {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--muted);
}

.field-error {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--red);
}

.input {
    display: block;
    width: 100%;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--line);
    background: var(--white);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.4;
    transition: border-color .15s ease, box-shadow .15s ease;
    appearance: none;
    -webkit-appearance: none;
}

.input::placeholder { color: #a3a4b5; }

.input:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 4px rgba(101, 111, 224, .18);
}

.input.is-invalid { border-color: var(--red); }
.input.is-invalid:focus { box-shadow: 0 0 0 4px rgba(197, 59, 42, .14); }

textarea.input { min-height: 120px; resize: vertical; }

select.input:not([multiple]) {
    padding-right: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2362647e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px;
}

select.input[multiple] { min-height: 130px; padding: 8px; }
select.input[multiple] option { padding: 8px 10px; border-radius: 8px; }

input[type=file].input { padding: 10px 12px; }
input[type=file].input::file-selector-button {
    margin-right: 12px;
    padding: 7px 14px;
    border: 0;
    border-radius: 999px;
    background: var(--indigo-soft);
    color: var(--ink-3);
    font-weight: 600;
    cursor: pointer;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.check input {
    width: 18px;
    height: 18px;
    accent-color: var(--indigo);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 26px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 18px;
}

/* ---------- Alerts ---------- */

.hb .alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14.5px;
    font-weight: 500;
}

.hb .alert p { margin: 0; }
.hb .alert p + p { margin-top: 4px; }
.hb .alert-success { background: var(--green-soft); color: var(--green); }
.hb .alert-danger { background: var(--red-soft); color: var(--red); }
.hb .alert-info { background: var(--indigo-soft); color: var(--ink-3); }

/* ---------- Badges ---------- */

.hb .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    background: var(--indigo-soft);
    color: var(--ink-3);
}

.hb .badge-pending { background: var(--amber-soft); color: var(--amber); }
.hb .badge-sent { background: var(--indigo-soft); color: #3d47c4; }
.hb .badge-delivered { background: var(--green-soft); color: var(--green); }
.hb .badge-failed { background: var(--red-soft); color: var(--red); }

/* =====================================================================
   Auth pages
   ===================================================================== */

.auth {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    min-height: 100vh;
}

.auth-art {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    padding: 40px 56px;
    background: var(--ink);
    color: var(--white);
    overflow: hidden;
}

.auth-art::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255,255,255,.09) 1px, transparent 1px);
    background-size: 26px 26px;
    mask-image: radial-gradient(ellipse at 60% 50%, #000, transparent 72%);
    -webkit-mask-image: radial-gradient(ellipse at 60% 50%, #000, transparent 72%);
}

.auth-art::after {
    content: "";
    position: absolute;
    width: 560px;
    height: 560px;
    right: -180px;
    bottom: -160px;
    background: radial-gradient(circle, rgba(101,111,224,.5), transparent 65%);
    filter: blur(10px);
}

.auth-art > * { position: relative; z-index: 1; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.02em;
    text-decoration: none;
    color: inherit;
}

.hb a.brand { color: inherit; }
.brand img { width: 34px; height: auto; }

.auth-art h2 {
    color: var(--white);
    font-size: clamp(34px, 3.8vw, 54px);
    font-weight: 800;
    max-width: 520px;
}

.auth-art h2 mark {
    background: var(--lime);
    color: var(--ink);
    padding: 0 .18em .04em;
    border-radius: .3em .3em .3em .06em;
    display: inline-block;
    transform: rotate(-2deg);
}

.convo {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 420px;
    margin-top: 36px;
}

.bubble {
    max-width: 82%;
    padding: 12px 16px;
    border-radius: 18px 18px 18px 5px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.1);
    font-size: 15px;
    color: rgba(255,255,255,.9);
    opacity: 0;
    animation: bubble-in .6s cubic-bezier(.2,.9,.3,1.25) forwards;
}

.bubble small {
    display: block;
    margin-bottom: 2px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: rgba(255,255,255,.45);
}

.bubble.out {
    align-self: flex-end;
    border-radius: 18px 18px 5px 18px;
    background: var(--lime);
    border-color: var(--lime);
    color: var(--ink);
}

.bubble.out small { color: rgba(14,15,44,.55); }

.bubble.typing {
    display: inline-flex;
    gap: 5px;
    padding: 14px 16px;
    width: auto;
}

.bubble.typing i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255,255,255,.7);
    animation: dots 1.2s infinite ease-in-out;
}

.bubble.typing i:nth-child(2) { animation-delay: .15s; }
.bubble.typing i:nth-child(3) { animation-delay: .3s; }

.convo .bubble:nth-child(1) { animation-delay: .2s; }
.convo .bubble:nth-child(2) { animation-delay: 1s; }
.convo .bubble:nth-child(3) { animation-delay: 1.8s; }
.convo .bubble:nth-child(4) { animation-delay: 2.6s; }

@keyframes bubble-in {
    from { opacity: 0; transform: translateY(12px) scale(.96); }
    to { opacity: 1; transform: none; }
}

@keyframes dots {
    0%, 60%, 100% { transform: translateY(0); opacity: .5; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.auth-foot {
    font-size: 13.5px;
    color: rgba(255,255,255,.5);
}

.auth-foot a { color: rgba(255,255,255,.75); }

.auth-main {
    display: flex;
    flex-direction: column;
    padding: 32px 56px;
}

.auth-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    font-size: 14.5px;
    color: var(--muted);
}

.auth-top .brand { display: none; color: var(--ink); }

.auth-form {
    width: 100%;
    max-width: 420px;
    margin: auto;
    padding: 48px 0;
}

.auth-form h1 {
    font-size: clamp(34px, 3.4vw, 44px);
    font-weight: 800;
    margin: 14px 0 10px;
}

.auth-form .lead {
    margin: 0 0 32px;
    color: var(--muted);
    font-size: 16px;
}

.auth-form .btn-block { padding: 15px 22px; font-size: 16px; }

.auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 4px 0 24px;
    font-size: 14px;
}

.auth-switch {
    margin-top: 26px;
    text-align: center;
    font-size: 14.5px;
    color: var(--muted);
}

.auth-switch a { font-weight: 600; }

.perk {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: -12px 0 28px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--lime-soft);
    font-size: 14.5px;
    font-weight: 500;
    color: var(--ink-3);
}

/* =====================================================================
   Dashboard shell
   ===================================================================== */

.shell {
    display: grid;
    grid-template-columns: var(--sidebar) minmax(0, 1fr);
    min-height: 100vh;
    background: linear-gradient(to right, var(--ink) var(--sidebar), var(--paper) var(--sidebar));
}

.sidenav {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 22px 16px 18px;
    background: var(--ink);
    color: rgba(255,255,255,.72);
    overflow-y: auto;
    z-index: 40;
}

.sidenav .brand { color: var(--white); padding: 4px 10px; }

.nav-group-title {
    padding: 0 12px;
    margin-bottom: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.35);
}

.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

.hb .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    color: rgba(255,255,255,.72);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    transition: background .15s ease, color .15s ease;
}

.hb .nav-item:hover { background: rgba(255,255,255,.07); color: var(--white); }

.hb .nav-item.active {
    background: var(--lime);
    color: var(--ink);
    font-weight: 600;
}

.credit-card {
    margin-top: auto;
    padding: 18px;
    border-radius: 18px;
    background: var(--ink-2);
    border: 1px solid rgba(255,255,255,.08);
}

.credit-card .label {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: rgba(255,255,255,.45);
}

.credit-card .value {
    margin: 6px 0 14px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 30px;
    line-height: 1;
    color: var(--white);
}

.credit-card .value small {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,.55);
}

.credit-card .btn { width: 100%; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 32px;
    background: rgba(246, 245, 240, .86);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

.crumb {
    font-size: 14.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crumb b { color: var(--ink); font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.icon-btn {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--white);
    color: var(--ink);
    cursor: pointer;
    list-style: none;
}

.icon-btn::-webkit-details-marker { display: none; }

.dot-count {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--coral);
    color: var(--white);
    font-size: 11px;
    font-weight: 700;
    line-height: 19px;
    text-align: center;
}

.hb .credit-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 999px;
    background: var(--white);
    border: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.credit-pill i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
}

.credit-pill.low i { background: var(--coral); }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }

.user-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 14px 4px 4px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--white);
    font-weight: 600;
    font-size: 14px;
    color: var(--ink);
}

.avatar {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 12px 12px 12px 4px;
    background: var(--ink);
    color: var(--lime);
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 15px;
    text-transform: uppercase;
}

.menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 260px;
    padding: 8px;
    border-radius: 18px;
    background: var(--white);
    border: 1px solid var(--line);
    box-shadow: 0 24px 50px -20px rgba(14,15,44,.35);
    animation: pop .16s ease-out;
}

.menu-panel.wide { width: 340px; }

@keyframes pop {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
}

.menu-head {
    padding: 10px 12px 12px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 6px;
}

.menu-head strong { display: block; color: var(--ink); }
.menu-head span { font-size: 13px; color: var(--muted); }

.hb .menu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 0;
    background: none;
    color: var(--text);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 14.5px;
    text-align: left;
    cursor: pointer;
}

.hb .menu-link:hover { background: var(--paper); }
.menu-link .icon { width: 18px; height: 18px; color: var(--muted); }
.menu-sep { height: 1px; margin: 6px 0; background: var(--line); }

.notif-list { max-height: 360px; overflow-y: auto; }

.notif {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
}

.notif + .notif { border-top: 1px solid var(--line); border-radius: 0; }

.notif-dot {
    flex: none;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 10px 10px 10px 3px;
    background: var(--indigo-soft);
    color: var(--indigo);
}

.notif-dot .icon { width: 16px; height: 16px; }
.notif p { margin: 0; font-size: 14px; }
.notif small { font-size: 12px; color: var(--muted); }
.notif.unread p { font-weight: 600; }

.empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
}

.menu-toggle { display: none; }

.content { padding: 32px; flex: 1; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.page-head h1 {
    margin-top: 10px;
    font-size: clamp(30px, 3.2vw, 42px);
    font-weight: 800;
}

.page-head p { margin: 8px 0 0; color: var(--muted); max-width: 620px; }

.app-foot {
    padding: 20px 32px 28px;
    font-size: 13px;
    color: var(--muted);
}

.app-foot a { color: var(--muted); }

.scrim { display: none; }

/* ---------- Cards & layout ---------- */

.hb .card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px;
    min-width: 0;
}

.hb .card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.hb .card-head h2,
.hb .card-head h3 { font-size: 21px; font-weight: 700; }
.hb .card-head .hb-link,
.hb .card-link { font-size: 14px; font-weight: 600; text-decoration: none; }

.hb .card-ink { background: var(--ink); border-color: var(--ink); color: rgba(255,255,255,.75); }
.hb .card-ink h2,
.hb .card-ink h3 { color: var(--white); }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.grid-form { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
.narrow { max-width: 640px; }

.stack { display: grid; gap: 20px; align-content: start; }

/* ---------- Stats ---------- */

.stat {
    position: relative;
    overflow: hidden;
}

.stat-label { font-size: 14px; color: var(--muted); font-weight: 500; }

.stat-value {
    margin-top: 12px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 40px;
    line-height: 1;
    letter-spacing: -0.03em;
    color: var(--ink);
}

.stat-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 14px 14px 14px 4px;
    background: var(--indigo-soft);
    color: var(--indigo);
}

.stat:nth-child(2) .stat-icon { background: var(--coral-soft); color: var(--coral); }
.stat:nth-child(3) .stat-icon { background: var(--lime-soft); color: #5d7300; }
.stat:nth-child(4) .stat-icon { background: var(--green-soft); color: var(--green); }

.stat-sub { margin-top: 8px; font-size: 13px; color: var(--muted); }

/* ---------- Bar chart ---------- */

.chart {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: end;
    gap: 10px;
    height: 230px;
    padding-top: 28px;
}

.bar-col {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    height: 100%;
    gap: 8px;
}

.bar {
    width: 100%;
    max-width: 38px;
    min-height: 4px;
    border-radius: 10px 10px 4px 4px;
    background: var(--indigo-soft);
    transition: background .15s ease;
}

.bar-col.current .bar { background: var(--indigo); }
.bar-col:hover .bar { background: var(--ink); }

.bar-val {
    position: absolute;
    top: -2px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink);
    opacity: 0;
    transition: opacity .15s ease;
}

.bar-col:hover .bar-val, .bar-col.current .bar-val { opacity: 1; }

.bar-label {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
}

/* ---------- Lists ---------- */

.msg-list { display: grid; gap: 10px; }

.msg-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--paper);
}

.msg-icon {
    width: 38px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 12px 12px 12px 3px;
    background: var(--white);
    color: var(--indigo);
}

.msg-icon .icon { width: 18px; height: 18px; }

.msg-body { min-width: 0; }

.msg-body .to {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--ink);
    font-weight: 600;
}

.msg-body .text {
    display: block;
    color: var(--muted);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
}

.device-item + .device-item { border-top: 1px dashed var(--line); }

.device-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--ink);
    color: var(--lime);
    flex: none;
}

.device-item .name { font-weight: 600; color: var(--ink); }
.device-item .meta { font-size: 13px; color: var(--muted); }
.device-item .count { margin-left: auto; text-align: right; font-family: var(--font-display); font-weight: 800; font-size: 20px; color: var(--ink); }
.device-item .count small { display: block; font-family: var(--font-body); font-size: 12px; font-weight: 500; color: var(--muted); }

.empty-state {
    padding: 30px 10px;
    text-align: center;
    color: var(--muted);
}

.empty-state .btn { margin-top: 14px; }

/* ---------- Tables (plain + DataTables) ---------- */

.table-wrap { overflow-x: auto; margin: 0 -26px; padding: 0 26px; }

.hb table.table {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14.5px;
    border: 0 !important;
}

.hb table.table thead th,
.hb table.table tfoot th {
    padding: 12px 14px;
    background: var(--paper);
    border: 0 !important;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: left;
    white-space: nowrap;
}

.hb table.table thead th:first-child { border-radius: 12px 0 0 12px; }
.hb table.table thead th:last-child { border-radius: 0 12px 12px 0; }
.hb table.table tfoot { display: none; }

.hb table.table tbody tr { background: transparent !important; }

.hb table.table tbody td {
    padding: 14px;
    border: 0 !important;
    border-bottom: 1px solid var(--line) !important;
    vertical-align: middle;
    background: transparent !important;
}

.hb table.table tbody tr:last-child td { border-bottom: 0 !important; }
.hb table.table tbody tr:hover td { background: #fbfbf8 !important; }

.hb table.dataTable thead .sorting,
.hb table.dataTable thead .sorting_asc,
.hb table.dataTable thead .sorting_desc {
    cursor: pointer;
    background-image: none !important;
    position: relative;
}

.hb table.dataTable thead .sorting_asc::after { content: " ↑"; color: var(--indigo); }
.hb table.dataTable thead .sorting_desc::after { content: " ↓"; color: var(--indigo); }

.hb .dataTables_wrapper { position: relative; color: var(--text); }

.hb .dataTables_wrapper .dataTables_length,
.hb .dataTables_wrapper .dataTables_filter {
    margin-bottom: 18px;
    font-size: 14px;
    color: var(--muted);
}

.hb .dataTables_wrapper .dataTables_length { float: left; }
.hb .dataTables_wrapper .dataTables_filter { float: right; text-align: right; }

.hb .dataTables_wrapper .dataTables_filter input,
.hb .dataTables_wrapper .dataTables_length select {
    margin-left: 8px;
    padding: 9px 14px;
    border-radius: 999px;
    border: 1.5px solid var(--line);
    background: var(--white);
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text);
}

.hb .dataTables_wrapper .dataTables_length select { margin: 0 6px; padding: 7px 10px; }

.hb .dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: var(--indigo);
    box-shadow: 0 0 0 4px rgba(101,111,224,.18);
}

.hb .dataTables_wrapper .dataTables_info {
    float: left;
    padding-top: 22px;
    font-size: 13.5px;
    color: var(--muted);
}

.hb .dataTables_wrapper .dataTables_paginate {
    float: right;
    padding-top: 16px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.hb .dataTables_wrapper .dataTables_paginate span { display: inline-flex; gap: 4px; }

.hb .dataTables_wrapper .dataTables_paginate .paginate_button {
    min-width: 36px;
    margin: 0 !important;
    padding: 7px 12px !important;
    border-radius: 999px !important;
    border: 1px solid transparent !important;
    background: none !important;
    color: var(--text) !important;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
    box-shadow: none !important;
}

.hb .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--white) !important;
    border-color: var(--line) !important;
}

.hb .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--ink) !important;
    border-color: var(--ink) !important;
    color: var(--white) !important;
}

.hb .dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: .4;
    cursor: default;
    background: none !important;
    border-color: transparent !important;
}

.hb .dataTables_wrapper::after { content: ""; display: table; clear: both; }

.hb .dataTables_wrapper .dataTables_processing {
    position: absolute;
    top: 50%;
    left: 50%;
    width: auto;
    height: auto;
    margin: 0;
    padding: 12px 18px;
    transform: translate(-50%, -50%);
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--white);
    box-shadow: 0 14px 30px -14px rgba(14,15,44,.3);
    font-size: 14px;
    z-index: 2;
}

.hb .dataTables_wrapper .dataTables_empty { padding: 34px 14px; color: var(--muted); text-align: center; }

.hb .spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: -3px;
    border-radius: 50%;
    border: 2px solid var(--indigo-soft);
    border-top-color: var(--indigo);
    animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Payment methods ---------- */

.method {
    padding: 16px 18px;
    border-radius: 16px;
    background: rgba(255,255,255,.05);
    border: 1px solid rgba(255,255,255,.08);
}

.method + .method { margin-top: 10px; }

.method .name {
    font-family: var(--font-mono);
    font-size: 11.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--lime);
}

.method .detail {
    margin-top: 4px;
    font-weight: 600;
    color: var(--white);
    word-break: break-word;
}

.method .btn { margin-top: 12px; }

.plan-pick { display: grid; gap: 10px; }

.field .plan-option {
    position: relative;
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1.5px solid var(--line);
    background: var(--white);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.plan-option input { accent-color: var(--indigo); width: 18px; height: 18px; flex: none; }
.plan-option .price { font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--ink); min-width: 64px; }
.plan-option .sms { font-weight: 600; color: var(--ink); }
.plan-option .unit { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.field .plan-option:has(input:checked) { border-color: var(--indigo); background: #f7f7fe; }

.pay-status { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pay-actions { display: inline-flex; gap: 4px; }

/* ---------- Dialog ---------- */

dialog.dialog {
    width: min(480px, calc(100vw - 32px));
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: var(--white);
    color: var(--text);
    box-shadow: 0 40px 80px -30px rgba(14,15,44,.5);
}

dialog.dialog::backdrop { background: rgba(14,15,44,.55); backdrop-filter: blur(3px); }

.dialog-body { padding: 28px; }
.dialog-body h2 { font-size: 24px; margin-bottom: 6px; }
.dialog-body > p { margin: 0 0 22px; color: var(--muted); }

.token-out {
    font-family: var(--font-mono);
    font-size: 13px;
    background: var(--paper);
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main, .grid-form { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 960px) {
    .auth { grid-template-columns: 1fr; }
    .auth-art { display: none; }
    .auth-top .brand { display: inline-flex; }
    .auth-main { padding: 24px; }
    .auth-form { padding: 40px 0; }

    .shell { grid-template-columns: 1fr; background: var(--paper); }

    .sidenav {
        position: fixed;
        inset: 0 auto 0 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform .25s ease;
    }

    .nav-open .sidenav { transform: none; }

    .nav-open .scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(14,15,44,.45);
        z-index: 35;
    }

    .menu-toggle { display: inline-grid; }
    .topbar { padding: 12px 16px; }
    .content { padding: 24px 16px; }
    .app-foot { padding: 16px; }
    .credit-pill-wrap { display: none; }
}

@media (max-width: 640px) {
    .grid-2, .grid-4 { grid-template-columns: minmax(0, 1fr); }
    .field-row { grid-template-columns: 1fr; }
    .hb .card { padding: 20px; }
    .table-wrap { margin: 0 -20px; padding: 0 20px; }
    .hb .table-wrap table.table { min-width: 640px; }
    .stat-value { font-size: 34px; }
    .chart { gap: 5px; height: 190px; }
    .bar-label { font-size: 9.5px; }
    .user-btn .user-name { display: none; }
    .user-btn { padding: 4px; }
    .menu-panel, .menu-panel.wide { position: fixed; left: 16px; right: 16px; top: 66px; width: auto; }
    .hb .dataTables_wrapper .dataTables_length,
    .hb .dataTables_wrapper .dataTables_filter,
    .hb .dataTables_wrapper .dataTables_info,
    .hb .dataTables_wrapper .dataTables_paginate { float: none; text-align: left; }
    .hb .dataTables_wrapper .dataTables_filter input { width: 100%; margin: 6px 0 0; }
    .hb .dataTables_wrapper .dataTables_filter label { display: block; }
    .msg-item { grid-template-columns: minmax(0, 1fr) auto; }
    .msg-icon { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .bubble { opacity: 1; }
}
