* { box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }

body{
  margin: 0;
  overflow: hidden;
  background: #0b0c10;
  color: #e9ecf1;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Fixed gradient backdrop so it never "resets" when scrolling */
body::before{
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 800px at 20% -10%, rgba(124,92,255,.25), transparent 60%),
    radial-gradient(800px 500px at 90% 10%, rgba(24,184,255,.18), transparent 55%),
    #0b0c10;
}

.app{
  min-height: 100vh;
  min-height: 100dvh;
  min-height: 100svh;
  height: 100vh;
  height: 100dvh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

main{
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  padding: 0px 0px calc(72px + env(safe-area-inset-bottom));
}

.wireframe{
  flex: 1;
  min-height: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)),
    #121420;
  border: 1px dashed rgba(255,255,255,.18);
  box-shadow: 0 12px 35px rgba(0,0,0,.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.wf-head{
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,.10);
  background: rgba(15,17,26,.55);
  backdrop-filter: blur(10px);
}

.wf-top{
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

/* Force slots so username never drifts to the middle when the admin switch is hidden */
.screen{
  grid-column: 1;
  justify-self: start;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .2px;
}

.admin-mode-wrap{
  grid-column: 2;
  justify-self: center;
  display: none;
  align-items: center;
  justify-content: center;
}

.admin-mode-wrap.show{
  display: flex;
}

.pill{
  grid-column: 3;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(18,20,32,.55);
  border-radius: 999px;
  color: #9aa3b2;
  font-size: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  white-space: nowrap;
}

.pill.admin{
  color: rgba(255, 120, 120, .98);
  border-color: rgba(255, 100, 100, .35);
  background: rgba(255, 90, 90, .10);
}

/* iOS style switch */
.switch{
  position: relative;
  width: 46px;
  height: 26px;
  display: inline-block;
}

.switch.small{
  width: 44px;
  height: 24px;
}

.switch input{
  opacity: 0;
  width: 0;
  height: 0;
}

.slider{
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  transition: background .12s ease, border-color .12s ease;
}

.slider::before{
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.92);
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(0,0,0,.35);
  transition: transform .14s ease;
}

.switch.small .slider::before{
  height: 18px;
  width: 18px;
}

.switch input:checked + .slider{
  background: rgba(124,92,255,.35);
  border-color: rgba(124,92,255,.55);
}

.switch input:checked + .slider::before{
  transform: translate(20px, -50%);
}

.switch.small input:checked + .slider::before{
  transform: translate(18px, -50%);
}

.wf-controls{
  margin-top: 5px;
  display: grid;
  gap: 5px;
}

