/* ─────────────────────────────────────────────────────────────
   Credit Portal — premium monochrome design system
   Font: News Gothic BT (newsgoth_btroman)
   ───────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'newsgoth_btroman';
  src: url('fonts/newsgothicbt.woff2') format('woff2'), url('fonts/newsgothicbt.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'newsgoth_btroman';
  src: url('fonts/newsgothicboldbt.woff2') format('woff2'), url('fonts/newsgothicboldbt.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --white: #ffffff;
  --black: #000000;
  --ink: #0a0a0a;
  --ink-2: #262626;
  --muted: #6b6b6b;
  --muted-2: #8f8f8f;
  --line: #e8e8e8;
  --line-2: #d9d9d9;
  --surface: #fafafa;
  --surface-2: #f3f3f3;
  --surface-3: #ececec;
  --ok: #1f7a4d;
  --ok-bg: #edf7f1;
  --warn: #8a5a00;
  --warn-bg: #fdf6e7;
  --err: #b42318;
  --err-bg: #fdf0ef;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px -12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 24px 64px -24px rgba(0, 0, 0, 0.35);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar: 264px;
  --sidebar-collapsed: 76px;
  --font: 'newsgoth_btroman', 'News Gothic BT', 'News Gothic MT', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--black); color: var(--white); }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86em; letter-spacing: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.upper { text-transform: uppercase; letter-spacing: 0.12em; font-size: 11px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ───────── Buttons ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--black); background: var(--black); color: var(--white);
  font-weight: 700; font-size: 13.5px; letter-spacing: 0.01em; cursor: pointer; white-space: nowrap;
  transition: transform 0.15s var(--ease), background 0.2s, box-shadow 0.2s, opacity 0.2s, border-color 0.2s;
}
.btn:hover { background: var(--ink-2); box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.6); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn.secondary { background: var(--white); color: var(--ink); border-color: var(--line-2); }
.btn.secondary:hover { border-color: var(--black); background: var(--white); box-shadow: var(--shadow-sm); }
.btn.ghost { background: transparent; color: var(--ink); border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn.danger { background: var(--err); border-color: var(--err); }
.btn.danger:hover { background: #8f1c13; }
.btn.danger-outline { background: var(--white); color: var(--err); border-color: #f0c7c3; }
.btn.danger-outline:hover { border-color: var(--err); background: var(--err-bg); box-shadow: none; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { height: 50px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.icon { width: 36px; padding: 0; height: 36px; }
.btn.icon.sm { width: 30px; height: 30px; }

.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── Forms ───────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); letter-spacing: 0.01em; }
.field .hint { font-size: 12px; color: var(--muted); }
.field .error-text { font-size: 12px; color: var(--err); display: flex; gap: 5px; align-items: center; }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 13px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--white); outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.textarea { height: auto; min-height: 110px; padding: 11px 13px; resize: vertical; line-height: 1.55; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; cursor: pointer; }
.input:hover, .select:hover, .textarea:hover { border-color: #bdbdbd; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--black); box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.06); }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--err); box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.07); }
.input:disabled, .input[readonly] { background: var(--surface); color: var(--muted); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > svg.lead { position: absolute; left: 13px; color: var(--muted-2); pointer-events: none; }
.input-wrap > .input { padding-left: 40px; }
.input-wrap > .trail { position: absolute; right: 6px; }
.input-wrap > .input.has-trail { padding-right: 44px; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13.5px; }
.check input { appearance: none; width: 18px; height: 18px; border: 1.5px solid var(--line-2); border-radius: 5px; margin: 0; display: grid; place-items: center; transition: 0.15s; background: var(--white); cursor: pointer; }
.check input:checked { background: var(--black); border-color: var(--black); }
.check input:checked::after { content: ''; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

/* Toggle switch */
.switch { position: relative; width: 40px; height: 23px; flex: none; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 99px; transition: 0.25s var(--ease); cursor: pointer; border: 1px solid var(--line-2); }
.switch span::before { content: ''; position: absolute; width: 17px; height: 17px; left: 2px; top: 2px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: 0.25s var(--ease); }
.switch input:checked + span { background: var(--black); border-color: var(--black); }
.switch input:checked + span::before { transform: translateX(17px); }
.switch input:disabled + span { opacity: 0.5; cursor: not-allowed; }

