/*
 * Tel Channel Watcher — admin panel theme
 * Light blue-grey canvas, white rounded cards, soft blue primary, coral for warnings,
 * and a dark "ink" pill for the active menu item. Only class names used by the Blade views.
 */
:root {
    --bg: #eef2f9;
    --bg-glow: #e3eafc;
    --card: #ffffff;
    --text: #171a21;
    --muted: #737b8f;
    --border: #e4e9f2;
    --border-strong: #d3dae8;

    --primary: #4f7ee6;
    --primary-600: #3d68cc;
    --primary-soft: #ebf1fe;
    --accent: #ec6d62;
    --accent-soft: #fdeeec;

    --ink: #14161b;
    --ink-hover: #262931;

    --green: #2b9a68;
    --green-soft: #e5f5ed;
    --red: #d9534a;
    --red-soft: #fdecea;
    --amber: #b07419;
    --amber-soft: #fdf4e3;

    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 1px 2px rgba(23, 30, 50, .04), 0 8px 24px -12px rgba(23, 30, 50, .12);
    --shadow-lg: 0 18px 40px -18px rgba(40, 60, 120, .28);
    --side-w: 262px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: Vazirmatn, Tahoma, sans-serif;
    background:
        radial-gradient(1200px 500px at 100% -10%, var(--bg-glow), transparent 60%),
        radial-gradient(900px 400px at -10% 110%, #f3e9f2, transparent 60%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-size: 14px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-600); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary); }
code, .mono { font-family: "JetBrains Mono", Consolas, "Courier New", monospace; direction: ltr; unicode-bidi: embed; font-size: .92em; }
code { background: #f2f5fb; padding: 1px 6px; border-radius: 6px; }

::selection { background: var(--primary-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #cfd7e6; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }

/* ---------------------------------------------------------------- layout */
.shell { display: flex; min-height: 100vh; }

.side {
    width: var(--side-w); flex-shrink: 0;
    margin: 14px; margin-inline-end: 0;
    height: calc(100vh - 28px); position: sticky; top: 14px;
    /* soft dark: slate, not black */
    background: linear-gradient(180deg, #2c3240 0%, #252a36 100%);
    border: 1px solid rgba(255, 255, 255, .06); border-radius: 24px;
    box-shadow: 0 18px 40px -20px rgba(20, 24, 36, .55);
    padding: 18px 14px; overflow-y: auto;
    display: flex; flex-direction: column;
    color: #c5cbd8;
}
.side::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); }

.brand {
    display: flex; align-items: center; gap: 10px;
    color: #fff; font-weight: 800; font-size: 16px;
    margin: 0 4px 20px; padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .06);
}
.brand:hover { color: #fff; }

.nav { flex: 1; }
.nav a {
    display: flex; align-items: center; gap: 10px;
    color: #c5cbd8; padding: 9px 12px; margin-bottom: 3px;
    border-radius: 14px; font-weight: 500;
    transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav a.active {
    background: linear-gradient(135deg, var(--primary), #6a8ff0); color: #fff;
    box-shadow: 0 10px 22px -12px rgba(79, 126, 230, .9);
}
.nav a.active:hover { background: linear-gradient(135deg, var(--primary-600), var(--primary)); }
.nav .count {
    margin-inline-start: auto; font-size: 11.5px; font-weight: 600;
    min-width: 24px; text-align: center; padding: 0 7px; border-radius: 99px;
    background: rgba(255, 255, 255, .08); color: #aeb6c6;
}
.nav a.active .count { background: rgba(255, 255, 255, .2); color: #fff; }
.nav-sep { height: 1px; background: rgba(255, 255, 255, .08); margin: 12px 8px; }

.side form button {
    width: 100%; font: inherit; font-size: 13px; cursor: pointer;
    background: rgba(236, 109, 98, .14); color: #f5a49c;
    border: 0; padding: 10px; border-radius: 14px; font-weight: 600;
    transition: filter .15s;
}
.side form button:hover { filter: brightness(.97); }

.main { flex: 1; min-width: 0; padding: 22px 28px 48px; }

.page-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin-bottom: 20px; padding: 4px 2px;
}
.page-head h1 { font-size: 22px; font-weight: 800; margin: 0; }

/* ------------------------------------------------------------ components */
.card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.card h2 {
    font-size: 15px; font-weight: 700; margin: 0 0 14px;
    display: flex; align-items: center; gap: 8px;
}

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 18px; }
.stat {
    position: relative; overflow: hidden;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px 18px; box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
}
.stat::after {
    content: ""; position: absolute; inset-inline-end: -30px; top: -30px;
    width: 96px; height: 96px; border-radius: 50%;
    background: radial-gradient(circle, var(--primary-soft), transparent 70%);
    pointer-events: none;
}
.grid .stat:nth-child(4n+2)::after { background: radial-gradient(circle, var(--green-soft), transparent 70%); }
.grid .stat:nth-child(4n+3)::after { background: radial-gradient(circle, var(--accent-soft), transparent 70%); }
.grid .stat:nth-child(4n+4)::after { background: radial-gradient(circle, #f1ecff, transparent 70%); }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat .label { color: var(--muted); font-size: 13px; position: relative; }
.stat .value { font-size: 28px; font-weight: 800; position: relative; }
.stat .sub { color: var(--muted); font-size: 12px; position: relative; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: 1px solid var(--border-strong); background: var(--card); color: var(--text);
    padding: 7px 14px; border-radius: 12px; cursor: pointer;
    font: inherit; font-size: 13px; font-weight: 500; white-space: nowrap;
    transition: background .15s, border-color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { background: #f6f8fc; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--primary); border-color: var(--primary); color: #fff;
    box-shadow: 0 8px 18px -10px rgba(79, 126, 230, .9);
}
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); color: #fff; }
.btn-danger { color: var(--red); border-color: #f4c9c4; background: #fff; }
.btn-danger:hover { background: var(--red-soft); color: var(--red); }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 10px; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }

.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.b-green { background: var(--green-soft); color: var(--green); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-amber { background: var(--amber-soft); color: var(--amber); }
.b-blue { background: var(--primary-soft); color: var(--primary-600); }
.b-gray { background: #eef1f6; color: var(--muted); }

.alert {
    padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
    border: 1px solid transparent; box-shadow: var(--shadow);
}
.alert-ok { background: var(--green-soft); color: #17633f; border-color: #c9ead9; }
.alert-err { background: var(--red-soft); color: #8f2a22; border-color: #f6cdc8; }

/* tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: right; padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; background: #f6f8fc; }
th:first-child { border-start-start-radius: 12px; }
th:last-child { border-start-end-radius: 12px; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: #f8faff; }
tr:last-child td { border-bottom: 0; }
td .muted, .muted { color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

/* forms */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
input[type=text], input[type=password], input[type=search], input[type=number], input[type=email], select, textarea {
    font: inherit; padding: 9px 12px;
    border: 1px solid var(--border-strong); border-radius: 12px;
    background: #fbfcfe; color: var(--text);
    transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary); background: #fff;
    box-shadow: 0 0 0 4px rgba(79, 126, 230, .15);
}
input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; vertical-align: middle; }
textarea { width: 100%; min-height: 96px; direction: ltr; }
.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 5px; color: #4a5163; font-size: 13px; font-weight: 500; }
.field input { width: 100%; }
.field input[type=checkbox] { width: auto; }
.error { color: var(--red); font-size: 12px; margin-top: 4px; }

/* tabs */
.tabs {
    display: inline-flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px;
    padding: 4px; background: #e6ebf5; border-radius: 14px;
}
.tabs a { padding: 6px 14px; border-radius: 10px; color: #4a5163; font-weight: 500; }
.tabs a:hover { color: var(--text); background: rgba(255, 255, 255, .6); }
.tabs a.active { background: #fff; color: var(--text); box-shadow: 0 2px 6px rgba(23, 30, 50, .08); }

dl.kv { display: grid; grid-template-columns: minmax(140px, 260px) 1fr; margin: 0; }
dl.kv dt, dl.kv dd { padding: 9px 0; border-bottom: 1px dashed var(--border); margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { word-break: break-all; }

.copy { cursor: pointer; transition: background .15s; }
.copy:hover { background: var(--primary-soft); border-radius: 6px; }

.pager { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.pager a, .pager span {
    min-width: 34px; text-align: center; padding: 5px 10px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--card); font-size: 13px; color: var(--text);
}
.pager a:hover { border-color: var(--primary); color: var(--primary-600); }
.pager .current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pager .disabled { color: var(--muted); background: transparent; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* ----------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; padding: 30px 28px; border-radius: 24px; box-shadow: var(--shadow-lg); }
.login-card h1 { font-size: 19px; font-weight: 800; text-align: center; margin: 0 0 22px; }
.login-card .btn { width: 100%; padding: 10px; }

/* ------------------------------------------------------- notifications */
.notif-count { background: var(--accent) !important; color: #fff !important; }
.notif-banner {
    background: linear-gradient(135deg, #fff7ea, #fdeeec);
    border: 1px solid #f5d9c2; border-radius: var(--radius);
    padding: 14px 18px; margin-bottom: 18px; box-shadow: var(--shadow);
}
.notif-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.notif-banner ul { margin: 8px 0 0; padding-inline-start: 18px; }
.notif-banner li { padding: 2px 0; }
tr.is-new td { background: #fff8ec; }

.card, .stat, .alert, .notif-banner { animation: rise .3s ease-out both; }
@keyframes rise { from { transform: translateY(6px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------------------------------------------------------------- mobile */
@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .side { width: auto; height: auto; position: static; margin: 10px; padding: 12px; border-radius: 20px; }
    .nav { display: flex; flex-wrap: wrap; gap: 4px; }
    .nav a { margin: 0; padding: 7px 10px; }
    .nav-sep { display: none; }
    .brand { margin-bottom: 10px; }
    .main { padding: 6px 12px 32px; }
    .two-col { grid-template-columns: 1fr; }
    .card { padding: 16px; }
}

/* ----------------------------------------------------------------- icons (Tabler Icons) */
.ti { font-size: 1.2em; line-height: 1; vertical-align: -0.18em; flex-shrink: 0; }
.nav a .ti { font-size: 19px; color: #8f98ad; transition: color .15s; }
.nav a:hover .ti { color: #fff; }
.nav a.active .ti { color: #fff; }
.btn .ti { font-size: 16px; }
.btn-sm .ti { font-size: 14px; }
.badge .ti { font-size: 14px; vertical-align: -0.2em; }
.card h2 .ti, .page-head h1 .ti { color: var(--primary); }
.stat .label .ti { color: var(--primary); font-size: 16px; }
.side form button .ti { font-size: 16px; }
th .ti { font-size: 15px; }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }

.brand-mark {
    display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 11px;
    background: linear-gradient(135deg, var(--primary), #8b6cf0); color: #fff;
    box-shadow: 0 8px 16px -8px rgba(79, 126, 230, .9);
}
.brand-mark .ti { font-size: 20px; vertical-align: 0; }
.login-card h1 { display: flex; align-items: center; justify-content: center; gap: 10px; }

/* "running" dot that breathes */
.pulse {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green);
    box-shadow: 0 0 0 0 rgba(43, 154, 104, .6); animation: pulse 1.8s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(43, 154, 104, 0); } 100% { box-shadow: 0 0 0 0 rgba(43, 154, 104, 0); } }
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ help tips (?) */
.tip { position: relative; display: inline-flex; vertical-align: middle; cursor: help; outline: none; }
.tip > .ti { font-size: 16px; color: #a3abbd; transition: color .15s; }
.tip:hover > .ti, .tip:focus > .ti { color: var(--primary); }
.tip-body {
    position: absolute; z-index: 50; bottom: calc(100% + 10px); inset-inline-start: 50%;
    transform: translateX(50%) translateY(4px);
    width: max-content; max-width: 300px;
    background: var(--ink); color: #e9ecf3; font-size: 12.5px; font-weight: 400; line-height: 1.8;
    padding: 10px 12px; border-radius: 12px; box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .15s, transform .15s;
    white-space: normal; text-align: right;
}
.tip-body::after {
    content: ""; position: absolute; top: 100%; inset-inline-start: 50%; transform: translateX(50%);
    border: 6px solid transparent; border-top-color: var(--ink);
}
.tip-body code { background: rgba(255, 255, 255, .1); color: #fff; }
.tip:hover .tip-body, .tip:focus .tip-body, .tip:focus-within .tip-body {
    opacity: 1; visibility: visible; transform: translateX(50%) translateY(0);
}
.tip-body.wide { max-width: 380px; }

/* ------------------------------------------------------------ compact info rows */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 14px; }
.tile { background: #f6f8fc; border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; min-width: 0; }
.tile .k { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.tile .v { font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.tile .v.error { font-weight: 400; font-size: 12.5px; margin: 0; }
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.row:last-child { border-bottom: 0; }
.row > .k { color: var(--muted); display: flex; align-items: center; gap: 6px; }
.row > .v { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; text-align: left; }
.hint-line { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 18px; }
.field label { display: flex; align-items: center; gap: 6px; }
.field .unit { color: var(--muted); font-weight: 400; font-size: 12px; }
.switch-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #f6f8fc; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; cursor: pointer; }
details.log { margin-top: 6px; }
details.log summary { cursor: pointer; color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; list-style: none; }
details.log summary::-webkit-details-marker { display: none; }
details.log pre {
    max-height: 320px; overflow: auto; background: #0f1320; color: #dfe5f2; padding: 12px 14px;
    border-radius: 12px; font-size: 12px; white-space: pre-wrap; margin: 10px 0 0;
}
.cmd { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.cmd:last-child { border-bottom: 0; }
.cmd .k { color: #4a5163; display: flex; align-items: center; gap: 6px; }
.cmd code { white-space: nowrap; overflow-x: auto; max-width: 100%; }
.mini-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.mini-link:hover { color: var(--primary); }
.acc-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* quota progress (our channels) */
.progress { height: 7px; background: #e9edf5; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), #7c9cf2); border-radius: 99px; }
tr.own-done .progress > span { background: var(--green); }
tr.own-done td { background: #f5fbf8; }
td input[type=text] { padding: 6px 9px; }

[hidden] { display: none !important; }