.wf-body{
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Layout helpers */
.center{
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.content{
  width: 100%;
}

.content.fullheight{
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Panels / cards */
.panel{
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  padding: 16px;
}

.panel.narrow{
  max-width: 520px;
}

.panel-title{
  font-size: 16px;
  font-weight: 750;
  letter-spacing: .2px;
  margin-bottom: 6px;
}

.panel-sub{
  color: #9aa3b2;
  font-size: 13px;
  margin-bottom: 0;
  line-height: 1.35;
}

.role{
  color: rgba(255, 160, 160, .95);
  font-weight: 650;
}

/* Form layout */
.field{
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

/* Inputs / prevent iOS tap-zoom */
label{
  font-size: 12px;
  color: #9aa3b2;
}

input, select, textarea{
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background-color: rgba(10,12,18,.55);
  color: #e9ecf1;
  padding: 11px 12px;
  outline: none;
  font-size: 14px;
}

input, select{
  min-height: 44px;
}

/* Custom select arrow (mobile-safe) */
select{
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;

  padding-right: 42px;

  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%23e9ecf1' d='M5.6 7.8a1 1 0 0 1 1.4.1L10 11.3l3-3.4a1 1 0 1 1 1.5 1.3l-3.7 4.1a1.2 1.2 0 0 1-1.8 0L5.5 9.2a1 1 0 0 1 .1-1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
}

textarea{
  resize: none;
  min-height: 120px;
}

.details-box{
  height: 150px;
}

input:focus, select:focus, textarea:focus{
  border-color: rgba(124,92,255,.65);
  box-shadow: 0 0 0 4px rgba(124,92,255,.16);
}

/* Request page flex stack (top / stretch / bottom) */
.request-form{
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.request-form .req-top{
  flex: 0 0 auto;
}

.request-form .req-mid{
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.request-form .field-stretch{
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.request-form .field-stretch textarea{
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.request-form .details-box{
  height: 100%;
}

.request-form .req-bottom{
  flex: 0 0 auto;
}


.payment-draft-form{
  flex: 0 0 auto;
  min-height: auto;
  height: auto;
}

.payment-draft-form .req-mid{
  flex: 0 0 auto;
  min-height: auto;
}

.payment-draft-form .field-stretch{
  min-height: 0;
}

.payment-draft-form .details-box{
  min-height: 150px;
  height: 150px;
}

.payment-draft-form .payment-preview{
  flex: 0 0 auto;
}

/* Amount toggle (Admin) */
.amount-wrap{
  position: relative;
}

.amount-wrap.with-toggle{
  position: relative;
}

.amount-input.admin{
  padding-left: 56px;
}

.neg-toggle{
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 48px;
  border-radius: 12px 0 0 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: #e9ecf1;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.neg-toggle:active{
  transform: scale(.99);
}

/* Buttons */
.btn{
  appearance: none;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,.04);
  color: #e9ecf1;
  font-weight: 650;
  letter-spacing: .2px;
  cursor: pointer;
  width: 100%;
  transition: transform .08s ease, background .12s ease, border-color .12s ease, opacity .12s ease;
}

.btn:active{ transform: scale(.99); }

.btn.primary{
  border-color: rgba(124,92,255,.45);
  background: rgba(124,92,255,.22);
}

.btn.ghost{
  width: auto;
  padding: 10px 12px;
  border-radius: 12px;
}

.btn.danger{
  border-color: rgba(255, 90, 90, .26);
  background: rgba(255, 90, 90, .10);
}

.btn:hover{
  background: rgba(255,255,255,.06);
}

.btn.primary:hover{
  background: rgba(124,92,255,.28);
}

.btn.danger:hover{
  background: rgba(255, 90, 90, .14);
}

.btn:disabled{
  opacity: .55;
  cursor: not-allowed;
}

/* Errors only */
.message{
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
}

.message .message-inner{
  padding: 12px 12px;
  font-size: 13px;
  line-height: 1.35;
}

.message.error{
  border-color: rgba(255, 90, 90, .28);
  background: rgba(255, 90, 90, .09);
}

.message.success{
  border-color: rgba(110, 214, 150, .28);
  background: rgba(110, 214, 150, .10);
}

/* Loading */
.loading{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px;
}

.loading-text{
  color: #9aa3b2;
  font-size: 13px;
}

.spinner{
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: rgba(255,255,255,.65);
  animation: spin .9s linear infinite;
}

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

/* Controls */
.controls-row{
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}

.controls-row.single{
  grid-template-columns: 1fr;
}

/* History layout */
.history-grid{
  display: grid;
  grid-template-columns: 1fr 70px;
  gap: 10px;
  align-items: end;
}

.inprog-stack{
  height: 44px;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.hg-check{
  width: 100%;
  height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* label top, switch bottom */
  align-items: center;
}

.hg-label{
  font-size: 12px;
  color: #9aa3b2;
  line-height: 1;
}

.hg-center{
  text-align: center;
}

/* Search row */
.controls-row.history-search{
  grid-template-columns: 1fr 70px;
}

.search{
  position: relative;
  display: flex;
  align-items: center;
}

.search input{
  padding-right: 40px;
  height: 44px;
}

.btn-search{
  width: 84px;
  height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
}

.search .clear{
  position: absolute;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: #e9ecf1;
  cursor: pointer;
  line-height: 1;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}

.search .clear:active{
  transform: scale(.98);
}

/* Summaries */
.summary-grid{
  display: grid;
  gap: 10px;
}

.summary-grid.two{
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-grid.three{
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat{
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  padding: 4px 8px;
  min-width: 0;
}

.stat-k{
  color: #9aa3b2;
  font-size: 12px;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-v{
  font-weight: 750;
  letter-spacing: .2px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-title{
  margin-top: 12px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #9aa3b2;
  letter-spacing: .2px;
  font-weight: 700;
  text-transform: uppercase;
}

.admin-login-summary{
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.stat.wide{
  grid-column: 1 / -1;
}

.period-login-summary{
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.stat.stat-select select{
  width: 100%;
  min-width: 0;
}

.stat-v-select{
  display: block;
}

.admin-page-list .card{
  gap: 10px;
}

.compact-list{
  gap: 10px;
}

.admin-row{
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.admin-row-main{
  min-width: 0;
}

.admin-row-title{
  font-weight: 700;
}

.admin-row-sub{
  margin-top: 4px;
  color: #9aa3b2;
  font-size: 12px;
}

.admin-row-actions{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, auto));
  gap: 8px;
}

.admin-row-input{
  width: 100%;
}

.readonly-row{
  grid-template-columns: minmax(0, 1fr);
}

@media (max-width: 520px){
  .admin-row{
    grid-template-columns: 1fr;
  }
  .admin-row-actions{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


/* Lists & cards */
.list{
  display: grid;
  gap: 12px;
}

.card{
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  padding: 14px;
}

/* History: colour budget title by status for ALL users */
.hist-card.st-in-progress .title-link{ color: rgba(255, 220, 120, .95); }
.hist-card.st-resolved .title-link{ color: rgba(170, 255, 220, .95); }
.hist-card.st-rejected .title-link{ color: rgba(255, 170, 170, .95); }

.card-top{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.card-title{
  font-weight: 750;
  letter-spacing: .2px;
}

.title-link{
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
  font: inherit;
  letter-spacing: inherit;
}

.title-link:focus{
  outline: none;
  text-decoration: underline;
}

.status{
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.10);
  color: #9aa3b2;
  background: rgba(255,255,255,.02);
  white-space: nowrap;
}

.status.in-progress{
  border-color: rgba(255, 205, 60, .24);
  background: rgba(255, 205, 60, .08);
  color: rgba(255, 220, 120, .95);
}

.status.resolved{
  border-color: rgba(60, 230, 160, .24);
  background: rgba(60, 230, 160, .08);
  color: rgba(170, 255, 220, .95);
}

.status.rejected{
  border-color: rgba(255, 90, 90, .26);
  background: rgba(255, 90, 90, .08);
  color: rgba(255, 170, 170, .95);
}

.kv{
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.kv-row{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.kv-k{
  color: #9aa3b2;
  font-size: 12px;
}

.kv-v{
  font-size: 13px;
  text-align: right;
}

.kv-row.kv-input .kv-v{
  width: 62%;
  min-width: 0;
}

.kv-row.kv-input input,
.kv-row.kv-input select{
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

/* Admin inline edit fields (left aligned + consistent sizing) */
.inline-input{
  width: 140px;
  max-width: 100%;
  min-width: 0;
  text-align: left;
  height: 34px;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 13px;
}

.inline-select{
  width: 140px;
  max-width: 100%;
  min-width: 0;
  text-align: left;
  height: 34px;
  min-height: 34px;
  padding: 7px 34px 7px 10px;
  border-radius: 12px;
  font-size: 13px;
}

.fixed-box{
  width: 140px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.fixed-center{
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

/* Date icon colour (desktop/webkit) */
input[type="date"]{
  color-scheme: dark; /* helps native parts match your dark UI */
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  padding-right: 42px;
  line-height: 1.2;
}

input[type="date"]::-webkit-date-and-time-value{
  text-align: left;
}

input[type="date"]::-webkit-calendar-picker-indicator{
  opacity: 1;
}

.money.red{ color: rgba(255, 140, 140, .95); }
.money.amber{ color: rgba(255, 220, 120, .95); }
.money.green{ color: rgba(140, 255, 210, .95); }
.money.neutral{ color: #e9ecf1; }

.details{
  border-top: 1px solid rgba(255,255,255,.10);
  padding-top: 10px;
}

.details-k{
  color: #9aa3b2;
  font-size: 12px;
  margin-bottom: 6px;
}

.details-v{
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.actions{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.actions.actions-3{
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

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

.empty{
  border-radius: 16px;
  border: 1px dashed rgba(255,255,255,.18);
  background: rgba(255,255,255,.02);
  padding: 18px;
  text-align: center;
}

.empty-title{
  font-weight: 750;
  margin-bottom: 6px;
}

.empty-sub{
  color: #9aa3b2;
  font-size: 13px;
}

/* Admin budget edit fields */
.admin-top{
  align-items: flex-start;
}

.title-input{
  width: 100%;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: .2px;
  padding: 10px 12px;
}

.create-card .panel-title{ margin-bottom: 10px; }

/* Bottom tab bar */
nav.tabbar{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  height: calc(72px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(15,17,26,.82);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 -10px 30px rgba(0,0,0,.28);
}

.tabs{
  height: 72px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  align-items: center;
  width: 100%;
}

.tab{
  appearance: none;
  border: 0;
  background: transparent;
  color: #9aa3b2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  letter-spacing: .2px;
  cursor: pointer;
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  min-width: 0;
}

.tab:disabled{
  opacity: .52;
  cursor: not-allowed;
}

.tab-label{
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
}

.tab .icon{
  width: 32px;
  height: 32px;
  display: block;
  background-color: currentColor;

  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;

  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;

  opacity: .95;
  transition: transform .12s ease, opacity .12s ease;
}

.icon-login{
  -webkit-mask-image: url("../images/login.svg");
  mask-image: url("../images/login.svg");
}
.icon-request{
  -webkit-mask-image: url("../images/request.svg");
  mask-image: url("../images/request.svg");
}
.icon-history{
  -webkit-mask-image: url("../images/history.svg");
  mask-image: url("../images/history.svg");
}
.icon-payments{
  -webkit-mask-image: url("../images/pound.svg");
  mask-image: url("../images/pound.svg");
}
.icon-budgets{
  -webkit-mask-image: url("../images/budgets.svg");
  mask-image: url("../images/budgets.svg");
}
.icon-admin{
  -webkit-mask-image: url("../images/cog.svg");
  mask-image: url("../images/cog.svg");
}

.tab[aria-current="page"]{
  color: #e9ecf1;
}

.tab[aria-current="page"] .icon{
  opacity: 1;
  transform: translateY(-1px);
}

.tab:active .icon{
  transform: translateY(0px) scale(.96);
}

/* Accessibility */
.sr-only{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Small screens */
@media (max-width: 520px){
  input, select, textarea{ font-size: 16px; } /* prevents iOS auto-zoom */
  .summary-grid{ gap: 8px; }
  .stat-k{ font-size: 11px; }
  .stat-v{ font-size: 12px; }

  .history-grid{ grid-template-columns: 1fr 70px; }
  .controls-row.history-search{ grid-template-columns: 1fr 70px; }
  .btn-search{ width: 76px; }

  /* iPhone: prevent date/select overflow in admin inline fields */
  .fixed-box{ width: 100%; }
  .inline-input{ width: 100%; }
  .inline-select{ width: 100%; }
}

/* Short viewports */
@media (max-height: 640px){
  main{
    padding: 0px 0px calc(66px + env(safe-area-inset-bottom));
  }
  nav.tabbar{
    height: calc(66px + env(safe-area-inset-bottom));
  }
  .tabs{ height: 66px; }
  .tab .icon{
    width: 30px;
    height: 30px;
  }
}

/* ---- Admin History: make inline fields truly uniform (iPhone/Safari date inputs) ---- */

/* Allow the right-hand value column to shrink (fixes iPhone overhang/clipped corners) */
.admin-card .kv-row.kv-input .kv-v,
.admin-card .fixed-box{
  min-width: 0;
}

/* Override the global min-height:44px so inline fields can actually be 34px tall */
.admin-card .inline-input,
.admin-card .inline-select,
.admin-card .status-select{
  height: 34px;
  min-height: 34px;
}

/* Left align values in inline inputs (including Amount / dates etc) */
.admin-card .inline-input{
  width: 100%;
  min-width: 0;
  text-align: left;
}

/* iOS: the visible date text is drawn in this pseudo-element */
.admin-card .inline-input[type="date"]::-webkit-date-and-time-value{
  text-align: left;
  margin: 0;
  padding: 0;
}


/* Login: bring first section title (Budget Summary) up without affecting global headings */
#loggedInPanel .section-title:first-of-type{
  margin-top: 0;
}

/* Budgets (Admin): remove extra bottom space under the admin action buttons without impacting other 3-button rows */
.admin-budget .admin-actions-row{
  margin-bottom: 0;
}





/* --- Force white calendar icon in Admin History date fields (desktop) --- */
.admin-card .inline-input[type="date"]{
  /* draw our own icon */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%23e9ecf1' d='M7 2a1 1 0 0 1 1 1v1h8V3a1 1 0 1 1 2 0v1h1a3 3 0 0 1 3 3v13a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V7a3 3 0 0 1 3-3h1V3a1 1 0 0 1 1-1zm13 8H4v10a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V10zM5 6a1 1 0 0 0-1 1v1h16V7a1 1 0 0 0-1-1H5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;

  -webkit-appearance: none;
  appearance: none;
  position: relative;
  height: 34px;
  min-height: 34px;
  line-height: 20px;
  padding: 7px 34px 7px 10px;
  text-align: left;
}

/* hide the native icon but keep the click-target (Chrome/Edge/Safari) */
.admin-card .inline-input[type="date"]::-webkit-calendar-picker-indicator{
  opacity: 0;
  display: block;
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* ---- History: Reminder button beside Amount Spent / Amount Owed ---- */
.history-summary-row{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: stretch;
}


.stat-square{
  width: 70px;
  min-width: 70px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .08s ease, background .12s ease, border-color .12s ease, opacity .12s ease;
}

.stat-square:hover{ background: rgba(255,255,255,.05); }
.stat-square:active{ transform: scale(.99); }

.stat-square:disabled{
  opacity: .55;
  cursor: not-allowed;
}

.stat-square:disabled .reminder-icon{
  background-color: #474545;
}

.reminder-icon{
  width: 22px;
  height: 22px;
  display: block;
  background-color: #e9ecf1;

  -webkit-mask-image: url("../images/reminder.svg");
  mask-image: url("../images/reminder.svg");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

@media (max-width: 520px){
  .stat-square{ width: 70px; min-width: 70px; }
}


.actions.actions-1{
  grid-template-columns: minmax(0, 1fr);
}

.btn-inline{
  min-height: 36px;
  padding: 8px 12px;
}

.danger-inline{
  border-color: rgba(255, 100, 100, .35);
}

.guest-layout main{
  padding: 0;
}

.guest-layout .wf-head,
.guest-layout nav.tabbar{
  display: none;
}

.guest-layout .wireframe{
  border: 0;
  box-shadow: none;
  background: transparent;
}

.guest-layout .wf-body{
  padding: 0;
}

.req-top-request{
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.request-amount-row{
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.request-amount-presets{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, auto));
  gap: 8px;
}

.preset-btn{
  min-width: 68px;
}

.filter-banner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}

.filter-banner-text,
.card-subtle{
  color: #9aa3b2;
  font-size: 13px;
}

.selected-request{
  box-shadow: 0 0 0 1px rgba(124,92,255,.55), 0 12px 35px rgba(0,0,0,.35);
}

.btn.is-selected{
  border-color: rgba(124,92,255,.65);
  background: rgba(124,92,255,.28);
}


.select-clear-wrap{
  position: relative;
}

.select-clear-wrap.has-value select{
  background-image: none;
}

.select-clear-wrap .select-clear{
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #9aa3b2;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
}

.select-clear-wrap .select-clear:disabled{
  display: none;
}

.select-clear-wrap.has-value .select-clear{
  opacity: 1;
  pointer-events: auto;
}

.neg-toggle.active{
  border-color: rgba(255, 90, 90, .28);
  background: rgba(255, 90, 90, .12);
  color: #ffd6d6;
}

.history-body-wrap{
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.history-list-with-action{
  padding-bottom: 92px;
}

.history-actionbar-slot{
  position: sticky;
  bottom: -14px;
  z-index: 3;
  margin: auto -14px -14px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(18,20,32,0) 0%, rgba(18,20,32,.88) 28%, rgba(18,20,32,.97) 100%);
  backdrop-filter: blur(10px);
}

.inline-amount-wrap{
  width: 100%;
}

.payment-inline-details{
  margin: -2px 0 10px;
}

.payment-inline-details .payment-details-input{
  min-height: 90px;
}

.app-modal-actions .btn{
  width: 100%;
}

.history-actionbar{
  display: grid;
  grid-template-columns: 28% 45% 25%;
  gap: 8px;
}

.history-actionbar.static-bar{
  position: relative;
  z-index: 1;
}

.history-actionbar .btn{
  width: 100%;
}

.locked-money{
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(10,12,18,.35);
}

.payment-form-top{
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.payment-preview,
.payment-section,
.payment-requests{
  border-top: 1px solid rgba(255,255,255,.10);
  padding-top: 10px;
}

.payment-request-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.payment-request-row.compact{
  padding: 8px 0;
}

.payment-request-main{
  min-width: 0;
}

.payment-request-budget{
  font-weight: 650;
}

.payment-request-meta,
.payment-requests-empty{
  color: #9aa3b2;
  font-size: 13px;
}

.budget-badge{
  min-width: 80px;
  justify-content: center;
}

@media (max-width: 700px){
  .req-top-request,
  .payment-form-top{
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px){
  .request-amount-row{
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .request-amount-presets{
    grid-template-columns: repeat(2, minmax(0, auto));
    gap: 6px;
  }

  .preset-btn{
    min-width: 58px;
    padding-left: 10px;
    padding-right: 10px;
  }

  
.select-clear-wrap{
  position: relative;
}

.select-clear-wrap.has-value select{
  background-image: none;
}

.select-clear-wrap .select-clear{
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #9aa3b2;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
}

.select-clear-wrap .select-clear:disabled{
  display: none;
}

.select-clear-wrap.has-value .select-clear{
  opacity: 1;
  pointer-events: auto;
}

.neg-toggle.active{
  border-color: rgba(255, 90, 90, .28);
  background: rgba(255, 90, 90, .12);
  color: #ffd6d6;
}

.history-body-wrap{
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.history-list-with-action{
  padding-bottom: 92px;
}

.history-actionbar-slot{
  position: sticky;
  bottom: -14px;
  z-index: 3;
  margin: auto -14px -14px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(18,20,32,0) 0%, rgba(18,20,32,.88) 28%, rgba(18,20,32,.97) 100%);
  backdrop-filter: blur(10px);
}

.inline-amount-wrap{
  width: 100%;
}

.payment-inline-details{
  margin: -2px 0 10px;
}

.payment-inline-details .payment-details-input{
  min-height: 90px;
}

.app-modal-actions .btn{
  width: 100%;
}

.history-actionbar{
    grid-template-columns: 30% 35% 35%;
    gap: 8px;
  }
}


.payment-details-input{
  width: 100%;
  min-height: 110px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(10,12,18,.35);
  color: inherit;
  padding: 10px 12px;
}

.app-modal-overlay{
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(6,8,14,.68);
  backdrop-filter: blur(6px);
}

.app-modal{
  width: min(100%, 420px);
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: #121420;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  padding: 16px;
}

.app-modal-head{
  margin-bottom: 12px;
}

.app-modal-body{
  display: grid;
  gap: 12px;
}

.app-modal-actions{
  margin-top: 14px;
}

.dialog-open{
  overflow: hidden;
}


/* ---- v4 UI fixes ---- */
.request-form .req-bottom.actions.actions-2{
  margin-bottom: 0 !important;
}

.select-clear-wrap{
  position: relative;
}

.select-clear-wrap select{
  padding-right: 40px;
}

.select-clear-wrap.has-value select{
  background-image: none;
}

.select-clear-wrap .select-clear{
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: #e9ecf1;
  cursor: pointer;
  line-height: 1;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
  z-index: 2;
}

.select-clear-wrap .select-clear:active{
  transform: translateY(-50%) scale(.98);
}

.select-clear-wrap.has-value .select-clear{
  opacity: 1;
  pointer-events: auto;
}

.neg-toggle.active{
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: #e9ecf1;
}

.history-list-with-action{
  padding-bottom: 120px;
}

.history-actionbar-slot{
  position: fixed !important;
  left: 14px;
  right: 14px;
  bottom: calc(72px + env(safe-area-inset-bottom) + 10px);
  z-index: 11;
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
  backdrop-filter: none !important;
  pointer-events: none;
}

.history-actionbar-slot .history-actionbar{
  pointer-events: auto;
}

.history-actionbar{
  display: grid;
  grid-template-columns: 28% 45% 25% !important;
  gap: 8px;
  align-items: stretch;
}

.history-actionbar .btn{
  width: 100%;
}

.payment-details-box{
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(10,12,18,.35);
  color: #e9ecf1;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.35;
  white-space: pre-wrap;
}

.payment-adjustment-notes{
  margin-top: -2px;
}

.budget-badge.status.in-progress{
  border-color: rgba(255, 205, 60, .24);
  background: rgba(255, 205, 60, .08);
  color: rgba(255, 220, 120, .95);
}

.app-modal-actions.actions-1,
.app-modal-actions.actions-2{
  display: grid;
  gap: 10px;
}

.app-modal-actions.actions-2{
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.app-modal-actions .btn{
  width: 100%;
}

@media (max-width: 520px){
  .history-actionbar{
    grid-template-columns: 28% 45% 25% !important;
  }
}


/* ---- v5 targeted UI fixes ---- */
.budget-badge{
  min-width: 0 !important;
  width: auto !important;
  justify-content: flex-start !important;
}

.history-details-box{
  width: 100%;
}

.payment-adjustment-notes .details-k{
  margin-bottom: 8px;
}

.payment-adjustment-notes.admin{
  margin-top: 10px;
}

.payment-adjustment-notes:not(.admin) .payment-details-box{
  width: 100%;
}


/* ---- v6 targeted UI fixes ---- */
.history-actionbar{
  background: rgba(18,20,32,.96);
  border: 1px solid rgba(255,255,255,.12);
  border-top: 1px solid rgba(255,255,255,.22);
  border-radius: 16px;
  box-shadow: 0 -6px 18px rgba(0,0,0,.22);
  padding: 10px;
}

.payment-adjustment-notes{
  margin-top: 10px;
  margin-bottom: 12px;
}

.payment-adjustment-notes:not(.admin) .payment-details-box,
.history-details-box{
  background: #ffffff;
  color: #111111;
  border-color: rgba(0,0,0,.08);
}

/* ---- v7 targeted UI fixes ---- */
.history-actionbar-slot{
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: calc(72px + env(safe-area-inset-bottom)) !important;
  z-index: 11;
  margin: 0 !important;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom)) !important;
  background: rgba(24, 27, 40, .98) !important;
  border-top: 1px solid rgba(255,255,255,.14) !important;
  backdrop-filter: none !important;
  pointer-events: auto !important;
}

.history-actionbar-slot .history-actionbar{
  pointer-events: auto;
}

.history-actionbar{
  display: grid;
  grid-template-columns: 28% 45% 25% !important;
  gap: 8px;
  align-items: stretch;
  width: 100%;
  background: transparent !important;
  border: 0 !important;
  border-top: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}

/* ---- v9 periods/admin refinements ---- */
.pill.is-clickable{
  cursor: pointer;
}

#loginPeriodSelect{
  min-height: 34px;
  padding-top: 0;
  padding-bottom: 0;
}

.no-margin-form{
  margin-bottom: 0 !important;
}

.admin-form-actions{
  margin-top: 4px;
  margin-bottom: 0 !important;
}


/* ---- v9.6 layout/input fixes ---- */
.kv-row.kv-input .kv-v > input[type="date"],
#paymentDatePaid,
.payment-card .inline-input[type="date"],
#newPeriodStart,
#newPeriodEnd,
#editPeriodStart,
#editPeriodEnd{
  width: 100%;
  max-width: 100%;
}

.history-actionbar-slot{
  padding-bottom: 10px !important;
}


/* ---- v9.6.1 final fixes ---- */
.payment-form-top .field,
.create-card .kv-row.kv-input .kv-v,
.payment-card .kv-row.kv-input .kv-v{
  min-width: 0;
}

#paymentDatePaid,
#newPeriodStart,
#newPeriodEnd,
#editPeriodStart,
#editPeriodEnd,
.payment-card .inline-input[type="date"]{
  display: block;
  inline-size: 100%;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

@supports (-webkit-touch-callout: none) {
  #paymentDatePaid,
  #newPeriodStart,
  #newPeriodEnd,
  #editPeriodStart,
  #editPeriodEnd,
  .payment-card .inline-input[type="date"]{
    -webkit-appearance: none;
    appearance: none;
    height: 34px;
    min-height: 34px;
    line-height: 18px;
    padding: 7px 38px 7px 10px;
  }

  #paymentDatePaid::-webkit-date-and-time-value,
  #newPeriodStart::-webkit-date-and-time-value,
  #newPeriodEnd::-webkit-date-and-time-value,
  #editPeriodStart::-webkit-date-and-time-value,
  #editPeriodEnd::-webkit-date-and-time-value,
  .payment-card .inline-input[type="date"]::-webkit-date-and-time-value{
    text-align: left;
    margin: 0;
    padding: 0;
    min-width: 0;
  }
}


/* ---- v9.6.2 admin field consistency ---- */
.admin-page-list .kv-row.kv-input .kv-v,
.admin-page-list .fixed-box{
  min-width: 0;
}

.admin-page-list .kv-row.kv-input input,
.admin-page-list .kv-row.kv-input select,
.admin-page-list .inline-select{
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  padding: 11px 12px;
  font-size: 14px;
  line-height: 1.2;
  border-radius: 12px;
  text-align: left;
}

.admin-page-list .kv-row.kv-input select,
.admin-page-list .inline-select{
  padding-right: 42px;
}

.admin-page-list .fixed-box{
  width: 100%;
  max-width: 100%;
}

.admin-page-list .inline-select{
  display: block;
}

.admin-page-list input[type="date"]{
  appearance: none;
  -webkit-appearance: none;
}


/* ---- v9.6.3 admin date inputs: match standard field height/font on iPhone ---- */
.admin-page-list input[type="date"]{
  display: block;
  inline-size: 100%;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  padding: 11px 42px 11px 12px;
  font-size: 14px;
  line-height: 1.2;
  border-radius: 12px;
  text-align: left;
}

@supports (-webkit-touch-callout: none) {
  .admin-page-list input[type="date"]{
    -webkit-appearance: none;
    appearance: none;
    height: 44px;
    min-height: 44px;
    line-height: 20px;
    padding: 11px 42px 11px 12px;
  }

  .admin-page-list input[type="date"]::-webkit-date-and-time-value{
    text-align: left;
    margin: 0;
    padding: 0;
  }
}

@media (max-width: 520px){
  .admin-page-list input[type="date"]{
    font-size: 16px;
  }
}


/* ---- v9.6.4 iPhone admin date fields: force native inner wrappers to match normal inputs ---- */
.admin-page-list input[type="date"]{
  box-sizing: border-box;
  font: inherit;
  font-family: inherit;
  font-weight: 400;
  background-clip: padding-box;
}

@supports (-webkit-touch-callout: none) {
  .admin-page-list input[type="date"]{
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
    font: inherit;
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
  }

  .admin-page-list input[type="date"]::-webkit-datetime-edit,
  .admin-page-list input[type="date"]::-webkit-date-and-time-value,
  .admin-page-list input[type="date"]::-webkit-datetime-edit-fields-wrapper{
    min-height: 20px;
    height: 20px;
    line-height: 20px;
    display: flex;
    align-items: center;
    padding: 0;
    margin: 0;
    font: inherit;
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    color: inherit;
    box-sizing: border-box;
  }

  .admin-page-list input[type="date"]::-webkit-datetime-edit-year-field,
  .admin-page-list input[type="date"]::-webkit-datetime-edit-month-field,
  .admin-page-list input[type="date"]::-webkit-datetime-edit-day-field,
  .admin-page-list input[type="date"]::-webkit-datetime-edit-text{
    padding: 0;
    margin: 0;
    font: inherit;
    font-family: inherit;
    font-size: 14px;
    line-height: 20px;
  }
}

@media (max-width: 520px){
  @supports (-webkit-touch-callout: none) {
    .admin-page-list input[type="date"],
    .admin-page-list input[type="date"]::-webkit-datetime-edit,
    .admin-page-list input[type="date"]::-webkit-date-and-time-value,
    .admin-page-list input[type="date"]::-webkit-datetime-edit-fields-wrapper,
    .admin-page-list input[type="date"]::-webkit-datetime-edit-year-field,
    .admin-page-list input[type="date"]::-webkit-datetime-edit-month-field,
    .admin-page-list input[type="date"]::-webkit-datetime-edit-day-field,
    .admin-page-list input[type="date"]::-webkit-datetime-edit-text{
      font-size: 16px;
      line-height: 20px;
    }
  }
}


/* ---- v9.6.5 admin date shell: visually match normal fields on iPhone/Safari ---- */
.date-shell{
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background-color: rgba(10,12,18,.55);
  overflow: hidden;
}

.date-shell:focus-within{
  border-color: rgba(124,92,255,.65);
  box-shadow: 0 0 0 4px rgba(124,92,255,.16);
}

.date-shell-input{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.01;
  cursor: pointer;
  z-index: 2;
  margin: 0;
  padding: 0;
}

.date-shell-display{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 11px 42px 11px 12px;
  font-size: 14px;
  line-height: 1.2;
  color: #e9ecf1;
  pointer-events: none;
  box-sizing: border-box;
}

.date-shell-display.placeholder{
  color: #9aa3b2;
}

.date-shell::after{
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%23e9ecf1' d='M5.6 7.8a1 1 0 0 1 1.4.1L10 11.3l3-3.4a1 1 0 1 1 1.5 1.3l-3.7 4.1a1.2 1.2 0 0 1-1.8 0L5.5 9.2a1 1 0 0 1 .1-1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
  opacity: .9;
  pointer-events: none;
}

.admin-page-list .date-shell-input{
  appearance: none;
  -webkit-appearance: none;
}

@media (max-width: 520px){
  .date-shell-display{
    font-size: 16px;
  }
}


/* ---- v9.6.6 admin form spacing ---- */
#createBudgetAdminForm,
#adminActionForm,
#editBudgetForm{
  margin-bottom: 0 !important;
}


/* ---- v9.6.7 history action slot visibility ---- */
.history-actionbar-slot{
  display: none !important;
}

.history-actionbar-slot.is-active{
  display: block !important;
}


/* ---- v9.6.11 payment/history spacing fixes ---- */
.payment-draft-page{
  flex: 0 0 auto !important;
  min-height: auto !important;
}

.payment-draft-form{
  margin-bottom: 0 !important;
}

.payment-draft-form .req-bottom.actions.actions-2{
  margin-bottom: 0 !important;
}

.history-list-with-action{
  padding-bottom: 10px !important;
}

.history-list-with-action.has-actionbar{
  padding-bottom: 72px !important;
}
