/*
 * algoritem.app: a quiet, light studio look (white, slate and the logo's red as a small accent).
 */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --line: #e3e6eb;
  --line-strong: #cfd4dc;
  --text: #111827;
  --muted: #5b6474;
  --accent: #d7191f;
  --accent-ink: #ffffff;
  --accent-soft: #fdecec;
  --dark: #0f172a;
  --input: #ffffff;
  --tab-bg: #eef0f4;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px -12px rgba(15, 23, 42, 0.12);
  --radius: 14px;
  --gutter: clamp(16px, 4vw, 40px);
  --head: "Space Grotesk", "Inter", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 400 16px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  display: flex; flex-direction: column;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--head); line-height: 1.15; margin: 0; letter-spacing: -0.015em; color: var(--text); }
h1 { font-size: clamp(32px, 4.6vw, 54px); font-weight: 700; }
h2 { font-size: clamp(24px, 3vw, 34px); font-weight: 600; }
h3 { font-size: 18px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.03em; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }
.wrap.narrow { max-width: 780px; }
main { flex: 1; }
main.enter { animation: enter 0.35s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } }

.demo-banner { display: none; background: var(--dark); color: #e5e7eb; font-size: 13px; text-align: center; padding: 6px 16px; }
.demo-banner.show { display: block; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 72px; }
.brand { display: flex; align-items: center; }
.brand img { height: 40px; width: auto; }
.brand.small img { height: 34px; }
.nav { display: flex; gap: 2px; margin: 0 auto; }
.nav a { padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 15px; transition: 0.15s; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
.top-right { display: flex; align-items: center; gap: 10px; }
.flags { display: flex; gap: 6px; }
.flag { width: 30px; height: 20px; padding: 0; border: 2px solid transparent; border-radius: 4px; background: none; cursor: pointer; overflow: hidden; opacity: 0.65; transition: 0.15s; }
.flag svg { width: 100%; height: 100%; display: block; }
.flag:hover { opacity: 1; }
.flag.selected { opacity: 1; border-color: var(--accent); }
.menu-toggle { display: none; background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: 8px; width: 40px; height: 40px; font-size: 18px; cursor: pointer; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: 600 15px "Inter", sans-serif; cursor: pointer; transition: 0.15s; white-space: nowrap; }
.btn:hover { border-color: var(--text); }
.btn-primary { background: var(--dark); border-color: var(--dark); color: #fff; }
.btn-primary:hover { background: #1e293b; border-color: #1e293b; }
.btn-small { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.35; cursor: default; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.eyebrow { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.lead { font-size: clamp(16px, 1.5vw, 18px); color: var(--muted); margin-top: 16px; max-width: 600px; }
.link { color: var(--accent); font-weight: 600; font-size: 14px; }
.back { display: inline-block; color: var(--muted); margin-bottom: 18px; font-weight: 500; }
.back:hover { color: var(--text); }

/* Panels and grids */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.section { padding: 56px var(--gutter); }
.page-top { padding-top: 40px; }
.section-head { margin: 0 auto 30px; text-align: center; max-width: 680px; }
.section-head p { color: var(--muted); margin-top: 8px; }
.section-head.row { max-width: none; text-align: left; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.center-row { display: flex; justify-content: center; margin-top: 26px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-center { grid-template-columns: repeat(auto-fit, minmax(280px, 360px)); justify-content: center; }
.empty { padding: 32px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* Home */
.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 48px; align-items: center; padding-top: 64px; padding-bottom: 32px; }
.hero h1 { margin-top: 14px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.activate-card { display: flex; flex-direction: column; gap: 14px; padding: 26px; border-radius: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--accent);
  box-shadow: var(--shadow); transition: transform 0.2s, border-color 0.2s; }
.activate-card:hover { transform: translateY(-3px); border-color: var(--line-strong); border-top-color: var(--accent); }
.activate-title { display: flex; align-items: center; gap: 14px; }
.activate-title img { width: 64px; height: 64px; border-radius: 14px; }
.activate-title h2 { font-size: 26px; }
.activate-title p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.activate-text { color: var(--muted); font-size: 15px; }
.service { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; }
.service p { color: var(--muted); font-size: 14.5px; }
.service-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 22px; }

/* Covers */
.cover { position: relative; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: #0b0b0f; border: 1px solid var(--line); }
.cover img { width: 100%; height: 100%; object-fit: contain; }
.cover.big { aspect-ratio: auto; min-height: 300px; }
.cover.art { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: linear-gradient(145deg, var(--c), color-mix(in srgb, var(--c) 35%, #0b0b0f)); }
.art-mark { width: 84px; height: 84px; display: grid; place-items: center; font-size: 52px; border-radius: 22px; }
.art-mark.has-logo { background: #fff; padding: 10px; }
.art-mark img { width: 100%; height: 100%; object-fit: contain; }
.cover.big .art-mark { width: 120px; height: 120px; font-size: 76px; border-radius: 28px; }
.art-name { font: 700 22px var(--head); color: #fff; }

/* Cards */
.card { display: flex; flex-direction: column; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow: hidden; box-shadow: var(--shadow); transition: transform 0.2s, border-color 0.2s; }
.card .cover { border-radius: 0; border: 0; border-bottom: 1px solid var(--line); }
.card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.card-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body p { color: var(--muted); font-size: 14.5px; flex: 1; }
.card-body time, article time { color: var(--accent); font-size: 12.5px; font-weight: 600; letter-spacing: 0.04em; }
.card-title { display: flex; align-items: center; gap: 10px; }
.card-title.big { gap: 16px; }
.mini-icon { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; font-size: 19px; background: var(--surface-2); border: 1px solid var(--line); }
.card-title.big .mini-icon { width: 58px; height: 58px; font-size: 30px; border-radius: 14px; }
.mini-icon.has-logo { background: #fff; padding: 3px; overflow: hidden; }
.mini-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }

/* Product page and articles */
.product-hero { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.prose { margin-top: 18px; color: var(--text); display: flex; flex-direction: column; gap: 14px; max-width: 680px; }
.prose h3 { margin-top: 10px; }
.lists { margin-top: 34px; }
.checks { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 10px; }
.checks li { position: relative; padding-left: 28px; font-size: 15px; }
.checks li::before { content: "✓"; position: absolute; left: 0; top: 1px; width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.post-image { border-radius: var(--radius); margin: 26px 0 8px; border: 1px solid var(--line); }
article h1 { margin-top: 8px; font-size: clamp(28px, 4vw, 44px); }

/* Contact */
.contact { display: flex; align-items: center; justify-content: space-between; gap: 22px; flex-wrap: wrap; padding: 32px; background: var(--dark); border-color: var(--dark); }
.contact h2 { color: #fff; }
.contact p { color: #cbd5e1; margin-top: 8px; }
.contact .btn-primary { background: #fff; color: var(--dark); border-color: #fff; }

/* Bro IPTV pages and forms */
.bro-head { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.bro-logo { width: 64px; height: 64px; border-radius: 16px; }
.bro-name { font-size: clamp(24px, 3vw, 34px); }
.bro-name b { color: var(--accent); }
.bro-name small { font-size: 0.55em; font-weight: 600; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--tab-bg); border: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border: 0; border-radius: 7px; background: none; color: var(--muted); font: 600 14px "Inter", sans-serif; cursor: pointer; white-space: nowrap; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12); }
.bro-tabs, .admin-tabs { max-width: 560px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; min-width: 0; }
label { font-size: 13px; color: var(--muted); font-weight: 500; }
.input { width: 100%; height: 42px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--input); color: var(--text); font: 15px "Inter", sans-serif; transition: 0.15s; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.color { padding: 4px; }
.input.order { width: 84px; height: 34px; display: inline-block; margin-left: 8px; }
.error { color: var(--accent); font-size: 14px; }
.error:empty { display: none; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 14px; }
.choice { display: flex; justify-content: space-between; align-items: center; height: 46px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong); cursor: pointer; transition: 0.15s; }
.choice.selected { border-color: var(--accent); background: var(--accent-soft); }
.summary { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); margin-top: 6px; gap: 10px; flex-wrap: wrap; }
.status-pill { display: inline-flex; height: 26px; padding: 0 12px; align-items: center; border-radius: 99px; font-size: 12.5px; font-weight: 700; }
.status-active { background: rgba(22, 163, 74, 0.14); color: #15803d; }
.status-trial { background: rgba(217, 119, 6, 0.14); color: #b45309; }
.status-none { background: var(--accent-soft); color: var(--accent); }
.narrow-panel { max-width: 520px; margin: 0 auto; }
.device-card, .playlist, .admin-row { display: flex; align-items: center; gap: 16px; }
.device-card { margin-bottom: 20px; flex-wrap: wrap; }
.device-actions { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.icon-box { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--line); font-size: 22px; }
.playlist { padding: 16px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
details { border-bottom: 1px solid var(--line); padding: 14px 0; }
details:last-child { border-bottom: 0; }
summary { cursor: pointer; font-weight: 600; }
details p { color: var(--muted); margin-top: 10px; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: stretch; }
.plan { display: flex; flex-direction: column; gap: 10px; position: relative; }
.plan .checks { flex: 1; margin-bottom: 14px; }
.plan.featured { border-color: var(--accent); }
.price { font: 700 36px var(--head); }
.price small { font: 500 14px "Inter", sans-serif; color: var(--muted); }
.ribbon { position: absolute; top: -12px; right: 20px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; padding: 4px 10px; border-radius: 99px; }

/* Panel (admin) */
.admin-bar { display: flex; justify-content: flex-end; margin-bottom: 14px; gap: 12px; }
.admin-bar.wide { justify-content: flex-start; align-items: flex-end; flex-wrap: wrap; }
.admin-bar.wide .field { margin: 0; width: 180px; }
.admin-row { padding: 14px 18px; }
.editor { display: flex; flex-direction: column; gap: 4px; }
.lang-tabs { max-width: 460px; margin-bottom: 0; }
.flag-mini { width: 20px; height: 14px; display: inline-block; border-radius: 3px; overflow: hidden; }
.flag-mini svg { width: 100%; height: 100%; display: block; }
.checks-row { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; margin: 4px 0 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.table tr:last-child td { border-bottom: 0; }
.image-row { display: flex; gap: 10px; align-items: center; }
.thumb { width: 64px; height: 42px; flex: none; border-radius: 8px; border: 1px solid var(--line-strong); overflow: hidden; display: grid; place-items: center; background: repeating-linear-gradient(45deg, var(--surface-2) 0 6px, var(--surface) 6px 12px); }
.thumb img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.image-actions { display: flex; gap: 8px; margin-top: 8px; }
.image-actions label.btn { color: var(--text); font-size: 13px; }
.order-buttons { display: flex; flex-direction: column; gap: 4px; }
.order-buttons .btn { height: 26px; width: 32px; padding: 0; font-size: 11px; }

/* Footer and toast */
.footer { border-top: 1px solid var(--line); margin-top: 40px; background: var(--surface); }
.footer-inner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding-top: 28px; padding-bottom: 28px; }
.footer-links { display: flex; gap: 22px; color: var(--muted); font-size: 14px; flex-wrap: wrap; justify-content: center; }
.footer-links a:hover { color: var(--text); }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--dark); color: #fff; padding: 12px 20px; border-radius: 10px; z-index: 50; box-shadow: 0 20px 40px rgba(15, 23, 42, 0.35); animation: enter 0.3s ease; max-width: calc(100vw - 32px); }

/* Tablet and phone */
@media (max-width: 980px) {
  .hero, .product-hero { grid-template-columns: 1fr; gap: 30px; }
  .hero-copy { text-align: center; }
  .hero-copy .lead { margin-left: auto; margin-right: auto; }
  .hero-copy .actions { justify-content: center; }
  .grid-3, .plans { grid-template-columns: 1fr; }
  .split, .grid-2 { grid-template-columns: 1fr; }
  .row-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .menu-toggle { display: block; }
  .nav { display: none; position: absolute; top: 72px; left: 0; right: 0; flex-direction: column; padding: 10px var(--gutter) 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .nav.open { display: flex; }
  .nav a { padding: 12px 14px; }
  .topbar-inner { gap: 12px; }
  .top-right { margin-left: auto; }
  .flag { width: 26px; height: 18px; }
  .brand img { height: 32px; }
  .section { padding-top: 40px; padding-bottom: 40px; }
  .hero { padding-top: 32px; }
  .row-2, .row-3, .choices { grid-template-columns: 1fr; }
  .playlist, .admin-row { flex-wrap: wrap; }
  .row-actions { width: 100%; justify-content: flex-start; }
  .device-actions { margin-left: 0; }
  .contact { padding: 24px; }
}
@media (max-width: 380px) {
  .brand img { height: 26px; }
  .flags { gap: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
