:root {
  --ink: #172629;
  --subtle: #536369;
  --surface: #fff;
  --ground: #f4f6f5;
  --line: #dce4e2;
  --dark: #15282c;
  --dark-muted: #a9bebd;
  --accent: #f3ad69;
  --accent-light: #fff0df;
  --green: #176952;
  --green-light: #e3f2ec;
  --warning: #835011;
  --warning-light: #fff1d9;
  --error: #9f342c;
  --error-light: #fbe9e6;
  --radius: 15px;
  font-family: Inter, "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  color: var(--ink);
  background: var(--ground);
  font-size: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled, input:disabled, select:disabled { cursor: default; opacity: .58; }
:focus-visible { outline: 3px solid #20827b; outline-offset: 3px; }
.sidebar :focus-visible, .metric-primary :focus-visible { outline-color: var(--accent); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { letter-spacing: -.035em; }
p { line-height: 1.5; }
code { overflow-wrap: anywhere; }
.numeral { font-variant-numeric: tabular-nums; }

.startup, noscript {
  display: block;
  padding: 3rem;
  text-align: center;
  color: var(--subtle);
}

.brand { display: flex; align-items: center; gap: .7rem; font-size: 1.22rem; font-weight: 750; letter-spacing: -.035em; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--accent);
  border-radius: .55rem;
  color: var(--dark);
  font-size: .89rem;
  font-weight: 850;
  letter-spacing: -.065em;
}
.eyebrow { font-size: .75rem; font-weight: 750; text-transform: uppercase; letter-spacing: .13em; }
.muted, .hint { color: var(--subtle); }
.hint { font-size: .84rem; }

.login { display: grid; grid-template-columns: minmax(0, .96fr) minmax(0, 1fr); min-height: 100vh; }
.login-brand {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  color: white;
  background: var(--dark);
  padding: clamp(2rem, 5vw, 5rem);
}
.login-brand::before, .login-brand::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: 42rem;
  height: 42rem;
  top: -13rem;
  right: -21rem;
  border: 1px solid #385358;
  border-radius: 50%;
}
.login-brand::after { width: 49rem; height: 49rem; top: -16.5rem; right: -24.5rem; }
.login-intro { max-width: 40rem; margin: 7rem 0 clamp(1rem, 8vh, 6rem); }
.login-intro h1 { font-size: clamp(2.8rem, 5.6vw, 6rem); line-height: 1.03; letter-spacing: -.068em; margin: .9rem 0 1.2rem; }
.login-intro .eyebrow { color: var(--accent); }
.login-intro p:last-child { max-width: 23rem; color: #b3c5c5; font-size: clamp(.95rem, 1.4vw, 1.125rem); }
.login-main { display: grid; align-items: center; justify-items: center; padding: 2.25rem; background: var(--surface); }
.login-content { width: min(100%, 27rem); }
.login-content > .eyebrow { color: var(--green); }
.login-content h2 { margin: .5rem 0 .4rem; font-size: 2.55rem; line-height: 1.06; }
.login-content > form { display: grid; gap: .55rem; margin-top: 1.55rem; }
.login-content form input { margin-bottom: .5rem; }
.login-content .auth-hint { margin-top: -.42rem; }
.login-mobile-brand { display: none; }
.login-submit { width: 100%; margin-top: .35rem; justify-content: space-between !important; }
.otp-input { letter-spacing: .32em; font-variant-numeric: tabular-nums; }
.enrollment { display: grid; gap: .6rem; padding: .8rem; margin-bottom: .5rem; background: var(--ground); border-radius: 9px; font-size: .85rem; }
.enrollment code { font-size: 1rem; font-weight: 650; user-select: all; }
.demo-login { border-top: 1px solid var(--line); padding-top: 1.2rem; margin-top: 1.5rem; }
.demo-login h3 { font-size: .98rem; margin-bottom: .23rem; }
.demo-login p { font-size: .87rem; }
.demo-profiles { display: flex; flex-wrap: wrap; gap: .5rem; margin: .7rem 0 0; }
.demo-profiles .button { min-height: 37px; padding: .42rem .7rem; font-size: .81rem; }
#demo-code { margin-top: .55rem; }

.shell { display: grid; grid-template-columns: 16rem minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  align-self: start;
  top: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 3rem;
  padding: 1.6rem 1.15rem 1.15rem;
  background: var(--dark);
  color: white;
}
.sidebar > .brand { padding-left: .5rem; }
.navigation { display: flex; flex-direction: column; gap: .35rem; }
.nav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  min-height: 46px;
  padding: .65rem .7rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: .55rem;
  color: var(--dark-muted);
  font-size: .87rem;
  font-weight: 650;
  text-align: left;
}
.nav-item:hover { background: #253b3f; color: white; }
.nav-item[aria-current=page] { background: #284246; border-color: #36575b; color: white; }
.nav-icon { display: inline-grid; place-items: center; width: 1.05rem; height: 1.05rem; flex: none; color: #ffc18b; }
.icon-chart {
  background: linear-gradient(currentColor, currentColor) 8% 100% / 2px 45% no-repeat,
    linear-gradient(currentColor, currentColor) 50% 100% / 2px 69% no-repeat,
    linear-gradient(currentColor, currentColor) 92% 100% / 2px 95% no-repeat;
}
.icon-settings { border: 1.8px solid currentColor; border-radius: 50%; }
.icon-settings::after { content: ""; width: 5px; height: 5px; border: 1.6px solid currentColor; border-radius: 50%; }
.icon-users::before, .icon-users::after { content: ""; border: 1.6px solid currentColor; }
.icon-users::before { width: .3rem; height: .3rem; border-radius: 50%; }
.icon-users::after { width: .65rem; height: .28rem; border-radius: .55rem .55rem .17rem .17rem; }
.sidebar-footer { display: grid; gap: .65rem; margin-top: auto; padding-top: 1rem; border-top: 1px solid #355054; }
.profile { display: flex; gap: .6rem; align-items: center; min-width: 0; }
.profile > div { display: grid; gap: .16rem; min-width: 0; }
.profile strong, .profile div span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile strong { font-size: .83rem; }
.profile div span { color: var(--dark-muted); font-size: .75rem; }
.avatar { display: grid; place-items: center; width: 2rem; height: 2rem; flex: none; border-radius: 50%; background: #385457; font-size: .67rem; font-weight: 740; }

.workspace { min-width: 0; }
.topbar {
  display: flex;
  min-height: 69px;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  padding: .7rem clamp(1.1rem, 3.1vw, 3.2rem);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  color: var(--subtle);
  font-size: .86rem;
  font-weight: 650;
}
.page { max-width: 90rem; margin-inline: auto; padding: 2rem clamp(1.1rem, 3.1vw, 3.2rem) 3.5rem; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: .95rem; margin-bottom: 1.4rem; }
.page-heading h1 { font-size: clamp(1.83rem, 3.5vw, 3rem); line-height: 1.08; }
.page-heading p, .panel-heading p { color: var(--subtle); font-size: .9rem; margin-top: .4rem; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.filters { display: grid; grid-template-columns: minmax(9rem,1.2fr) repeat(2,minmax(8rem,1fr)) minmax(7rem,1fr) auto auto; align-items: end; gap: .8rem; padding: 1rem; }
.field { display: grid; gap: .4rem; min-width: 0; }
label, legend { color: var(--ink); font-size: .81rem; font-weight: 690; }
input, select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: .55rem .65rem;
  border: 1px solid #bdcbc9;
  border-radius: .48rem;
  background: var(--surface);
  color: var(--ink);
  font-size: .87rem;
}
input:read-only { background: var(--ground); }
.vision-field { display: block; padding: 0; margin: 0; border: 0; }
.vision-field legend { padding: 0; margin-bottom: .4rem; }
.segmented { display: flex; min-height: 42px; padding: .19rem; border: 1px solid #bdcbc9; border-radius: .48rem; background: var(--ground); }
.segmented input { position: absolute; width: 1px; height: 1px; min-height: 0; overflow: hidden; clip-path: inset(50%); }
.segmented label { display: flex; align-items: center; justify-content: center; flex: 1; padding: 0 .53rem; border-radius: .33rem; cursor: pointer; white-space: nowrap; }
.segmented input:checked + label { color: #103c37; background: var(--surface); box-shadow: 0 1px 2px #17262929; }
.segmented input:focus-visible + label { outline: 3px solid #20827b; outline-offset: -2px; }
.filters .form-feedback { grid-column: 1 / -1; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  min-height: 42px;
  padding: .58rem .8rem;
  border-radius: .5rem;
  border: 1px solid transparent;
  font-size: .85rem;
  font-weight: 700;
  white-space: nowrap;
}
.primary { background: var(--dark); color: #fff; }
.primary:hover:not(:disabled) { background: #28474b; }
.secondary { background: var(--surface); color: var(--ink); border-color: #bdcbc9; }
.secondary:hover:not(:disabled) { background: #eef5f1; }
.text-button { background: transparent; color: var(--green); }
.text-button:hover { background: var(--ground); }
.exit-button { justify-content: flex-start; align-self: start; min-height: 36px; padding: .42rem .5rem; color: var(--dark-muted); background: transparent; }
.exit-button:hover { background: #253b3f; color: #fff; }

.form-feedback { padding: .67rem .8rem; margin-top: .65rem; border-radius: .5rem; background: var(--green-light); color: var(--green); font-size: .86rem; }
.form-feedback.error { background: var(--error-light); color: var(--error); }
.page > .form-feedback { margin: 0 0 1rem; }
.pill { display: inline-flex; align-items: center; gap: .4rem; min-height: 25px; padding: .24rem .59rem; border-radius: 99px; font-size: .75rem; font-weight: 700; line-height: 1.1; white-space: nowrap; }
.demo-pill { background: var(--accent-light); color: #804a21; }
.demo-pill > span { width: .38rem; height: .38rem; border-radius: 50%; background: #a7622f; }
.muted-pill, .state-neutral { color: #45565a; background: #eaf0ee; }
.state-ok { color: var(--green); background: var(--green-light); }
.state-warn { color: var(--warning); background: var(--warning-light); }
.state-error { color: var(--error); background: var(--error-light); }
.report-status { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin: 1rem 0 .35rem; color: var(--subtle); font-size: .82rem; }
.report-context { margin: 0 0 1rem; color: var(--subtle); font-size: .83rem; }
.notice { padding: 1rem; margin: .7rem 0 1rem; border: 1px solid var(--line); border-radius: .7rem; background: var(--surface); }
.notice p { margin-top: .25rem; color: var(--subtle); font-size: .85rem; }
.notice .button { margin-top: .6rem; }

.kpis { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .95rem; margin-bottom: 1rem; }
.metric {
  display: grid;
  align-content: start;
  gap: .55rem;
  min-height: 147px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.metric-primary { background: var(--dark); border-color: var(--dark); color: #fff; }
.metric-label { display: flex; gap: .5rem; align-items: center; font-size: .88rem; font-weight: 700; }
.metric-icon { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; background: #e7f0ed; border-radius: .41rem; color: var(--green); font-weight: 800; }
.metric-primary .metric-icon { background: var(--accent); color: var(--dark); }
.metric strong { font-size: clamp(1.27rem, 2.6vw, 2.35rem); letter-spacing: -.055em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-note { font-size: .77rem; color: var(--subtle); }
.metric-primary .metric-note { color: #b9cdcb; }
.payments, .admin-panel { padding: 1.05rem 1.15rem; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; margin-bottom: .8rem; }
.panel-heading h2 { font-size: 1.17rem; }
.panel-heading p { margin-top: .25rem; font-size: .84rem; }
.payment-row {
  display: grid;
  grid-template-columns: minmax(7rem, .95fr) minmax(4rem, 2.2fr) minmax(6.7rem, auto);
  align-items: center;
  gap: .85rem;
  padding: .65rem 0;
  border-top: 1px solid #edf1f0;
}
.payment-label { display: flex; gap: .48rem; align-items: center; min-width: 0; }
.payment-label strong { font-size: .83rem; overflow-wrap: anywhere; }
.payment-dot { width: .5rem; height: .5rem; flex: none; border-radius: 50%; background: #438a7d; }
.payment-row.negative .payment-dot { background: #a85a47; }
.bar-track { height: 8px; overflow: hidden; background: #e7eeeb; border-radius: 30px; }
.bar-track span { display: block; height: 100%; border-radius: 30px; background: #438a7d; }
.payment-row.negative .bar-track span { background: #a85a47; }
.payment-value { text-align: right; font-size: .85rem; font-weight: 720; font-variant-numeric: tabular-nums; }

.admin-panel { margin-bottom: .95rem; }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .95rem; }
.admin-panel form { display: grid; justify-items: start; gap: .7rem; }
.admin-panel form .field { width: 100%; }
.admin-panel .empty { color: var(--subtle); font-size: .86rem; padding: .35rem 0; }
.pair-result { display: grid; gap: .4rem; margin-top: .85rem; }
.copy-row { display: flex; gap: .4rem; }
.copy-row input { font-family: "IBM Plex Mono", monospace; }
.machine-summary { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .55rem 0 .75rem; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(12rem,1fr)); margin: 0; gap: .65rem; }
.detail-grid > div { padding: .65rem; border-radius: .6rem; background: var(--ground); }
.detail-grid dt { font-size: .77rem; color: var(--subtle); }
.detail-grid dd { margin: .23rem 0 0; font-size: .86rem; font-weight: 650; }
.mapping-list { display: grid; gap: .68rem; }
.mapping-list form { grid-template-columns: minmax(8rem, .95fr) minmax(8rem, 1.25fr) auto; align-items: end; }
.job-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem .65rem; align-items: start; border-top: 1px solid var(--line); padding: .7rem 0; font-size: .84rem; }
.job-row p { color: var(--subtle); font-size: .79rem; margin-top: .2rem; overflow-wrap: anywhere; }

@media (max-width: 1260px) {
  .filters { grid-template-columns: minmax(8rem,1.18fr) repeat(3, minmax(0, 1fr)); }
  .vision-field { grid-column: span 2; justify-self: start; }
  .filters > .button { grid-column: span 2; justify-self: end; }
}
@media (max-width: 910px) {
  .shell { grid-template-columns: 12rem minmax(0, 1fr); }
  .sidebar { padding-inline: .65rem; }
  .page { padding-top: 1.45rem; }
  .page-heading { align-items: start; }
  .filters { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .vision-field { grid-column: auto; }
  .filters > .button { grid-column: auto; }
  .metric { padding: .75rem; }
}
@media (max-width: 700px) {
  .shell { display: flex; flex-direction: column; }
  .sidebar {
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    min-height: 0;
    width: 100%;
    gap: .4rem .7rem;
    padding: .66rem .8rem .48rem;
  }
  .sidebar > .brand { padding: 0; }
  .sidebar .brand-mark { width: 1.9rem; height: 1.9rem; }
  .sidebar-footer { display: flex; align-items: center; margin: 0; padding: 0; border: 0; grid-column: 2; grid-row: 1; gap: .42rem; }
  .profile > div { max-width: 6rem; }
  .profile .avatar, .profile div span { display: none; }
  .navigation { grid-column: 1 / -1; flex-direction: row; }
  .nav-item { width: auto; min-height: 36px; padding: .43rem .55rem; gap: .45rem; font-size: .77rem; }
  .nav-icon { width: .83rem; height: .83rem; }
  .topbar { min-height: 0; padding: .45rem 1rem; }
  .topbar > span:first-child { font-size: .77rem; }
  .topbar .pill { min-height: 22px; font-size: .68rem; }
  .page { padding: 1.15rem 1rem 2rem; }
  .page-heading { align-items: start; flex-wrap: wrap; margin-bottom: .9rem; }
  .page-heading p { font-size: .83rem; }
  .page-heading .button { min-height: 36px; }
  .login { display: block; }
  .login-brand { display: none; }
  .login-mobile-brand { display: flex; margin-bottom: 1.75rem; }
  .login-main { min-height: 100dvh; padding: 2rem 1.25rem; align-items: start; }
  .login-content h2 { font-size: 2.15rem; }
  .admin-grid { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 430px) {
  .filters { gap: .65rem; padding: .7rem; }
  .filters > .button { width: 100%; }
  .segmented label { font-size: .74rem; padding-inline: .37rem; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .metric-primary { grid-column: 1 / -1; }
  .metric { min-height: 0; gap: .39rem; }
  .metric-primary strong { font-size: 1.82rem; }
  .metric-label { font-size: .81rem; }
  .metric-note { font-size: .73rem; }
  .payments, .admin-panel { padding: .85rem; }
  .payment-row { grid-template-columns: minmax(0, 1fr) auto; gap: .35rem; }
  .bar-track { grid-row: 2; grid-column: 1 / -1; height: 5px; }
  .mapping-list form { grid-template-columns: 1fr; }
}
.report-status .button { min-height: 34px; margin-left: auto; font-size: .78rem; }
@media (max-width: 520px) {
  .report-status .button { margin-left: 0; }
}

.danger { color: var(--error); background: var(--surface); border-color: #e8aaa3; }
.danger:hover:not(:disabled) { background: var(--error-light); }
.machine-action { margin-top: .85rem; }
.dialog {
  width: min(100% - 2rem, 28rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem;
  color: var(--ink);
  background: var(--surface);
}
.dialog::backdrop { background: #17262999; }
.dialog h2 { font-size: 1.3rem; }
.dialog > p { margin-top: .6rem; color: var(--subtle); font-size: .88rem; }
.dialog > .form-feedback { color: var(--error); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .55rem; margin-top: 1rem; }
.users-grid { display: grid; grid-template-columns: minmax(16rem, .7fr) minmax(0, 1fr); gap: .95rem; align-items: start; }
.store-fieldset { width: 100%; margin: .25rem 0 0; padding: 0; border: 0; min-width: 0; }
.store-fieldset legend { padding: 0; margin-bottom: .4rem; }
.store-options { display: flex; flex-wrap: wrap; gap: .42rem; }
.store-option { display: flex; gap: .42rem; align-items: center; min-height: 36px; padding: .35rem .55rem; border: 1px solid var(--line); border-radius: .45rem; cursor: pointer; overflow-wrap: anywhere; }
.store-option:has(input:checked) { background: var(--green-light); border-color: #b3d5c8; }
.store-option input { width: 1rem; height: 1rem; min-height: 0; margin: 0; accent-color: var(--green); flex: none; }
.user-row { display: grid; gap: .45rem; border-top: 1px solid var(--line); padding: .8rem 0; }
.user-row-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; overflow-wrap: anywhere; }
.user-row p { color: var(--subtle); font-size: .84rem; overflow-wrap: anywhere; }
.user-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.user-actions .button { min-height: 33px; font-size: .77rem; padding: .33rem .55rem; }
.user-dialog .field, .user-stores-form { margin-top: .9rem; }
.user-dialog > .form-feedback { color: var(--green); }
@media (max-width: 950px) {
  .users-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .navigation { flex-wrap: wrap; }
}
