/* ==========================================================================
   Titan Pay — merchant console
   ========================================================================== */

:root {
  --ink: #15211c;
  --muted: #66736c;
  --line: #e3e8e1;
  --bg: #f8faf4;
  --green: #0b6f57;
  --green-dark: #054535;
  --mint: #d9f2e6;
  --gold: #d9821f;
  --dark: #0e201a;
  --red: #b3352b;
  --radius-sm: 8px;
  --radius: 12px;
  --pill: 999px;
  --shadow-card: 0 10px 26px rgba(22, 33, 27, .05);
  --shadow-float: 0 24px 60px rgba(21, 33, 28, .16);
  --ease: cubic-bezier(.22, .7, .3, 1);
  --dur: .3s;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
  max-width: 100%;
}

.icon {
  flex: 0 0 auto;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

button {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}

[hidden] {
  display: none !important;
}

/* ---------- shared ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  color: #fff;
  background: var(--green);
  box-shadow: 0 12px 24px rgba(11, 111, 87, .2);
}

.btn-primary:hover {
  background: var(--green-dark);
}

.btn-ghost {
  color: var(--green-dark);
  background: #fff;
  border-color: #cfe3d6;
}

.btn-ghost:hover {
  background: #f2fbf5;
  border-color: #a9d2bd;
}

.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.btn-block {
  width: 100%;
}

.btn-text {
  min-height: 40px;
  color: var(--muted);
  background: none;
}

.btn-text:hover {
  color: var(--green-dark);
  background: #f2f7f2;
}

.btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: #4c5a52;
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}

.icon-btn:hover {
  color: var(--green-dark);
  border-color: #c5ded0;
  background: #f4faf5;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field > span {
  display: block;
  margin-bottom: 6px;
  color: #3d4a43;
  font-size: 13px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #d9e2da;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}

.field textarea {
  height: auto;
  min-height: 90px;
  padding: 10px 12px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(11, 111, 87, .12);
}

.field input::placeholder {
  color: #a2afa7;
}

.form-error {
  margin: 0 0 12px;
  padding: 9px 12px;
  border: 1px solid #f0cfc9;
  border-radius: 8px;
  background: #fdf0ee;
  color: #a33227;
  font-size: 13px;
}

.form-ok {
  margin: 0 0 12px;
  padding: 9px 12px;
  border: 1px solid #bfe3cf;
  border-radius: 8px;
  background: #e8f7ef;
  color: #0a6b4f;
  font-size: 13px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

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

.nowrap {
  white-space: nowrap;
}

/* ---------- login ---------- */

.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr);
}

.login-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px 54px;
  background:
    radial-gradient(circle at 82% 14%, rgba(217, 130, 31, .18), transparent 34%),
    radial-gradient(circle at 8% 88%, rgba(11, 111, 87, .4), transparent 42%),
    var(--dark);
  color: #e7f2eb;
}

.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(217, 242, 230, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(217, 242, 230, .06) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 90%);
  mask-image: linear-gradient(to bottom, #000, transparent 90%);
  pointer-events: none;
}

.login-brand > * {
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.brand img {
  flex: 0 0 auto;
}

.brand small {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #93b3a4;
  line-height: 1.3;
}

.login-copy {
  max-width: 520px;
  margin: 40px 0;
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 18px;
  color: #9fd8bf;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.kicker::before {
  content: "";
  width: 22px;
  height: 1px;
  background: #9fd8bf;
}

.login-copy h1 {
  margin: 0 0 18px;
  color: #fff;
  font-size: clamp(32px, 3.6vw, 46px);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -.02em;
}

.login-copy p {
  margin: 0 0 24px;
  color: #b6c9bf;
  font-size: 15.5px;
  line-height: 1.8;
}

.login-points {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.login-points li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #cfe2d8;
  font-size: 13.5px;
}

.login-points .icon {
  margin-top: 3px;
  color: #5fd3a0;
}

.login-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: #7c9a8b;
  font-size: 12.5px;
}

.login-foot a {
  color: #b6c9bf;
  transition: color .18s var(--ease);
}

