@font-face {
  font-family: "Conthrax Sb";
  src: url("/conthrax.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #29252a;
  --ink-deep: #1f1b20;
  --muted: #777378;
  --soft: #f5f5f4;
  --line: #e8e6e7;
  --header: #e1e0e1;
  --yellow: #fbb541;
  --yellow-dark: #e19a23;
  --white: #ffffff;
  --danger: #c84949;
  --success: #2f7a55;
  --shadow: 0 14px 38px rgba(41, 37, 42, .08);
  --radius-lg: 26px;
  --radius-md: 18px;
}

* { box-sizing: border-box; }
[hidden], .hidden { display: none !important; }
html, body {
  width: 100%; max-width: 100%; min-height: 100%; margin: 0; overflow-x: hidden;
  overscroll-behavior-x: none; touch-action: pan-y;
}
html { background: var(--soft); color: var(--ink); }
body {
  min-width: 320px;
  background: radial-gradient(circle at 92% 2%, rgba(251,181,65,.16), transparent 280px), var(--soft);
  color: var(--ink);
  font: 15px/1.45 "Rubik", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-overflow-scrolling: touch;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.startup {
  position: fixed; z-index: 200; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px;
  padding: 34px 24px; background: radial-gradient(circle at 78% 18%, rgba(251,181,65,.2), transparent 260px), rgba(245,245,244,.98);
  font-weight: 700;
}
.startup::before {
  position: absolute; width: min(360px, calc(100% - 36px)); height: 190px; z-index: -1;
  border: 1px solid rgba(41,37,42,.06); border-radius: 24px; background: var(--white); box-shadow: var(--shadow); content: "";
}
.spinner { width: 44px; height: 44px; border: 5px solid #ddd9db; border-top-color: var(--yellow-dark); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth {
  display: grid; width: min(1180px, calc(100% - 36px)); min-height: 100dvh; margin: 0 auto;
  place-items: center; padding: max(44px, env(safe-area-inset-top)) 0 calc(32px + env(safe-area-inset-bottom));
}
.auth-card {
  width: min(520px, 100%); min-width: 0; max-width: 100%; padding: clamp(24px, 5vw, 42px);
  border: 1px solid rgba(41,37,42,.05); border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow);
}
.auth-brand { display: none; }
.auth-card h1 {
  max-width: 100%; margin: 0; font-family: "Conthrax Sb", "Rubik", sans-serif; font-size: clamp(21px,5.5vw,34px);
  font-weight: 600; line-height: 1.08; letter-spacing: -.025em; white-space: nowrap;
}
.auth-card > p { margin: 14px 0 26px; color: var(--muted); line-height: 1.5; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 24px; padding: 5px; border-radius: 14px; background: var(--soft); }
.auth-tab { min-height: 44px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; font-weight: 600; }
.auth-tab.is-active { background: var(--white); box-shadow: 0 5px 16px rgba(41,37,42,.08); }
.stack { display: grid; gap: 17px; }
.register-box { margin: 0; }
.auth-card .button { width: 100%; }
.auth-card #cancel-register { min-height: 46px; }
.error { min-height: 20px; margin-top: 12px; color: var(--danger); font-size: 13px; }

label { display: grid; gap: 9px; min-width: 0; font-size: 14px; font-weight: 600; }
input, select, textarea {
  width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 13px; outline: 0;
  background: #fbfbfb; color: var(--ink); transition: 150ms ease; appearance: none;
}
input, select { height: 56px; padding: 0 16px; }
select { padding-right: 42px; cursor: pointer; }
textarea { min-height: 104px; padding: 15px 16px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--yellow-dark); background: var(--white); box-shadow: 0 0 0 4px rgba(251,181,65,.18); }
label small { color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.45; }

