/* Imn0tVPN Platform. Palette follows the Imn0tVPN client app: flat neutral
   greys and one green accent. Dark is the default; light is opt-in from the
   profile screen (data-theme="light" on <html>). */

:root {
  color-scheme: dark;
  --bg: #1e1e1e;
  --card: #252525;
  --row: #2c2c2c;
  --line: #2f2f2f;
  --control: #333333;
  --text: #f2f2f2;
  --text2: #8e8e93;
  --text3: #5e5e5e;
  --accent: #30d158;
  --on-accent: #0e1a11;
  --accent-soft: rgba(48, 209, 88, 0.12);
  --danger: #ff453a;
  --danger-soft: rgba(255, 69, 58, 0.12);
  --warn: #e0964a;
  --radius: 12px;
  --radius-s: 8px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f5f7;
  --card: #ffffff;
  --row: #ebebee;
  --line: #dedee2;
  --control: #e4e4e8;
  --text: #1c1c1e;
  --text2: #6e6e73;
  --text3: #a1a1a6;
  --accent: #1f9d45;
  --on-accent: #ffffff;
  --accent-soft: rgba(31, 157, 69, 0.1);
  --danger: #d92d20;
  --danger-soft: rgba(217, 45, 32, 0.08);
  --warn: #b5651d;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); min-width: 320px; }
#app { min-height: 100dvh; }

h1, h2, h3, p, dl, dd, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; overflow-wrap: anywhere; }
h2 { font-size: 15px; font-weight: 600; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.logo { font-weight: 800; font-size: 17px; letter-spacing: -0.02em; color: var(--text); }
.logo i { font-style: normal; color: var(--accent); }
.logo-btn { border: 0; background: none; padding: 0; text-align: left; }
.eyebrow { font-size: 12px; color: var(--text2); margin-bottom: 4px; }
.lead { color: var(--text2); margin-top: 8px; max-width: 60ch; }
.hint { color: var(--text2); font-size: 13px; }
.hint code, .lead code { font-family: var(--mono); font-size: 0.92em; background: var(--row); padding: 1px 6px; border-radius: 5px; color: var(--text); }
.empty { color: var(--text2); padding: 24px 0; text-align: center; }
.link { border: 0; background: none; padding: 0; color: var(--accent); }
.grp { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text3); }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: var(--radius-s); padding: 8px 14px; font-size: 13px; font-weight: 550; background: var(--control); color: var(--text); text-decoration: none; min-height: 34px; }
.btn .icon { width: 15px; height: 15px; }
.btn.pri { background: var(--accent); color: var(--on-accent); }
.btn.quiet { background: none; color: var(--text2); }
.btn.quiet:hover { color: var(--text); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.full { width: 100%; }
.acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 16px; }
.acts.foot { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---- status ---- */
.state { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text2); }
.state .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.state.ok { color: var(--accent); }
.state.ok .dot { box-shadow: 0 0 0 4px var(--accent-soft); }
.state.warn { color: var(--warn); }
.badge { font-style: normal; font-size: 11px; font-weight: 700; background: var(--accent); color: var(--on-accent); border-radius: 99px; padding: 1px 7px; margin-left: auto; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.notice { margin-top: 14px; padding: 10px 12px; border-radius: var(--radius-s); background: var(--row); color: var(--text); font-size: 13px; }
.notice.warn { color: var(--warn); }
.form-error { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 0; }
.form-error:empty, .form-note:empty { display: none; }
.form-note { color: var(--text2); font-size: 13px; margin-top: 10px; }

/* ---- forms ---- */
.form { display: grid; gap: 14px; margin-top: 22px; max-width: 460px; }
.form .acts { margin-top: 2px; }
.form h2 { display: flex; align-items: center; gap: 8px; }
.field { display: grid; gap: 6px; }
.field > span:first-child { font-size: 12px; color: var(--text2); }
.input-wrap { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--card); color: var(--text2); }
.input-wrap:focus-within { border-color: var(--accent); }
.input-wrap input { flex: 1; min-width: 0; border: 0; background: none; outline: 0; padding: 10px 0; color: var(--text); }
.field textarea, .field select { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--card); padding: 10px 12px; color: var(--text); resize: vertical; }
.field textarea:focus, .field select:focus { outline: 0; border-color: var(--accent); }
::placeholder { color: var(--text3); }
.otp-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; max-width: 300px; }
.otp-input { width: 100%; text-align: center; font-family: var(--mono); font-size: 18px; padding: 10px 0; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--card); }
.otp-input:focus { outline: 0; border-color: var(--accent); }
.consent-row { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text2); }
.consent-row input { margin: 3px 0 0; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.consent-copy .link { margin-left: 4px; font-size: 13px; }
.copy-secret { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.copy-secret code { font-family: var(--mono); font-size: 15px; padding: 8px 12px; border-radius: var(--radius-s); background: var(--row); overflow-wrap: anywhere; user-select: all; }
.secrets { display: grid; gap: 24px; margin-top: 22px; }
.secrets .hint { margin-top: 4px; }
.code-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.code-chips code { font-family: var(--mono); font-size: 13px; padding: 5px 9px; border-radius: 6px; background: var(--row); user-select: all; }
.confirm-code-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.attach .hint label { cursor: pointer; }
.attach-preview { margin: 0; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.attach-preview img { max-width: 100%; max-height: 240px; border-radius: var(--radius-s); border: 1px solid var(--line); display: block; }

/* ---- rows ---- */
.rows { margin-top: 22px; border-bottom: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 0; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; color: var(--text); }
.row > .icon { color: var(--text2); }
.row strong { font-weight: 500; white-space: nowrap; }
.row span { margin-left: auto; color: var(--text2); font-size: 13px; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.row .new { color: var(--accent); font-weight: 600; }
.row .go { width: 14px; height: 14px; color: var(--text3); }
.row strong + .go { margin-left: auto; }
button.row:hover strong { color: var(--accent); }
.rows.plain { margin-top: 32px; }
.view > .state { margin-top: 14px; }
.view > .copy-secret { margin-top: 20px; }
.view > .grp { margin-top: 28px; }
.view > .grp + .rows { margin-top: 8px; }

/* ---- auth pages ---- */
.auth-page { min-height: 100dvh; display: flex; flex-direction: column; }
.auth-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.auth-body { width: 100%; max-width: 560px; margin: 0 auto; padding: 56px 24px 64px; }
.auth-body.narrow { max-width: 460px; }
.auth-body.wide { max-width: 860px; }
.auth-body .state { margin-bottom: 12px; }
.steps { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 28px; font-size: 12px; color: var(--text3); }
.steps li { display: flex; align-items: center; gap: 6px; }
.steps span { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--control); color: var(--text2); font-size: 11px; font-weight: 600; }
.steps .on { color: var(--text); }
.steps .on span { background: var(--accent); color: var(--on-accent); }
.steps .done span { background: var(--accent-soft); color: var(--accent); }
.login-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 48px; align-items: start; }
.login-grid .form { align-content: start; justify-items: stretch; }
.form > .btn { justify-self: start; }
.login-grid .form + .form { border-left: 1px solid var(--line); padding-left: 48px; }

/* ---- dashboard shell ---- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); height: 100dvh; }
.side { display: flex; flex-direction: column; padding: 18px 12px 12px; border-right: 1px solid var(--line); overflow-y: auto; }
.side .logo-btn { padding: 2px 10px 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .grp { padding: 16px 10px 6px; }
.nav button, .side-me button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: var(--radius-s); background: none; color: var(--text2); text-align: left; }
.nav button:hover, .side-me button:hover { color: var(--text); }
.nav button.on, .side-me button.on { background: var(--row); color: var(--text); }
.nav button.on { box-shadow: inset 2px 0 0 var(--accent); }
.side-me { margin-top: auto; display: flex; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.side-me button:first-child { flex: 1; min-width: 0; }
.side-me span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtop, .tabs { display: none; }
.main { overflow-y: auto; min-width: 0; }
.view-wrap { padding: 28px 36px 48px; }
.view { max-width: 560px; }
.view.wide { max-width: 940px; }
.view-head { min-width: 0; }
.entries { min-width: 0; }
.loading { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--text2); padding: 24px; text-align: center; }
.loading strong { color: var(--text); }

/* ---- home ---- */
.sub { margin-top: 28px; }
.big { font-size: 40px; font-weight: 650; letter-spacing: -0.03em; line-height: 1; margin-top: 12px; font-variant-numeric: tabular-nums; }
.big small { font-size: 15px; font-weight: 500; letter-spacing: 0; color: var(--text2); margin-left: 8px; }
.until { color: var(--text2); font-size: 13px; margin-top: 6px; max-width: 52ch; }
.meter { height: 3px; border-radius: 3px; background: var(--control); margin-top: 16px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.meter.warn i { background: var(--warn); }

/* ---- chat ---- */
.chat-view, .admin-chat-view { display: flex; flex-direction: column; height: calc(100dvh - 76px); }
.admin-chat-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 260px minmax(0, 1fr); margin-top: 18px; border-top: 1px solid var(--line); }
.thread-list { overflow-y: auto; border-right: 1px solid var(--line); padding: 8px 8px 8px 0; }
.thread { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--radius-s); background: none; text-align: left; }
.thread > span { min-width: 0; display: grid; }
.thread strong { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread small { color: var(--text2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread.on { background: var(--row); }
.chat-card { flex: 1; min-height: 0; display: flex; flex-direction: column; max-width: 760px; }
.admin-chat-layout .chat-card { padding: 14px 0 0 20px; max-width: none; }
.chat-card > header { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.chat-card > header .eyebrow { margin: 2px 0 0; }
.chat-view .chat-card > header .eyebrow { margin: 0 0 4px; }
.chat-feed { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 16px 0; }
.chat-feed .empty { margin: auto; }
.chat-feed .empty:not(:only-child) { display: none; }
.msg { max-width: min(78%, 520px); padding: 8px 12px; border-radius: 12px; background: var(--card); align-self: flex-start; }
:root[data-theme="light"] .msg { border: 1px solid var(--line); }
.msg p { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg time { display: block; font-size: 11px; color: var(--text3); margin-top: 2px; text-align: right; }
[data-own="user"] .msg.user, [data-own="admin"] .msg.admin { align-self: flex-end; background: var(--accent-soft); border-color: transparent; }
.chat-composer { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.chat-composer input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--card); padding: 9px 12px; }
.chat-composer input:focus { outline: 0; border-color: var(--accent); }

/* ---- admin lists ---- */
.items { margin-top: 20px; border-bottom: 1px solid var(--line); }
.items .empty { border-top: 1px solid var(--line); }
.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); }
.item .acts { margin-top: 0; }
.kv { display: flex; flex-wrap: wrap; gap: 6px 24px; margin-top: 8px; font-size: 13px; }
.kv dt { color: var(--text3); font-size: 12px; }
.stats { display: flex; flex-wrap: wrap; gap: 10px 40px; margin-top: 22px; padding: 14px 0; border-block: 1px solid var(--line); }
.stats b { display: block; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stats span { color: var(--text2); font-size: 12px; }
.stats + .hint { margin: 14px 0 18px; max-width: 80ch; }
.ehead, .entry { display: grid; grid-template-columns: 1fr 1.8fr 1.1fr 0.9fr 0.8fr 124px; gap: 12px; align-items: center; padding: 10px 0; }
.ehead { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text3); border-bottom: 1px solid var(--line); }
.entry { border-bottom: 1px solid var(--line); font-size: 13px; }
.entry dt { display: none; }
.entry dd, .entry h3 { min-width: 0; overflow-wrap: anywhere; }
.entry small { display: block; color: var(--text3); font-size: 12px; font-weight: 400; }
.entry h3 { font-size: 14px; font-weight: 600; }
.entry .pill { justify-self: end; }
.entry.off .pill { background: var(--row); color: var(--text2); }
.entry.off h3, .entry.off dd { color: var(--text2); }

/* ---- modals ---- */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.6); overflow-y: auto; }
.modal-card { position: relative; width: 100%; max-width: 440px; display: grid; gap: 14px; padding: 24px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); }
.modal-card > p { color: var(--text2); }
.modal-close { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border: 0; border-radius: var(--radius-s); background: none; color: var(--text2); font-size: 20px; line-height: 1; }
.modal-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--row); color: var(--text2); }
.modal-icon.success { background: var(--accent-soft); color: var(--accent); }
.modal-icon.warning { color: var(--warn); }
.manual-trial-form { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.privacy-consent-card { max-width: 560px; }
.privacy-consent-copy { display: grid; gap: 10px; max-height: 50dvh; overflow-y: auto; color: var(--text2); font-size: 13px; }
.consent-version { color: var(--text3); font-size: 12px; margin-top: 2px; }

/* ---- tables collapse before the phone layout ---- */
@media (max-width: 1080px) {
  .ehead { display: none; }
  .entry { grid-template-columns: 1fr 1fr; gap: 10px 12px; align-items: start; padding: 14px 0; }
  .entry:first-of-type { border-top: 1px solid var(--line); }
  .entry dt { display: block; font-size: 12px; color: var(--text3); margin-bottom: 2px; }
  .entry .pill { grid-column: 2; grid-row: 1; }
  .entry .wide { grid-column: 1 / -1; }
}

/* ---- phone ---- */
@media (max-width: 760px) {
  .shell { display: flex; flex-direction: column; }
  .side { display: none; }
  .mtop { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .bell { position: relative; border: 0; background: none; padding: 4px; color: var(--text2); display: flex; }
  .bell .badge { position: absolute; top: -4px; right: -8px; }
  .main { flex: 1; }
  .view-wrap { padding: 18px 16px 24px; }
  .tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); background: var(--card); padding: 6px 6px calc(8px + env(safe-area-inset-bottom)); }
  .tabs button { position: relative; display: grid; justify-items: center; gap: 3px; padding: 6px 0; border: 0; background: none; font-size: 11px; color: var(--text2); }
  .tabs button.on { color: var(--accent); }
  .tabs .badge { position: absolute; top: 0; left: calc(50% + 6px); margin: 0; }
  .row { flex-wrap: wrap; }
  .row strong { white-space: normal; }
  .item { grid-template-columns: 1fr; }
  .chat-view, .admin-chat-view { height: calc(100dvh - 49px - 62px - 42px - env(safe-area-inset-bottom)); }
  .admin-chat-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); margin-top: 12px; }
  .thread-list { display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .thread { width: auto; flex: none; max-width: 200px; background: var(--card); }
  .thread small { display: none; }
  .admin-chat-layout .chat-card { padding: 10px 0 0; }
  .chat-composer .btn span { display: none; }
  .msg { max-width: 86%; }
  .auth-top { padding: 12px 16px; }
  .auth-body { padding: 32px 16px 48px; }
  .login-grid { grid-template-columns: 1fr; gap: 28px; }
  .login-grid .form + .form { border-left: 0; border-top: 1px solid var(--line); padding: 24px 0 0; }
  .confirm-code-grid { grid-template-columns: 1fr; }
  .form { max-width: none; }
  input, textarea, select, .chat-composer input { font-size: 16px; }
}