.login-foot a:hover {
  color: #fff;
}

.login-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 28px 26px;
  background: var(--bg);
}

.login-card {
  width: min(400px, 100%);
  padding: 34px 32px 30px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-card);
}

.login-heading {
  margin-bottom: 22px;
}

.login-heading h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.login-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.login-step .btn-block + .btn-block {
  margin-top: 6px;
}

.login-help {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.login-help a {
  color: var(--green);
  font-weight: 600;
}

.login-copyright {
  margin: 22px 0 0;
  color: #98a69d;
  font-size: 11.5px;
}

.code-input {
  height: 52px !important;
  letter-spacing: .38em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 20px !important;
  text-align: center;
  padding-left: 20px !important;
}

.bind-qr {
  display: flex;
  justify-content: center;
  margin: 4px 0 14px;
}

.bind-qr svg {
  width: 168px;
  height: 168px;
  border: 8px solid #fff;
  border-radius: 10px;
  box-shadow: 0 0 0 1px var(--line);
}

.bind-tip {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
  text-align: center;
}

.bind-secret {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 9px 12px;
  border: 1px dashed #cfe3d6;
  border-radius: 8px;
  background: #f6fbf7;
  font-size: 12px;
}

.bind-secret span {
  flex: 0 0 auto;
  color: var(--muted);
}

.bind-secret code {
  overflow-wrap: anywhere;
  color: var(--green-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  letter-spacing: .04em;
}

/* ---------- shell ---------- */

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

.side {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px 14px 16px;
  border-right: 1px solid var(--line);
  background: #fff;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.side-brand small {
  display: block;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .14em;
}

.side-nav {
  display: grid;
  gap: 3px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: 9px;
  color: #4e5c54;
  font-size: 14px;
  font-weight: 600;
  transition: background .16s var(--ease), color .16s var(--ease);
}

.side-nav a svg {
  color: #7d8a82;
  transition: color .16s var(--ease);
}

.side-nav a:hover {
  background: #f3f8f3;
  color: var(--green-dark);
}

.side-nav a.is-active {
  color: var(--green-dark);
  background: var(--mint);
}

.side-nav a.is-active svg {
  color: var(--green-dark);
}

.side-docs {
  margin-top: 26px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcf9;
}

.side-docs-title {
  margin-bottom: 8px;
  color: #9aa89f;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.side-docs a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  color: #53625a;
  font-size: 12.5px;
}

.side-docs a:hover {
  color: var(--green);
}

.side-merchant {
  margin-top: auto;
  padding: 14px 12px 4px;
  border-top: 1px solid var(--line);
}

.side-merchant-name {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-merchant-no {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
}

.side-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  padding: 7px 8px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: #718077;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.side-logout:hover {
  color: var(--red);
  background: #fdf3f1;
}

.side-scrim {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(14, 32, 26, .38);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(227, 232, 225, .85);
  background: rgba(248, 250, 244, .92);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.topbar-title {
  min-width: 0;
}

.topbar-title h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.3;
}

.topbar-title p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.balance-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid #cfe3d6;
  border-radius: var(--pill);
  background: #fff;
  color: var(--muted);
  font-size: 11.5px;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}

.balance-chip b {
  color: var(--green-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
}

.balance-chip:hover {
  border-color: #a9d2bd;
  background: #f6fbf7;
}

.only-mobile {
  display: none;
}

.content {
  max-width: 1240px;
  margin: 0 auto;
  padding: 26px 28px 56px;
}

/* ---------- page furniture ---------- */

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

.page-head h2 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.page-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.seg button {
  padding: 5px 11px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #5b6961;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}

.seg button:hover {
  color: var(--green-dark);
}

.seg button.is-active {
  background: var(--green);
  color: #fff;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.panel-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.panel-body {
  padding: 18px;
}

.panel-body--flush {
  padding: 0;
}

/* ---------- KPI ---------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.kpi-value {
  margin: 7px 0 4px;
  font-size: clamp(22px, 2vw, 27px);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.kpi-value small {
  margin-right: 2px;
  color: #8b9890;
  font-size: 14px;
  font-weight: 600;
}

.kpi-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11.5px;
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: var(--pill);
  font-size: 11px;
  font-weight: 700;
}

.delta.up {
  color: #0a6b4f;
  background: #e8f7ef;
}

.delta.down {
  color: #a33227;
  background: #fdf0ee;
}

.delta.flat {
  color: #6b7a71;
  background: #f1f5f1;
}

/* ---------- charts ---------- */

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.chart {
  padding: 16px 18px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.chart-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.chart-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.chart-head span {
  color: var(--muted);
  font-size: 11.5px;
}

.bars {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 118px;
  padding-top: 4px;
  border-bottom: 1px solid var(--line);
}

.bar {
  position: relative;
  flex: 1 1 0;
  min-width: 2px;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  background: #dff0e7;
  transition: background .16s var(--ease);
}

.bar.is-success {
  background: var(--green);
}

.bar:hover {
  background: var(--gold);
}

.bar-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: #98a69d;
  font-size: 10.5px;
}

.bars-empty {
  display: grid;
  place-items: center;
  height: 118px;
  border-bottom: 1px solid var(--line);
  color: #a2afa7;
  font-size: 12px;
}

/* ---------- status distribution ---------- */

.dist {
  display: grid;
  gap: 12px;
}

.dist-bar {
  display: flex;
  overflow: hidden;
  height: 10px;
  border-radius: var(--pill);
  background: #eef3ee;
}

.dist-bar span {
  min-width: 0;
}

.dist-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dist-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.dist-legend b {
  color: var(--ink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: var(--pill);
}

.dot--green { background: var(--green); }
.dot--mint { background: #7cc6a4; }
.dot--gold { background: var(--gold); }
.dot--red { background: #cf5a4a; }
.dot--grey { background: #c6d0c8; }

/* ---------- table ---------- */

.table-wrap {
  overflow-x: auto;
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

.tbl th,
.tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.tbl th {
  background: #f7f9f5;
  color: #758279;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.tbl tbody tr {
  transition: background .14s var(--ease);
}

.tbl tbody tr:hover {
  background: #f8fbf7;
}

.tbl tbody tr.is-clickable {
  cursor: pointer;
}

.tbl tbody tr:last-child td {
  border-bottom: 0;
}

.tbl .num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}

.tbl .strong {
  color: var(--ink);
  font-weight: 600;
}

.tbl .sub {
  display: block;
  margin-top: 1px;
  color: #97a49b;
  font-size: 10.5px;
}

.tbl-empty {
  padding: 40px 16px !important;
  color: #9aa89f;
  font-size: 12.5px;
  text-align: center !important;
}

/* ---------- status pill ---------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid;
  border-radius: var(--pill);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}

.status--ok {
  border-color: #bfe3cf;
  background: #e8f7ef;
  color: #0a6b4f;
}

.status--wait {
  border-color: #efdcb8;
  background: #fdf6e7;
  color: #8a5a12;
}

.status--bad {
  border-color: #f0cfc9;
  background: #fdf0ee;
  color: #a33227;
}

.status--neutral {
  border-color: #dfe7df;
  background: #f2f5f1;
  color: #4f5d55;
}

/* ---------- pagination / toolbar ---------- */

.list-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.list-tools .field {
  margin: 0;
}

.list-tools input,
.list-tools select {
  height: 38px;
  min-width: 140px;
  padding: 0 10px;
  border: 1px solid #d9e2da;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.list-tools input {
  min-width: 210px;
}

.list-tools input:focus,
.list-tools select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(11, 111, 87, .1);
}

.summary-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.summary-line b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.pager-actions {
  display: flex;
  gap: 6px;
}

.pager button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #46544c;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.pager button:hover:not([disabled]) {
  border-color: #b9d8c7;
  color: var(--green-dark);
}

.pager button[disabled] {
  opacity: .45;
  cursor: not-allowed;
}

/* ---------- dashboard extras ---------- */

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 14px;
}

.quick-links {
  display: grid;
  gap: 8px;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  transition: border-color .16s var(--ease), transform .16s var(--ease);
}

.quick-link:hover {
  border-color: #b9d8c7;
  transform: translateY(-1px);
}

.quick-link .qicon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--mint);
  color: var(--green-dark);
}

.quick-link b {
  display: block;
  font-size: 13px;
}

.quick-link span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}

/* ---------- detail modal content ---------- */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 22px;
  margin: 0;
}