.button {
  display: inline-flex; min-height: 48px; align-items: center; justify-content: center; gap: 10px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--white); color: var(--ink); cursor: pointer;
  font-weight: 600; text-decoration: none; transition: 160ms ease; white-space: nowrap;
}
.button:hover { border-color: var(--ink); transform: translateY(-1px); }
.button.primary { min-height: 58px; padding: 0 24px; border: 0; border-radius: 14px; background: var(--yellow); color: var(--ink-deep); font-weight: 700; }
.button.primary:hover { background: #ffc65f; }
.button.ghost { background: var(--white); }
.button.subtle { min-height: 42px; align-self: center; border-color: transparent; background: transparent; color: var(--muted); font-size: 13px; }
.button.subtle:hover { border-color: var(--line); background: rgba(255,255,255,.6); color: var(--ink); }

.app {
  width: min(1180px, calc(100% - 36px)); max-width: 100%; min-height: 100dvh; margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 0 calc(54px + env(safe-area-inset-bottom)); overflow-x: clip;
}
.topbar {
  position: relative; z-index: 20; display: flex; min-height: 68px; align-items: center; justify-content: space-between;
  padding: 0 20px; border-radius: 20px; background: var(--header);
}
.brand-button { display: flex; align-items: center; gap: 12px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.brand-button img { display: block; width: 40px; height: 40px; object-fit: contain; }
.brand-button span { font-family: "Conthrax Sb", "Rubik", sans-serif; font-size: 20px; font-weight: 600; letter-spacing: .02em; }
.user-menu { display: flex; align-items: center; gap: 10px; }
.profile-button { max-width: 210px; padding: 9px 12px; overflow: hidden; border: 0; border-radius: 999px; background: rgba(255,255,255,.68); color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; transition: 150ms ease; }
.profile-button:hover { background: var(--white); box-shadow: 0 5px 18px rgba(41,37,42,.08); }
.icon-button, .back-button, .close { border: 1px solid rgba(41,37,42,.1); background: transparent; cursor: pointer; font-weight: 600; }
.icon-button { width: auto; min-width: 42px; height: 38px; border-radius: 10px; }
.content { width: 100%; max-width: 100%; margin: 0; padding: 0 6px; }
.view { animation: appear 220ms ease; }
@keyframes appear { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.page-heading { margin: 0 0 30px; padding-top: 62px; }
.page-heading h1 {
  margin: 0; font-family: "Conthrax Sb", "Rubik", sans-serif; font-size: clamp(32px,5vw,58px); font-weight: 600;
  letter-spacing: -.025em; line-height: .98; text-transform: uppercase;
}
.page-heading p { max-width: 620px; margin: 16px 0 0; color: var(--muted); font-size: 17px; line-height: 1.55; }
.with-back { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 16px; padding-top: 26px; }
.with-back h1 { font-size: clamp(28px,4vw,44px); }
.with-back .back-button { min-height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--white); }

.service-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.service-card {
  position: relative; display: flex; min-width: 0; min-height: 240px; padding: 28px; overflow: hidden;
  border: 1px solid rgba(41,37,42,.06); border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow);
  cursor: pointer; flex-direction: column; align-items: flex-start; text-align: left; transition: 180ms ease;
}
.service-card:hover { border-color: rgba(41,37,42,.18); transform: translateY(-3px); }
.service-card::after { position: absolute; right: 26px; bottom: 24px; content: "→"; font-size: 28px; }
.service-icon { display: grid; width: 46px; height: 46px; margin-bottom: 42px; place-items: center; border-radius: 50%; background: var(--yellow); font-weight: 700; }
.accent-vault .service-icon, .accent-notification .service-icon { background: var(--yellow); }
.service-card strong { display: block; max-width: 100%; margin-top: auto; margin-bottom: 10px; font-family: "Conthrax Sb","Rubik",sans-serif; font-size: clamp(22px,3vw,34px); font-weight: 600; line-height: 1; text-transform: uppercase; }
.accent-notification strong { hyphens: auto; overflow-wrap: break-word; }
.service-card small { max-width: calc(100% - 30px); color: var(--muted); font-size: 14px; line-height: 1.5; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.toolbar .button.primary { min-height: 52px; }
.notification-toolbar { align-items: center; }
.export-row { display: flex; justify-content: flex-end; margin-top: 10px; padding: 0 8px; }
.export-link { display: inline-flex; min-height: 30px; align-items: center; gap: 5px; padding: 3px 6px; color: var(--muted); font-size: 12px; font-weight: 500; text-decoration: none; opacity: .68; transition: 150ms ease; }
.export-link span { font-size: 16px; line-height: 1; }
.export-link:hover { color: var(--ink); opacity: 1; }
.summary-row { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; margin-bottom: 18px; }
.summary-row > div { padding: 22px; border-radius: var(--radius-md); background: var(--white); box-shadow: 0 8px 28px rgba(41,37,42,.06); }
.summary-row span { display: block; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.summary-row strong { font-size: clamp(22px,3vw,32px); font-weight: 600; letter-spacing: -.035em; }
.list { display: grid; gap: 8px; padding: clamp(18px,3vw,30px); border: 1px solid rgba(41,37,42,.05); border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow); }
.expense-row, .notification-row { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fbfbfb; }
.row-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.row-title { min-width: 0; }
.row-title strong { display: block; overflow-wrap: anywhere; font-size: 17px; }
.row-title small { display: block; margin-top: 5px; color: var(--muted); }
.amount { flex: 0 0 auto; font-size: 19px; font-weight: 700; white-space: nowrap; }
.row-comment { margin: 11px 0 0; color: #5e5a5f; overflow-wrap: anywhere; }
.row-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.mini-button { display: inline-flex; min-height: 35px; align-items: center; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 600; text-decoration: none; }
.mini-button.unpaid { border-color: rgba(200,73,73,.18); background: #fff0ef; color: #a43d3d; }
.mini-button.paid { border-color: rgba(47,122,85,.18); background: #eef8f1; color: var(--success); }
.empty { min-height: 220px; display: grid; place-items: center; padding: 34px; color: var(--muted); text-align: center; }

.search { position: relative; margin: 0 0 22px; }
.search span { position: absolute; left: 17px; top: 14px; z-index: 1; color: var(--muted); font-size: 20px; }
.search input { padding-left: 46px; background: var(--white); }
.vault-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 14px; padding: clamp(18px,3vw,28px); border: 1px solid rgba(41,37,42,.05); border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow); }
.vault-card { position: relative; display: flex; min-width: 0; min-height: 178px; padding: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--white); cursor: pointer; flex-direction: column; justify-content: space-between; text-align: left; transition: 160ms ease; }
.vault-card::before { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: var(--yellow); content: "↗"; font-family: "Conthrax Sb","Rubik",sans-serif; font-size: 15px; }
.vault-card::after { position: absolute; right: 18px; bottom: 17px; color: var(--muted); content: "→"; font-size: 20px; }
.vault-card:hover { border-color: rgba(41,37,42,.3); transform: translateY(-2px); }
.vault-card strong { display: block; padding-right: 24px; overflow-wrap: anywhere; font-size: 17px; line-height: 1.25; }
.vault-card small { display: none; }
.full { grid-column: 1/-1; }

.dialog { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 20px; border: 0; background: rgba(31,27,32,.58); }
.dialog[open] { display: grid; place-items: center; }
.dialog::backdrop { background: rgba(31,27,32,.58); backdrop-filter: blur(7px); }
.dialog-card { width: min(720px,100%); max-height: min(850px,calc(100dvh - 40px)); margin: auto; padding: clamp(22px,4vw,34px); overflow-y: auto; display: grid; gap: 17px; border-radius: 24px; background: var(--white); box-shadow: 0 30px 90px rgba(31,27,32,.3); scrollbar-width: none; -ms-overflow-style: none; }
.dialog-card::-webkit-scrollbar { width: 0; height: 0; }
.compact-dialog-card { width: min(620px,100%); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 2px; }
.dialog-head h2 { margin: 0; font-family: "Conthrax Sb","Rubik",sans-serif; font-size: clamp(21px,4vw,30px); font-weight: 600; line-height: 1.1; text-transform: uppercase; }
.close { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 50%; font-size: 23px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.dialog-actions .button { min-width: 140px; }
.dialog-actions .button.primary { min-height: 52px; }
.copy-field { display: grid; grid-template-columns: minmax(0,1fr) 56px; gap: 8px; }
.copy-field button { border: 1px solid var(--line); border-radius: 12px; background: var(--white); cursor: pointer; font-size: 20px; }
fieldset { min-width: 0; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
legend { padding: 0 6px; font-size: 14px; font-weight: 600; }
.check-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.check-list label { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 10px; background: var(--soft); }
.check-list input { width: 18px; height: 18px; padding: 0; appearance: auto; }
.danger-row { min-height: 20px; }
.text-danger { padding: 0; border: 0; background: transparent; color: var(--danger); cursor: pointer; font-weight: 700; }
.form-error { min-height: 20px; color: var(--danger); font-size: 13px; line-height: 1.45; }
.form-error:empty { display: none; }
.push-onboarding-card { width: min(440px,100%); justify-items: center; padding: 34px 28px; text-align: center; }
.push-onboarding-card h2 { margin: 0; }
.push-onboarding-card p { margin: 0 0 5px; color: var(--muted); line-height: 1.55; }
.push-onboarding-icon { display: grid; width: 68px; height: 68px; place-items: center; border: 2px solid var(--ink); border-radius: 50%; background: var(--yellow); font-family: "Conthrax Sb","Rubik",sans-serif; font-size: 26px; transform: rotate(-7deg); }
.push-onboarding-card .button { width: 100%; }
.push-later { padding: 5px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.profile-check { display: flex; min-height: 54px; align-items: center; gap: 11px; padding: 0 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--soft); }
.profile-check input { width: 19px; height: 19px; padding: 0; appearance: auto; }
.profile-check span { font-weight: 600; }
.form-hint { margin-top: -10px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.technical-summary { grid-template-columns: repeat(3,minmax(0,1fr)); }
.technical-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; margin-bottom: 26px; }
.technical-panel { display: flex; min-width: 0; padding: 24px; border-radius: var(--radius-md); background: var(--white); box-shadow: var(--shadow); flex-direction: column; align-items: flex-start; }
.technical-panel h2, .technical-users-head h2 { margin: 0; font-family: "Conthrax Sb","Rubik",sans-serif; font-size: 21px; font-weight: 600; text-transform: uppercase; }
.technical-panel p { margin: 10px 0 18px; color: var(--muted); line-height: 1.5; }
.technical-panel > .button { margin-top: auto; }
.technical-form { display: grid; width: 100%; grid-template-columns: minmax(0,1fr) auto; gap: 10px; }
.technical-form .button.primary { min-height: 56px; }
.technical-users-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.technical-users { display: grid; gap: 9px; padding: clamp(14px,3vw,24px); border-radius: var(--radius-lg); background: var(--white); box-shadow: var(--shadow); }
.technical-user { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fbfbfb; }
.technical-user.is-disabled { opacity: .62; }
.technical-user-main > div { display: flex; align-items: center; gap: 8px; }
.technical-user-main strong { font-size: 16px; }
.technical-user-main small { display: block; margin-top: 5px; color: var(--muted); line-height: 1.4; }
.self-badge { padding: 3px 7px; border-radius: 999px; background: var(--yellow); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.technical-user-controls { display: flex; max-width: 430px; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.technical-toggle { display: flex; min-height: 35px; align-items: center; gap: 7px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); font-size: 12px; font-weight: 600; }
.technical-toggle input { width: 17px; height: 17px; padding: 0; appearance: auto; }

.loading { width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 20px; border: 0; background: rgba(31,27,32,.62); backdrop-filter: blur(7px); }
.loading[open] { display: grid; place-items: center; }
.loading::backdrop { background: transparent; }
.loading-card { width: min(390px,100%); padding: 34px 28px; border-radius: 24px; background: var(--white); box-shadow: 0 30px 90px rgba(31,27,32,.3); display: grid; justify-items: center; gap: 15px; text-align: center; }
.loading-card .spinner { width: 76px; height: 76px; border: 9px dashed var(--ink); border-top-color: var(--yellow); background: var(--yellow); }
.loading-card strong { font-size: 20px; }
.toast { position: fixed; z-index: 220; right: 22px; bottom: calc(22px + env(safe-area-inset-bottom)); max-width: min(390px,calc(100% - 32px)); padding: 14px 18px; border-radius: 14px; background: var(--ink); color: var(--white); box-shadow: var(--shadow); }

@media (max-width: 900px) {
  .service-grid { grid-template-columns: 1fr; }
  .service-card { min-height: 200px; }
}

@media (max-width: 780px) {
  .app { width: min(calc(100% - 24px),620px); padding-top: max(12px,env(safe-area-inset-top)); }
  .auth { width: min(calc(100% - 24px),620px); }
  .topbar { min-height: 58px; padding: 0 14px; border-radius: 15px; }
  .brand-button { gap: 9px; }
  .brand-button img { width: 34px; height: 34px; }
  .brand-button span { font-size: 16px; }
  .profile-button { max-width: 125px; }
  .content { padding: 0 2px; }
  .page-heading { padding-top: 38px; }
  .page-heading p { font-size: 15px; }
  .with-back { padding-top: 26px; }
  .with-back .page-heading { padding-top: 0; }
  .vault-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 14px; }
  .vault-card { min-height: 150px; padding: 15px; }
  .vault-card strong { font-size: 15px; }
  .summary-row { grid-template-columns: 1fr 1fr; }
  .dialog-card { max-height: calc(100dvh - 24px); }
  .technical-grid { grid-template-columns: 1fr; }
  .technical-user { grid-template-columns: 1fr; }
  .technical-user-controls { max-width: none; justify-content: flex-start; }
}

@media (max-width: 430px) {
  .app, .auth { width: calc(100% - 16px); }
  .auth { padding-top: max(24px,env(safe-area-inset-top)); }
  .auth-card { padding: 24px 18px; border-radius: 20px; }
  .auth-card h1 { font-size: clamp(19px,6.1vw,26px); }
  .profile-button { max-width: 92px; padding: 8px 10px; }
  .icon-button { min-width: 38px; font-size: 0; }
  .icon-button::after { font-size: 17px; content: "↪"; }
  .page-heading h1 { font-size: clamp(27px,9vw,38px); }
  .with-back { grid-template-columns: 1fr; }
  .with-back .back-button { justify-self: start; }
  .service-card { min-height: 190px; padding: 22px; }
  .service-icon { margin-bottom: 30px; }
  .service-card strong { font-size: 25px; }
  .toolbar { display: grid; grid-template-columns: 1fr; }
  .toolbar .button { width: 100%; }
  .summary-row { gap: 8px; }
  .summary-row > div { padding: 17px; }
  .summary-row strong { font-size: 20px; }
  .list { padding: 15px; border-radius: 20px; }
  .row-top { display: grid; grid-template-columns: 1fr; }
  .amount { grid-row: 1; }
  .vault-grid { padding: 12px; }
  .dialog { padding: 8px; }
  .dialog-card { max-height: calc(100dvh - 16px); padding: 22px 17px calc(22px + env(safe-area-inset-bottom)); border-radius: 20px; }
  .dialog-actions { display: grid; grid-template-columns: 1fr; }
  .dialog-actions .button { width: 100%; }
  .check-list { grid-template-columns: 1fr; }
  .technical-summary { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .technical-summary > div { padding: 14px 10px; }
  .technical-summary span { min-height: 31px; font-size: 11px; }
  .technical-form { grid-template-columns: 1fr; }
  .technical-user-controls { display: grid; grid-template-columns: 1fr; }
  .toast { right: 50%; transform: translateX(50%); }
}

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