/* Segmented control */
.segmented { display: inline-flex; padding: 4px; background: var(--surface-2); border-radius: 12px; border: 1px solid var(--line); gap: 2px; }
.segmented button { border: 0; background: transparent; height: 34px; padding: 0 16px; border-radius: 9px; cursor: pointer; font-weight: 700; font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; transition: 0.2s var(--ease); }
.segmented button.active { background: var(--white); color: var(--black); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.segmented.full { display: flex; }
.segmented.full button { flex: 1; justify-content: center; }

/* ───────── Alerts & badges ───────── */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); font-size: 13.5px; }
.alert svg { flex: none; margin-top: 1px; }
.alert.error { background: var(--err-bg); border-color: #f4d2cf; color: var(--err); }
.alert.success { background: var(--ok-bg); border-color: #cfe9da; color: var(--ok); }
.alert.warn { background: var(--warn-bg); border-color: #f2e0b5; color: var(--warn); }
.alert.dark { background: var(--black); border-color: var(--black); color: var(--white); }

.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; border: 1px solid var(--line-2); background: var(--white); color: var(--ink-2); white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.solid { background: var(--black); color: var(--white); border-color: var(--black); }
.badge.ok { color: var(--ok); background: var(--ok-bg); border-color: #cfe9da; }
.badge.warn { color: var(--warn); background: var(--warn-bg); border-color: #f2e0b5; }
.badge.err { color: var(--err); background: var(--err-bg); border-color: #f4d2cf; }
.badge.grey { color: var(--muted); background: var(--surface-2); border-color: var(--line); }

/* ───────── App shell ───────── */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--black); color: var(--white);
  display: flex; flex-direction: column; z-index: 40; transition: width 0.3s var(--ease), transform 0.3s var(--ease);
}
.sidebar .brand { height: 72px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); overflow: hidden; flex: none; }
.logo-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--white); color: var(--black); display: grid; place-items: center; flex: none; font-weight: 700; }
.logo-mark.dark { background: var(--black); color: var(--white); }
.brand-text { white-space: nowrap; line-height: 1.15; }
.brand-text b { display: block; font-size: 15px; letter-spacing: 0.01em; }
.brand-text span { font-size: 11px; color: rgba(255, 255, 255, 0.5); letter-spacing: 0.14em; text-transform: uppercase; }
.nav { flex: 1; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255, 255, 255, 0.35); padding: 14px 12px 6px; white-space: nowrap; overflow: hidden; }
.nav a, .nav button.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 10px;
  color: rgba(255, 255, 255, 0.62); font-size: 13.8px; white-space: nowrap; overflow: hidden; transition: 0.2s var(--ease);
  border: 0; background: transparent; width: 100%; cursor: pointer; text-align: left;
}
.nav a svg, .nav button.nav-item svg { flex: none; }
.nav a:hover, .nav button.nav-item:hover { color: var(--white); background: rgba(255, 255, 255, 0.06); }
.nav a.active { color: var(--black); background: var(--white); font-weight: 700; }
.nav .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--white); color: var(--black); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.nav a.active .count { background: var(--black); color: var(--white); }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, 0.08); flex: none; }
.me-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: rgba(255, 255, 255, 0.05); overflow: hidden; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--white); color: var(--black); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; letter-spacing: 0.02em; }
.avatar.dark { background: var(--black); color: var(--white); }
.avatar.lg { width: 64px; height: 64px; font-size: 21px; }
.me-chip .who { min-width: 0; line-height: 1.25; white-space: nowrap; }
.me-chip .who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.me-chip .who span { font-size: 11.5px; color: rgba(255, 255, 255, 0.5); }

.shell.collapsed .sidebar { width: var(--sidebar-collapsed); }
.shell.collapsed .brand-text, .shell.collapsed .nav-label, .shell.collapsed .nav-section, .shell.collapsed .me-chip .who, .shell.collapsed .nav .count { display: none; }
.shell.collapsed .nav a, .shell.collapsed .nav button.nav-item { justify-content: center; padding: 0; }
.shell.collapsed .brand { justify-content: center; padding: 0; }
.shell.collapsed .me-chip { justify-content: center; background: transparent; }
.shell.collapsed .nav a .dot-badge { position: absolute; top: 8px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--white); }
.nav a .dot-badge { display: none; }
.shell.collapsed .nav a .dot-badge { display: block; }

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; transition: margin-left 0.3s var(--ease); display: flex; flex-direction: column; }
.shell.collapsed .main { margin-left: var(--sidebar-collapsed); }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 72px; display: flex; align-items: center; gap: 14px; padding: 0 32px;
  background: rgba(250, 250, 250, 0.82); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line);
}
.topbar .crumbs { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.topbar .crumbs span { font-size: 11px; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; }
.topbar .crumbs b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line); background: var(--white); display: grid; place-items: center; cursor: pointer; transition: 0.2s; color: var(--ink); flex: none; }
.icon-btn:hover { border-color: var(--black); }
.icon-btn .pip { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--black); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--surface); }
.mobile-only { display: none !important; }
.content { padding: 28px 32px 48px; width: 100%; max-width: 1480px; margin: 0 auto; animation: rise 0.45s var(--ease) backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.scrim { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 27px; letter-spacing: -0.02em; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ───────── Cards ───────── */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 15.5px; }
.card-head p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 20px 22px; }
.grid { display: grid; gap: 18px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }

.stat {
  position: relative; padding: 20px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.stat .top { display: flex; align-items: center; justify-content: space-between; }
.stat .label { font-size: 12.5px; color: var(--muted); font-weight: 700; letter-spacing: 0.02em; }
.stat .ico { width: 38px; height: 38px; border-radius: 11px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink); transition: 0.3s var(--ease); }
.stat:hover .ico { background: var(--black); color: var(--white); }
.stat .value { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin-top: 14px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.stat.dark { background: var(--black); color: var(--white); border-color: var(--black); }
.stat.dark .label, .stat.dark .sub { color: rgba(255, 255, 255, 0.6); }
.stat.dark .ico { background: rgba(255, 255, 255, 0.1); color: var(--white); }
.stat.dark:hover .ico { background: var(--white); color: var(--black); }
.stat.dark::after { content: ''; position: absolute; right: -40px; bottom: -60px; width: 180px; height: 180px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: 0 0 0 30px rgba(255, 255, 255, 0.02), 0 0 0 60px rgba(255, 255, 255, 0.015); }

.quick { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick a, .quick button { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); cursor: pointer; transition: 0.25s var(--ease); text-align: left; font-weight: 700; font-size: 13px; }
.quick a:hover, .quick button:hover { border-color: var(--black); transform: translateY(-2px); box-shadow: var(--shadow); }
.quick .qi { width: 32px; height: 32px; border-radius: 9px; background: var(--black); color: var(--white); display: grid; place-items: center; }

/* ───────── Tables ───────── */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: left; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background 0.15s; }
.table tbody tr:hover { background: #fcfcfc; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .right { text-align: right; }
.table .center { text-align: center; }
.cell-user { display: flex; align-items: center; gap: 11px; min-width: 180px; }
.cell-user .avatar { width: 34px; height: 34px; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.cell-user b { display: block; font-size: 13.5px; }
.cell-user span { font-size: 12px; color: var(--muted); }
.amt-plus { color: var(--ok); font-weight: 700; }
.amt-minus { color: var(--err); font-weight: 700; }
.toolbar { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 220px; max-width: 380px; }
.toolbar .select, .toolbar .input { height: 38px; width: auto; min-width: 140px; }
.toolbar .search .input { width: 100%; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); gap: 10px; flex-wrap: wrap; }
.pager .row { gap: 6px; }

.menu { position: relative; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 60; animation: pop 0.18s var(--ease); }
.menu-pop button, .menu-pop a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: transparent; border-radius: 8px; font-size: 13px; cursor: pointer; text-align: left; color: var(--ink); }
.menu-pop button:hover, .menu-pop a:hover { background: var(--surface-2); }
.menu-pop button.danger { color: var(--err); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ───────── Modal ───────── */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(4px); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade 0.2s ease; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; background: var(--white); border-radius: 18px; box-shadow: var(--shadow-lg); animation: modalIn 0.32s var(--ease); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.wide { max-width: 760px; }
.modal.narrow { max-width: 420px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 0; }
.modal-head h3 { font-size: 18px; }
.modal-head p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.modal-body { padding: 20px 24px 24px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--surface); border-radius: 0 0 18px 18px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ───────── Toasts (top-right) ───────── */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 24px)); pointer-events: none; }
.toast {
  --tone: #000; position: relative; overflow: hidden; pointer-events: auto;
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 16px 16px; border-radius: 14px;
  background: var(--white); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--tone);
  box-shadow: 0 18px 48px -18px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.05); font-size: 13.5px;
  animation: toastIn 0.42s var(--ease) both;
}
.toast.success { --tone: #1f9d55; }
.toast.error { --tone: #d92d20; }
.toast.warning { --tone: #e8890c; }
.toast.info { --tone: #111111; }
.toast .t-ico { color: var(--tone); flex: none; margin-top: 1px; }
.toast .t-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.toast .t-body b { font-size: 14px; }
.toast .t-body span { color: var(--muted); line-height: 1.45; word-break: break-word; }
.toast button { background: none; border: 0; color: var(--muted-2); cursor: pointer; padding: 2px; border-radius: 6px; flex: none; transition: 0.15s; }
.toast button:hover { color: var(--ink); background: var(--surface-2); }
.toast .t-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--tone); opacity: 0.25; transform-origin: left; animation: toastBar linear forwards; }
.toast:hover .t-bar { animation-play-state: paused; }
.toast.leaving { animation: toastOut 0.26s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(28px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(28px) scale(0.97); } }
@keyframes toastBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* Confirmation / alert dialogs */
.dialog .dialog-ico { width: 58px; height: 58px; border-radius: 18px; display: inline-grid; place-items: center; background: var(--black); color: var(--white); animation: popIn 0.4s var(--ease); }
.dialog .dialog-ico.error { background: var(--err-bg); color: var(--err); }
.dialog .dialog-ico.warning { background: var(--warn-bg); color: #c2410c; }
.dialog .dialog-ico.success { background: var(--ok-bg); color: var(--ok); }
.dialog-details { margin-top: 16px; padding: 4px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: left; }
.dialog-details .kv { grid-template-columns: 120px 1fr; }
.dialog-details .kv > div { padding: 8px 0; }
@keyframes popIn { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* Notification dropdown */
.notif-pop { width: min(380px, calc(100vw - 24px)); padding: 0; overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background 0.15s; align-items: flex-start; }
.notif-item:hover { background: var(--surface); }
.notif-item.unread { background: #f6f6f6; }
.notif-item.unread .li-ico { background: var(--black); color: var(--white); }
.notif-item .li-ico { width: 32px; height: 32px; border-radius: 9px; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.notif-item .li-main { flex: 1; min-width: 0; }
.notif-item .li-main b { font-size: 13px; display: block; }
.notif-item .li-main p { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notif-item .li-meta { font-size: 11.5px; color: var(--muted-2); }
.notif-foot { display: flex; justify-content: center; align-items: center; gap: 6px; padding: 12px; font-weight: 700; font-size: 13px; background: var(--surface); }
.notif-foot:hover { background: var(--surface-2); }
.icon-btn.on { border-color: var(--black); }
.icon-btn svg.ring { animation: ring 2.4s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes ring { 0%, 86%, 100% { transform: rotate(0); } 88% { transform: rotate(14deg); } 92% { transform: rotate(-12deg); } 96% { transform: rotate(6deg); } }

/* Upcoming expirations strip */
.upcoming { display: flex; gap: 10px; padding: 16px 22px 20px; overflow-x: auto; }
.up-item { flex: none; min-width: 130px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--white); cursor: pointer; transition: 0.2s var(--ease); text-align: left; }
.up-item b { font-size: 20px; letter-spacing: -0.02em; }
.up-item:hover { border-color: var(--black); transform: translateY(-2px); box-shadow: var(--shadow); }

/* Reports */
.report-card { display: flex; flex-direction: column; gap: 14px; }
.report-card .r-ico { width: 44px; height: 44px; border-radius: 13px; background: var(--black); color: var(--white); display: grid; place-items: center; }
.report-card .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.report-card .filters .input, .report-card .filters .select { height: 38px; }

/* Audit diffs */
.diff { display: inline-block; padding: 3px 7px; border-radius: 7px; line-height: 1.45; word-break: break-word; }
.diff.old { background: var(--err-bg); color: #8f1c13; text-decoration: line-through; text-decoration-color: rgba(180, 35, 24, 0.35); }
.diff.new { background: var(--ok-bg); color: #155c39; }

/* ───────── Empty / loading ───────── */
.empty { padding: 48px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ei { width: 52px; height: 52px; border-radius: 15px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink); }
.empty b { color: var(--ink); font-size: 15px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.loading-block { display: grid; place-items: center; padding: 60px; color: var(--muted); }

/* ───────── Progress / charts ───────── */
.progress { height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--black); border-radius: 99px; transition: width 1s var(--ease); }
.progress.lg { height: 14px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .bar { transition: opacity 0.2s; }
.chart-tip { position: absolute; pointer-events: none; background: var(--black); color: #fff; font-size: 12px; padding: 8px 10px; border-radius: 9px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: var(--shadow-lg); z-index: 5; line-height: 1.5; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; padding: 13px 22px; border-bottom: 1px solid var(--line); align-items: flex-start; transition: background 0.15s; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: #fcfcfc; }
.list-item .li-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; flex: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-main b { font-size: 13.5px; display: block; }
.list-item .li-main p { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.list-item .li-meta { font-size: 11.5px; color: var(--muted-2); white-space: nowrap; }

.kv { display: grid; grid-template-columns: 170px 1fr; gap: 0; }
.kv > div { padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 13.8px; }
.kv > div:nth-child(odd) { color: var(--muted); font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em; }
.kv > div:nth-last-child(-n + 2) { border-bottom: 0; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 22px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 14px 4px; margin-right: 18px; font-weight: 700; font-size: 13.5px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: 0.2s; }
.tabs button.active { color: var(--black); border-bottom-color: var(--black); }

.cred-box { border: 1px dashed var(--line-2); border-radius: 14px; background: var(--surface); padding: 6px 16px; }
.cred-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cred-row:last-child { border-bottom: 0; }
.cred-row .k { width: 120px; font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; flex: none; }
.cred-row .v { flex: 1; font-size: 14px; word-break: break-all; font-weight: 700; }

.pw-rules { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-top: 4px; }
.pw-rules div { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; transition: color 0.2s; }
.pw-rules div.ok { color: var(--ok); }
.strength { display: flex; gap: 4px; margin-top: 4px; }
.strength i { flex: 1; height: 4px; border-radius: 4px; background: var(--surface-3); transition: background 0.3s; }
.strength i.on { background: var(--black); }

.ann { padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; gap: 14px; }
.ann:last-child { border-bottom: 0; }
.ann.unread { background: linear-gradient(90deg, #f6f6f6, var(--white) 40%); }
.ann .ann-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--black); color: var(--white); display: grid; place-items: center; flex: none; }
.ann h4 { font-size: 15px; }
.ann .body { white-space: pre-wrap; color: var(--ink-2); margin-top: 8px; font-size: 13.8px; line-height: 1.65; }

.hero-card { background: var(--black); color: var(--white); border-radius: 18px; padding: 28px; position: relative; overflow: hidden; }
.hero-card::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px); background-size: 36px 36px; mask-image: radial-gradient(ellipse at 85% 0%, #000 0%, transparent 70%); }
.hero-card > * { position: relative; }
.hero-card .muted { color: rgba(255, 255, 255, 0.6); }
.hero-card .progress { background: rgba(255, 255, 255, 0.14); }
.hero-card .progress > span { background: var(--white); }

/* ───────── Login ───────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.08fr 1fr; background: var(--white); }
.auth-art { position: relative; background: var(--black); color: var(--white); padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.auth-art .grid-bg { position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px); background-size: 48px 48px; mask-image: radial-gradient(ellipse at 30% 40%, #000 10%, transparent 75%); animation: drift 30s linear infinite; }
@keyframes drift { to { background-position: 48px 48px; } }
.auth-art .orb { position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.12); }
.auth-art .orb.o1 { width: 520px; height: 520px; right: -180px; bottom: -160px; animation: float 14s ease-in-out infinite; }
.auth-art .orb.o2 { width: 340px; height: 340px; right: -90px; bottom: -70px; border-color: rgba(255, 255, 255, 0.2); animation: float 10s ease-in-out infinite reverse; }
.auth-art .orb.o3 { width: 160px; height: 160px; right: 0; bottom: 20px; background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.02)); border-color: rgba(255, 255, 255, 0.3); animation: float 8s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-14px, -18px); } }
.auth-art > * { position: relative; }
.auth-art h1 { font-size: clamp(34px, 3.6vw, 54px); line-height: 1.05; letter-spacing: -0.035em; max-width: 520px; }
.auth-art h1 em { font-style: normal; color: rgba(255, 255, 255, 0.45); }
.auth-art .lead { color: rgba(255, 255, 255, 0.62); max-width: 440px; margin-top: 18px; font-size: 15.5px; line-height: 1.6; }
.auth-feats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 560px; }
.auth-feats div { padding: 14px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 13px; background: rgba(255, 255, 255, 0.03); backdrop-filter: blur(6px); font-size: 12.5px; color: rgba(255, 255, 255, 0.7); }
.auth-feats svg { display: block; margin-bottom: 10px; color: var(--white); }
.auth-feats b { display: block; color: var(--white); font-size: 13.5px; margin-bottom: 2px; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 24px; position: relative; }
.auth-card { width: 100%; max-width: 420px; animation: rise 0.6s var(--ease) both; }
.auth-card h2 { font-size: 30px; letter-spacing: -0.03em; }
.auth-card .sub { color: var(--muted); margin-top: 6px; margin-bottom: 26px; }
.auth-foot { position: absolute; bottom: 22px; left: 0; right: 0; text-align: center; font-size: 12px; color: var(--muted-2); }
.link-btn { background: none; border: 0; padding: 0; font-weight: 700; cursor: pointer; font-size: 13px; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); transition: text-decoration-color 0.2s; }
.link-btn:hover { text-decoration-color: var(--black); }
.shake { animation: shake 0.42s var(--ease); }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }

.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--surface); }

/* ───────── Responsive ───────── */
@media (max-width: 1200px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.main-side { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 340px; padding: 32px 28px; gap: 28px; }
  .auth-feats { display: none; }
    .auth-form-side { padding: 40px 20px 70px; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar) !important; box-shadow: var(--shadow-lg); }
  .shell.mobile-open .sidebar { transform: none; }
  .shell.collapsed .brand-text, .shell.collapsed .nav-label, .shell.collapsed .nav-section, .shell.collapsed .me-chip .who, .shell.collapsed .nav .count { display: revert; }
  .shell.collapsed .nav a, .shell.collapsed .nav button.nav-item { justify-content: flex-start; padding: 0 12px; }
  .shell.collapsed .brand { justify-content: flex-start; padding: 0 20px; }
  .main, .shell.collapsed .main { margin-left: 0; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 35; animation: fade 0.2s; }
  .mobile-only { display: grid !important; }
  .desktop-only { display: none !important; }
  .topbar { padding: 0 16px; height: 64px; }
  .content { padding: 20px 16px 40px; }
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .kv { grid-template-columns: 1fr; }
  .kv > div:nth-child(odd) { padding-bottom: 0; border-bottom: 0; }
  .page-head h1 { font-size: 23px; }
}
@media (max-width: 560px) {
  .grid.cols-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 15px; }
  .stat .value { font-size: 23px; }
  .stat .ico { width: 32px; height: 32px; }
  .toolbar .search { max-width: none; }
  .toolbar .select, .toolbar .input { flex: 1; }
  .pw-rules { grid-template-columns: 1fr; }
  .modal-back { padding: 10px; place-items: end center; }
  .toasts { top: 10px; right: 12px; left: 12px; width: auto; }
  .modal { border-radius: 18px 18px 14px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ───────────── Credit popup (simple) ───────────── */
.modal.simple { max-width: 460px; }
.cm-bal { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.cm-bal span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.cm-bal b { font-size: 22px; letter-spacing: -0.02em; }
.cm-bal .r { text-align: right; }
.cm-input { height: 50px; font-size: 20px; font-weight: 600; }
.cm-quick { display: flex; gap: 8px; margin-top: 10px; }
.cm-quick button { flex: 1; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--white); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color 0.15s, background 0.15s, color 0.15s; }
.cm-quick button:hover { border-color: #000; }
.cm-quick button.on { background: #000; border-color: #000; color: #fff; }
.cm-switch { align-self: center; background: none; border: 0; font: inherit; font-size: 12.5px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 2px; }
.cm-switch:hover { color: #000; }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }
@media (max-width: 640px) { .detail-grid { grid-template-columns: 1fr; } }

/* Users list: row actions */
.ua { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.ua-credit { display: inline-flex; height: 34px; border: 1px solid #000; border-radius: 10px; overflow: hidden; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06); }
.ua-credit button { display: inline-flex; align-items: center; gap: 6px; padding: 0 14px; border: 0; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: background 0.15s, color 0.15s; }
.ua-add { background: #000; color: #fff; }
.ua-add:hover { background: #2a2a2a; }
.ua-minus { background: #fff; color: #000; border-left: 1px solid #000 !important; }
.ua-minus:hover { background: #f1f1f1; }
.ua-icon { position: relative; width: 34px; height: 34px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: #000; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.ua-icon:hover { border-color: #000; background: #f6f6f6; }
.ua-icon::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translate(-50%, 4px); background: #000; color: #fff; font-size: 11.5px; font-weight: 600; padding: 4px 8px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s; z-index: 5; }
.ua-icon:hover::after, .ua-icon:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.ua-icon:last-child::after { left: auto; right: 0; transform: translateY(4px); }
.ua-icon:last-child:hover::after, .ua-icon:last-child:focus-visible::after { transform: none; }

/* User dashboard: credit instructions */
.ci-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.ci-group-title { font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.ci-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ci-list li { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); transition: border-color 0.15s; }
.ci-list li:hover { border-color: #000; }
.ci-ico { flex: none; width: 36px; height: 36px; border-radius: 10px; background: #000; color: #fff; display: grid; place-items: center; }
.ci-list b { display: block; font-size: 14.5px; }
.ci-list p { margin: 3px 0 0; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.ci-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ci-tag { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.ci-tag.dark { background: #000; color: #fff; border-color: #000; }
.ci-note { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface); font-size: 13px; color: var(--muted); border-radius: 0 0 16px 16px; }
@media (max-width: 900px) { .ci-groups { grid-template-columns: 1fr; gap: 20px; } }

/* User "View" popup */
.uv-balance { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 14px; background: #000; color: #fff; margin-bottom: 14px; }
.uv-ico { width: 40px; height: 40px; border-radius: 11px; background: rgba(255, 255, 255, 0.12); display: grid; place-items: center; flex: none; }
.uv-balance span { display: block; font-size: 12px; opacity: 0.65; }
.uv-balance b { display: block; font-size: 28px; letter-spacing: -0.02em; line-height: 1.15; }
.uv-balance small { display: block; font-size: 12px; opacity: 0.6; margin-top: 2px; }
.uv-list { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.uv-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 16px; }
.uv-row + .uv-row { border-top: 1px solid var(--line); }
.uv-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.uv-value { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
/* User Management: access control buttons */
.ac-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

/* Activity Logs: compact table */
.log-table { table-layout: fixed; width: 100%; }
.log-table td { vertical-align: top; padding-top: 12px; padding-bottom: 12px; }
.log-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.log-clip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-ip { font-size: 11px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-target { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-weight: 600; }
.log-change { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.log-change .diff { max-width: 100%; }
@media (max-width: 900px) { .log-table { table-layout: auto; min-width: 760px; } }

/* ───────── Login: right side ───────── */
.auth-form-side { flex-direction: column; background: var(--white); background-image: radial-gradient(rgba(0, 0, 0, 0.07) 1px, transparent 1px); background-size: 22px 22px; background-position: -11px -11px; }
.auth-form-side::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at center, var(--white) 38%, rgba(255, 255, 255, 0.6) 70%, rgba(255, 255, 255, 0)); pointer-events: none; }
.auth-form-side > * { position: relative; }
.af-top { position: absolute; top: 26px; left: 36px; right: 36px; display: flex; justify-content: space-between; align-items: center; }
.af-brand { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.af-dot { width: 7px; height: 7px; border-radius: 50%; background: #000; }
.af-help { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none; transition: border-color 0.15s; }
.af-help:hover { border-color: #000; }
.auth-card { max-width: 400px; }
.af-badge { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: #000; color: #fff; box-shadow: 0 12px 24px -12px rgba(0, 0, 0, 0.55); margin-bottom: 14px; }
.auth-card h2 { font-size: 25px; }
.auth-form-side .auth-card .sub { margin-bottom: 18px; }
.role-switch { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 5px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 18px; }
.role-switch button { position: relative; z-index: 1; height: 36px; border: 0; background: none; border-radius: 999px; font: inherit; font-weight: 700; font-size: 13.5px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; transition: color 0.25s; }
.role-switch button.active { color: #fff; }
.rs-thumb { position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px); border-radius: 999px; background: #000; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.6); transition: transform 0.3s var(--ease); }
.role-switch.admin .rs-thumb { transform: translateX(100%); }
.auth-card .input { border-radius: 14px; }
.auth-card .btn.lg { height: 48px; border-radius: 14px; }
.af-or { display: flex; align-items: center; gap: 12px; margin-top: 4px; font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-2); }
.af-or::before, .af-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.af-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 9px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.af-note svg { flex: none; margin-top: 1px; color: var(--ink); }
@media (max-width: 1024px) { .af-top { position: static; width: 100%; max-width: 400px; margin-bottom: 26px; } }
.auth-form-side > .auth-foot { position: absolute; }
/* User Management: password status + actions */
.pw-status { display: inline-flex; align-items: flex-start; gap: 7px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; line-height: 1.3; text-align: left; }
.pw-status svg { margin-top: 1px; flex: none; }
.pw-status b { display: block; font-size: 12.5px; }
.pw-status small { display: block; color: var(--muted); font-size: 11.5px; }
.pw-status.warn { background: var(--warn-bg); border-color: #f5d6a8; color: #8a4b0f; }
.pw-status.warn small { color: #a2611f; }
.pw-status.ok { background: var(--ok-bg); border-color: #bfe5cf; color: #155c39; }
.pw-status.ok small { color: #2f7a52; }
.ac-pw { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid #000; background: #000; color: #fff; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background 0.15s; }
.ac-pw:hover { background: #2a2a2a; }
.ua-icon.danger { color: var(--err); }
.ua-icon.danger:hover { border-color: var(--err); background: var(--err-bg); }
.uv-sub { display: block; font-size: 12px; font-weight: 500; color: var(--ok); }
/* Login: right side card */
.af-wrap { width: 100%; max-width: 432px; display: flex; flex-direction: column; align-items: center; }
.af-card { width: 100%; max-width: none; background: var(--white); border: 1px solid var(--line); border-radius: 24px; padding: 28px 30px 22px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 30px 60px -30px rgba(0, 0, 0, 0.28); position: relative; }
.af-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.af-head .af-badge { margin-bottom: 0; width: 40px; height: 40px; border-radius: 12px; }
.af-greet { font-size: 13px; font-weight: 600; color: var(--muted); padding: 5px 11px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); }
.af-submit .af-arrow { transition: transform 0.2s var(--ease); }
.af-submit:hover:not(:disabled) .af-arrow { transform: translateX(4px); }
.af-trust { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 16px; padding-top: 4px; font-size: 12px; color: var(--muted); }
.af-trust span { display: inline-flex; align-items: center; gap: 5px; }
.af-below { margin: 16px 0 0; max-width: 360px; text-align: center; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
@media (max-width: 480px) { .af-card { padding: 22px 18px 18px; border-radius: 20px; } }

/* ---- Table headers: clearer, all tables ---- */
.table th { font-size: 12px; letter-spacing: 0.06em; color: var(--ink); font-weight: 800; background: var(--surface-2); border-bottom: 2px solid var(--line-2); padding-top: 14px; padding-bottom: 14px; }
.table thead tr th:first-child { border-top-left-radius: 0; }

/* ---- Credit Management: actions sit a little left ---- */
.table th.col-actions, .table td.col-actions { text-align: left; padding-left: 8px; padding-right: 28px; }
.ua.ua-left { justify-content: flex-start; }

/* ---- Activity Logs: Device column ---- */
.log-device { display: flex; align-items: center; gap: 9px; min-width: 0; }
.log-device .ld-ico { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }

/* ---- Credit popup: user name clearly visible ---- */
.modal-head p .cm-who { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.cm-who b { font-size: 15px; font-weight: 700; color: var(--ink); }
.cm-who span { font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }

/* ---- Login left side: "Credit Management" heading ---- */
.aa-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 10px; border-radius: 999px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.78); background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14); backdrop-filter: blur(6px); }
.aa-pill-dot { width: 7px; height: 7px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.18); }
.auth-art h1.aa-title { margin-top: 20px; font-size: clamp(40px, 4.4vw, 64px); line-height: 1; letter-spacing: -0.045em; font-weight: 800; }
.aa-grad { background: linear-gradient(100deg, #ffffff 0%, #c7c7c7 45%, #6b6b6b 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.aa-steps { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.aa-steps span { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: rgba(255, 255, 255, 0.82); padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.1); }
.aa-steps b { font-size: 11px; color: rgba(255, 255, 255, 0.45); font-weight: 700; letter-spacing: 0.06em; }

/* ---- Sidebar: support email (user + admin panels) ---- */
.sb-support { display: flex; align-items: center; gap: 10px; padding: 9px 10px; margin-bottom: 10px; border-radius: 12px; color: #fff; text-decoration: none; border: 1px solid rgba(255, 255, 255, 0.12); background: rgba(255, 255, 255, 0.03); transition: background .2s, border-color .2s; overflow: hidden; }
.sb-support:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.22); }
.sb-support-ico { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(255, 255, 255, 0.1); }
.sb-support-text { min-width: 0; line-height: 1.25; white-space: nowrap; }
.sb-support-text small { display: block; font-size: 11px; color: rgba(255, 255, 255, 0.55); }
.sb-support-text b { display: block; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.shell.collapsed .sb-support { justify-content: center; border-color: transparent; background: transparent; padding: 6px; }
.shell.collapsed .sb-support-text { display: none; }

/* ---- Login left side: credit dashboard copy ---- */
.auth-art h1.aa-title { font-size: clamp(38px, 4vw, 58px); line-height: 1.04; max-width: 600px; }
.auth-art .lead { max-width: 520px; font-size: 15px; }
.aa-dash-title { display: block; font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.5); margin-bottom: 12px; font-weight: 700; }
.aa-dash .auth-feats { max-width: 640px; }
.aa-dash .auth-feats div { font-size: 12px; line-height: 1.5; color: rgba(255, 255, 255, 0.62); }
@media (max-width: 900px) { .aa-dash { display: none; } }

/* ---- Login left side: aligned column (logo top, content centred, one width) ---- */
.auth-art { justify-content: flex-start; }
.aa-hero, .aa-dash { width: 100%; max-width: 600px; }
.aa-hero { margin-top: auto; }
.aa-dash { margin-top: 44px; margin-bottom: auto; }
.auth-art .aa-hero .lead { max-width: 100%; margin-top: 20px; }
.auth-art h1.aa-title { margin-top: 22px; max-width: 100%; }
.aa-dash .auth-feats { max-width: 100%; gap: 14px; }
.aa-dash .auth-feats div { padding: 16px; background: rgba(12, 12, 12, 0.72); border-color: rgba(255, 255, 255, 0.14); display: flex; flex-direction: column; }
.aa-dash .auth-feats svg { margin-bottom: 12px; }
.aa-dash .auth-feats b { margin-bottom: 4px; }

/* ---- Login right side: no top bar, "Need help?" under the card ---- */
.af-help-bottom { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; padding: 8px 16px 8px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); color: var(--muted); font-size: 13px; text-decoration: none; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); transition: border-color 0.15s, color 0.15s; }
.af-help-bottom b { color: var(--ink); font-weight: 600; }
.af-help-bottom:hover { border-color: #000; color: var(--ink); }
.ahb-ico { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #000; color: #fff; flex: none; }
.auth-form-side { padding-bottom: 64px; }

/* ---- Login left side: compact dashboard tiles (title only) ---- */
.aa-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.aa-tiles > div { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 14px; background: rgba(12, 12, 12, 0.72); border: 1px solid rgba(255, 255, 255, 0.14); backdrop-filter: blur(6px); transition: border-color .2s, background .2s; }
.aa-tiles > div:hover { border-color: rgba(255, 255, 255, 0.3); background: rgba(24, 24, 24, 0.8); }
.aa-tile-ico { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #fff; color: #000; }
.aa-tiles b { font-size: 14px; line-height: 1.25; color: #fff; }
@media (max-width: 1180px) { .aa-tiles { grid-template-columns: 1fr; max-width: 320px; } }

/* ---- Login right side: bigger Welcome Back card ---- */
.af-wrap { max-width: 500px; }
.af-card { padding: 38px 40px 30px; border-radius: 28px; }
.af-card h2 { font-size: 30px; }
.af-card .sub { font-size: 15px; }
.af-card .input, .af-card .input-wrap .input { height: 52px !important; font-size: 15px; }
.af-card .af-submit { height: 54px; font-size: 16px; }
.af-card .af-trust { font-size: 12.5px; padding-top: 8px; }
@media (max-width: 480px) { .af-card { padding: 24px 20px 20px; } .af-card h2 { font-size: 25px; } }

/* ---- PHP version helpers ---- */
[hidden] { display: none !important; }
.brand-mark { display: none; }
.shell.collapsed .brand-mark { display: block; }
.nav form { margin: 0; }
.nav form .nav-item { width: 100%; }
.menu-pop form { margin: 0; }
/* User Management: temporary password shown until the user changes it */
.pw-temp { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 9px; background: var(--warn-bg); border: 1px solid #f5d6a8; color: #8a4b0f; font-size: 13px; }
.pw-temp .mono { font-weight: 700; letter-spacing: 0.02em; }
.pw-temp-note { display: block; margin-top: 4px; font-size: 11.5px; color: var(--muted); }

/* ---- Busy overlay ("Please wait") ---- */
.busy-overlay { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: rgba(255, 255, 255, 0.72); backdrop-filter: blur(6px); animation: fade 0.2s ease; }
.busy-card { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 30px 38px 26px; border-radius: 22px; background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: modalIn 0.3s var(--ease); min-width: 280px; text-align: center; }
.busy-ring { position: relative; width: 64px; height: 64px; }
.busy-ring::before, .busy-ring::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 4px solid transparent; }
.busy-ring::before { border-color: var(--surface-3); }
.busy-ring::after { border-top-color: #000; border-right-color: #000; animation: spin 0.8s linear infinite; }
.busy-ring span { position: absolute; inset: 0; display: grid; place-items: center; color: #000; animation: busyPulse 1.2s ease-in-out infinite; }
.busy-card b { font-size: 16px; }
.busy-card small { color: var(--muted); font-size: 12.5px; }
.busy-dots i { display: inline-block; width: 6px; height: 6px; margin: 0 3px; border-radius: 50%; background: #000; animation: busyDot 1s ease-in-out infinite; }
.busy-dots i:nth-child(2) { animation-delay: 0.15s; } .busy-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes busyPulse { 0%, 100% { transform: scale(0.9); opacity: 0.7; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes busyDot { 0%, 100% { transform: translateY(0); opacity: 0.35; } 50% { transform: translateY(-5px); opacity: 1; } }

/* Row that just changed */
tr.row-flash > td { animation: rowFlash 2.6s ease; }
tr.row-flash .pw-temp { animation: pwPop 0.6s var(--ease); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18); }
@keyframes rowFlash { 0%, 30% { background: #fff7e6; } 100% { background: transparent; } }
@keyframes pwPop { 0% { transform: scale(0.85); opacity: 0; } 60% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }

/* ---- Success popup ---- */
.success-pop { text-align: center; padding: 34px 28px 10px; }
.success-check { width: 76px; height: 76px; margin: 0 auto; border-radius: 50%; background: var(--ok); display: grid; place-items: center; position: relative; animation: popIn 0.45s var(--ease); }
.success-check::after { content: ''; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid var(--ok); opacity: 0; animation: ring 1.4s ease-out 0.2s; }
.success-check svg { width: 40px; height: 40px; }
.success-check path { stroke: #fff; stroke-width: 3.2; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw 0.5s ease 0.3s forwards; }
.success-pop h3 { font-size: 21px; margin-top: 18px; }
.success-pop .sp-who { display: inline-flex; flex-direction: column; gap: 2px; margin-top: 12px; padding: 10px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.success-pop .sp-who b { font-size: 15px; } .success-pop .sp-who span { font-size: 13px; color: var(--muted); }
.success-pop p { color: var(--muted); margin-top: 12px; font-size: 13.5px; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 130; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: confetti 1.8s ease-in forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes ring { 0% { opacity: 0.8; transform: scale(0.9); } 100% { opacity: 0; transform: scale(1.35); } }
@keyframes confetti { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(105vh) rotate(720deg); opacity: 0.2; } }

/* ---- Login: one screen, no page scroll on desktop (copyright line removed) ---- */
@media (min-width: 1025px) {
  html:has(.auth), body:has(.auth) { height: 100%; overflow: hidden; }
  .auth { height: 100vh; min-height: 0; overflow: hidden; }
  .auth-art { height: 100vh; padding-top: clamp(24px, 5vh, 48px); padding-bottom: clamp(24px, 5vh, 48px); }
  .auth-form-side { height: 100vh; padding: clamp(16px, 3vh, 40px) 24px; overflow-y: auto; }
  .af-help-bottom { margin-top: clamp(10px, 2vh, 18px); }
}
@media (min-width: 1025px) and (max-height: 820px) {
  .af-card { padding: 26px 34px 22px; }
  .af-card h2 { font-size: 26px; }
  .af-card .input, .af-card .input-wrap .input { height: 46px !important; }
  .af-card .af-submit { height: 48px; }
  .auth-art h1.aa-title { font-size: clamp(32px, 3.4vw, 50px); }
  .aa-dash { margin-top: 28px; }
}
