:root {
  color-scheme: dark;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --bg: #0c111b;
  --surface: #141c29;
  --surface-raised: #1b2637;
  --input: #101723;
  --border: #293447;
  --text: #e9eef7;
  --muted: #9cabc0;
  --subtle: #8e9db3;
  --primary: #4167df;
  --primary-hover: #5278ef;
  --green: #85dba9;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button {
  cursor: pointer; border: 1px solid var(--border); background: var(--surface-raised);
  border-radius: 10px; padding: 11px 16px; color: var(--text); font-weight: 550;
  transition: background .15s, border-color .15s;
}
button:hover { background: #25324a; border-color: #3a4d6c; }
button:disabled { opacity: .5; cursor: wait; }
.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
input, select {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; background: var(--input); color: var(--text);
}
input::placeholder { color: var(--subtle); opacity: 1; }
input:focus, select:focus, button:focus-visible { outline: 2px solid #8da9ff; outline-offset: 3px; }
input:-webkit-autofill { -webkit-text-fill-color: var(--text); box-shadow: 0 0 0 1000px var(--input) inset; }
label { display: block; font-size: 14px; }
label input { margin: 8px 0 16px; }
h1, h2, p { margin-top: 0; }
h1 { font-size: 30px; letter-spacing: -1px; margin-bottom: 12px; }
h2 { font-size: 20px; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; line-height: 1.7; }
.eyebrow { font-size: 10px; letter-spacing: 1.7px; font-weight: 700; color: var(--subtle); margin-bottom: 12px; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
header {
  min-height: 84px; border-bottom: 1px solid var(--border); display: flex;
  justify-content: space-between; align-items: center; padding: 16px 36px; background: var(--surface);
}
.brand, .header-right { display: flex; align-items: center; gap: 18px; }
.brand strong { display: block; font-size: 20px; }
.brand .muted { font-size: 12px; }
.logo { width: 50px; height: 50px; background: var(--primary); color: white; border-radius: 15px; display: grid; place-items: center; font-size: 27px; font-weight: 750; }
.logo.small { width: 40px; height: 40px; font-size: 23px; border-radius: 12px; }
.safe { background: #15352b; color: var(--green); border-radius: 30px; padding: 8px 12px; font-size: 12px; }
.quiet { border: 0; background: transparent; color: var(--muted); }
.workspace { display: grid; grid-template-columns: 245px minmax(0, 1fr); min-height: calc(100vh - 84px); }
aside { background: var(--surface); border-right: 1px solid var(--border); padding: 36px 24px; }
.content { padding: 36px; max-width: 1500px; width: 100%; margin: 0 auto; min-width: 0; }
.heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.heading h1 { overflow-wrap: anywhere; }
.heading-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 16px; margin: 20px 0 28px; }
.stats > div { background: var(--surface); border: 1px solid var(--border); border-radius: 15px; padding: 24px; min-width: 0; }
.stats span { color: var(--muted); font-size: 13px; }
.stats strong { display: block; font-size: 30px; letter-spacing: -1px; margin: 14px 0 7px; overflow-wrap: anywhere; }
.stats small { font-size: 11px; color: var(--subtle); }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 20px; }
.search { max-width: 390px; width: 100%; }
.search input { margin: 0; }
.toolbar > span { font-size: 12px; }
.profiles { display: grid; grid-template-columns: repeat(auto-fill,minmax(280px,1fr)); gap: 16px; margin-bottom: 24px; }
.profile { background: var(--surface); border: 1px solid var(--border); border-radius: 15px; padding: 22px; min-width: 0; }
.profile h3 { font-size: 16px; margin: 15px 0 6px; line-height: 1.5; overflow-wrap: anywhere; }
.profile-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bank-icon { background: #3a202c; color: #ff8890; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; flex-shrink: 0; }
.badge { font-size: 10px; background: #212d40; color: #b0bfd3; padding: 6px 8px; border-radius: 7px; }
.badge.good { background: #15352b; color: var(--green); }
.profile .id { font-size: 11px; color: var(--subtle); }
.profile .amount { font-size: 27px; font-weight: 650; margin: 26px 0 6px; overflow-wrap: anywhere; }
.profile .timestamp { font-size: 10px; color: var(--subtle); min-height: 28px; line-height: 1.6; }
.profile .actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.profile button { font-size: 12px; padding: 10px 12px; }
.profile .message { font-size: 11px; color: #e4be77; line-height: 1.6; margin-top: 8px; }
.empty { text-align: center; padding: 50px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 15px; grid-column: 1/-1; color: var(--muted); }
.error { background: #3a2029; border: 1px solid #63313c; border-radius: 10px; padding: 14px; color: #ffacb0; margin-bottom: 16px; font-size: 13px; }
dialog {
  background: var(--surface); color: var(--text); border: 1px solid #3a4861; border-radius: 18px;
  width: min(680px, calc(100% - 30px)); max-height: 85vh; padding: 26px; box-shadow: 0 20px 100px #0008;
}
dialog::backdrop { background: #030711bb; backdrop-filter: blur(5px); }
.dialog-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; }
.dialog-head h2 { overflow-wrap: anywhere; }
.dialog-head button { border: 0; padding: 8px; flex-shrink: 0; }
.methods, .dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0; }
.dialog-actions { margin-bottom: 0; }
#add-dialog { max-width: 550px; }
#add-form > input, #add-form > select { margin: 8px 0 20px; }
.qr { width: 240px; max-width: 100%; margin: 20px auto; display: block; background: white; border: 10px solid white; border-radius: 12px; }
.operation { display: flex; justify-content: space-between; gap: 16px; padding: 17px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.operation > div { min-width: 0; overflow-wrap: anywhere; }
.operation small { display: block; margin-top: 6px; color: var(--subtle); font-size: 11px; }
.operation strong { white-space: nowrap; }
.incoming { color: var(--green); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 30px; background: radial-gradient(ellipse at 50% 0%, #192945 0%, var(--bg) 65%); }
.login-card { background: var(--surface); padding: 42px; border: 1px solid var(--border); border-radius: 22px; max-width: 440px; width: 100%; box-shadow: 0 12px 70px #0004; }
.login-card .logo { margin-bottom: 28px; }
.login-card h1 { font-size: 42px; line-height: 1.12; }
.login-card > .muted { font-size: 14px; line-height: 1.7; margin: 22px 0; }
.login-card button { width: 100%; }
#login-error { font-size: 13px; color: #ffacb0; margin: 14px 0 0; }
@media (max-width: 1000px) {
  .workspace { grid-template-columns: 200px minmax(0, 1fr); }
  .content { padding: 24px; }
  .stats { grid-template-columns: 1fr; gap: 10px; }
  .stats > div { padding: 18px; }
  .stats strong { font-size: 27px; margin: 8px 0; }
  .stats small { display: block; }
.header-right .safe { display: none; }
}
.alarm-controls { display: flex; align-items: center; gap: 8px; }
.alarm-controls button { font-size: 12px; padding: 9px 12px; }
.alarm-notice {
  position: fixed; inset: auto 24px 24px auto; margin: 0; z-index: 10000;
  width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); overflow: auto;
  background: #172536; color: var(--text); border: 1px solid #528db3; border-radius: 16px;
  padding: 20px; box-shadow: 0 18px 70px #0009;
}
.alarm-notice-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.alarm-notice-head > strong { font-size: 17px; }
.alarm-notice-head button { padding: 5px 9px; }
#alarm-payments { max-height: 220px; overflow: auto; }
#alarm-payments p { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 12px; }
#alarm-payments span { overflow-wrap: anywhere; min-width: 0; }
#alarm-payments strong { color: var(--green); white-space: nowrap; }
#alarm-status { margin: 4px 0 12px; }
.alarm-notice-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.alarm-notice-actions button { font-size: 12px; }
@media (max-width: 640px) {
  header { padding: 12px 18px; min-height: 72px; }
  .workspace { display: block; }
  aside { padding: 20px; border-right: 0; border-bottom: 1px solid var(--border); }
  aside h2, aside .eyebrow { display: none; }
  aside #source-date { margin: 8px 0 0; }
  .content { padding: 24px 18px; }
  .heading h1 { font-size: 25px; }
  .heading-actions { width: 100%; }
  .heading-actions button { font-size: 12px; padding: 11px; flex: 1; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats > div:first-child { grid-column: 1/-1; }
  .stats span { font-size: 11px; }
  .profiles { grid-template-columns: 1fr; }
  .login-card { padding: 28px; }
  .operation { font-size: 12px; }
  .operation strong { font-size: 13px; }
  .dialog-actions { flex-direction: column; }
  dialog { padding: 22px; }
  header { flex-wrap: wrap; gap: 14px; }
  .header-right { gap: 8px; flex-wrap: wrap; }
  .alarm-notice { right: 16px; bottom: 16px; padding: 16px; }
}