.detail-grid > div {
  padding: 9px 0;
  border-bottom: 1px solid #eef2ec;
}

.detail-grid dt {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

.detail-grid dd {
  margin: 0;
  color: var(--ink);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.detail-grid dd.mono {
  font-size: 12.5px;
}

.code-view {
  margin-top: 16px;
}

.code-view h4 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.code-view pre {
  max-height: 320px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border-radius: 9px;
  background: var(--dark);
  color: #d8ebe0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- account ---------- */

.account-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.info-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.info-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #eef2ec;
}

.info-list > div:last-child {
  border-bottom: 0;
}

.info-list dt {
  color: var(--muted);
  font-size: 12.5px;
}

.info-list dd {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.info-list dd.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 500;
}

.form-stack {
  max-width: 380px;
}

.section-note {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.totp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

/* ---------- modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(14, 32, 26, .46);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(680px, 100%);
  max-height: min(86vh, 820px);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-float);
  overflow: hidden;
  animation: pop .22s var(--ease);
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.985);
  }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  z-index: 80;
  max-width: min(92vw, 460px);
  padding: 11px 16px;
  border-radius: 9px;
  background: var(--dark);
  color: #e9f3ed;
  font-size: 13px;
  box-shadow: var(--shadow-float);
  transform: translateX(-50%);
  animation: toast-in .2s var(--ease);
}

.toast.is-error {
  background: #7c2b22;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

/* ---------- loading / empty ---------- */

.loading {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 12.5px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid #dbe6dd;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

.empty {
  padding: 46px 18px;
  color: var(--muted);
  text-align: center;
}

.empty b {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
}

.empty p {
  margin: 0;
  font-size: 12.5px;
}

/* ---------- responsive ---------- */

@media (max-width: 1120px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .login {
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: 300px;
    padding: 32px 28px;
  }

  .login-copy {
    margin: 26px 0 10px;
  }

  .login-copy h1 {
    font-size: 32px;
  }

  .login-foot {
    display: none;
  }

  .login-panel {
    padding: 28px 18px 24px;
  }

  .shell {
    grid-template-columns: 1fr;
  }

  .side {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 248px;
    transform: translateX(-102%);
    transition: transform .24s var(--ease);
    box-shadow: var(--shadow-float);
  }

  .side.is-open {
    transform: none;
  }

  .only-mobile {
    display: inline-flex;
  }

  .topbar {
    padding: 0 16px;
  }

  .content {
    padding: 20px 16px 46px;
  }

  .chart-grid,
  .account-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-wrap: wrap;
    padding: 10px 14px;
    gap: 10px;
  }

  .topbar-title {
    flex: 1 1 auto;
  }

  .topbar-actions {
    width: 100%;
    margin-left: 0;
  }

  .topbar-doc {
    display: none;
  }

  .balance-chip {
    flex: 1 1 auto;
    justify-content: space-between;
  }

  .list-tools input {
    min-width: 0;
    flex: 1 1 160px;
  }

  .summary-line {
    width: 100%;
    margin-left: 0;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .login-copy h1 {
    font-size: 28px;
  }

  .login-card {
    padding: 26px 20px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ---------- refinements ---------- */

.dash-grid {
  align-items: start;
}

.dist-section + .dist-section {
  margin-top: 20px;
}

.dist-title {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.dist-empty {
  margin: 0;
  color: #9aa89f;
  font-size: 12.5px;
}

@media (max-width: 980px) {
  .dash-grid {
    align-items: stretch;
  }
}

.bars {
  justify-content: center;
  gap: 4px;
}

.bar {
  max-width: var(--bar-max, 28px);
}

.bars-single {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  height: 118px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.bars-single b {
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
