:root {
  color-scheme: light;
  font: 15px/1.5 Inter, system-ui, sans-serif;
  color: #172127;
  background: #f5f6f7;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, select { font: inherit; color: inherit; }
button, select {
  background: #fff;
  border: 1px solid #d7dde0;
  border-radius: 9px;
  padding: .58rem .85rem;
}
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid #2e57c8; outline-offset: 3px; }
h1 { font-size: clamp(1.55rem, 4vw, 2.35rem); margin: 0; line-height: 1.15; letter-spacing: -.045em; }
.login {
  margin: max(6vh, 24px) auto;
  width: min(465px, calc(100% - 36px));
  padding: clamp(24px, 6vw, 40px);
  border: 1px solid #e0e3e5;
  border-radius: 20px;
  background: white;
}
.login h1 { margin-top: 2rem; }
.login p { color: #516069; }
.brand { display: flex; align-items: center; gap: .7rem; font-size: 1.35rem; font-weight: 750; }
.mark {
  display: inline-grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  background: #ffd844;
  color: #181c22;
  border-radius: .65rem;
}
.workspace { min-height: 100vh; display: grid; grid-template-columns: 230px minmax(0, 1fr); }
aside { display: flex; flex-direction: column; gap: 1.75rem; background: #172127; color: #fff; padding: 1.5rem; }
nav { display: grid; gap: .4rem; }
nav button, .logout { text-align: left; border-color: transparent; background: transparent; }
nav button:hover, .logout:hover { background: #28343c; }
nav button[aria-current] { color: #161a1d; background: #ffd844; font-weight: 700; }
.logout { margin-top: auto; }
main { padding: clamp(20px, 4vw, 56px); width: 100%; max-width: 1500px; }
header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1.5rem; }
header label { display: grid; gap: .3rem; color: #516069; }
#activity:not(:empty) { margin-bottom: 1rem; color: #516069; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.card, .table, .empty { background: #fff; border: 1px solid #e0e3e5; border-radius: 14px; }
.card, .empty { padding: 1.25rem; }
.card h2 { font-size: .95rem; color: #516069; font-weight: 600; margin: 0; }
.card p { font-size: 2rem; font-weight: 750; margin: .25rem 0 0; }
.table { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: .85rem 1rem; border-bottom: 1px solid #e9ebed; }
th { background: #f9fafb; white-space: nowrap; color: #516069; }
tr:last-child td { border-bottom: 0; }
footer { display: flex; align-items: center; justify-content: end; gap: 1rem; margin-top: 1rem; }
@media (max-width: 700px) {
  .workspace { grid-template-columns: 1fr; }
  aside { gap: 1rem; padding: 1rem; }
  nav { display: flex; flex-wrap: wrap; }
  .logout { align-self: start; }
}

.login form { display: grid; gap: .65rem; }
.login input {
  border: 1px solid #d7dde0;
  border-radius: 9px;
  padding: .7rem .85rem;
  font: inherit;
}
.login button[type="submit"] {
  justify-self: start;
  border-color: #ffd844;
  background: #ffd844;
  font-weight: 700;
}

.login:has(.access-logo) { width: min(720px, calc(100% - 36px)); }
.access-logo { display: block; width: 100%; height: auto; }

#login { display:grid; grid-template-columns:57% 43%; min-height:100vh; margin:0; width:100%; padding:0; border:0; border-radius:0; background:#faf7f1; }
.access-brand,.access-form { display:grid; place-content:center; padding:clamp(24px,5vw,80px); }
.access-brand { background:#ffd43e; justify-items:center; }
.access-brand img { display:block; width:100%; max-width:920px; height:auto; }
.access-form { gap:1.5rem; }
.access-form h1 { margin:0; }
.access-form form button { padding:.85rem 1.35rem; border-color:#172127; background:transparent; }
.access-form p { margin:0; }
.access-form p:empty { display:none; }
@media(max-width:700px) { #login { grid-template-columns:1fr; grid-template-rows: minmax(35vh,auto) 1fr; } }

.customer-cell { display: grid; justify-items: start; gap: .3rem; }
.customer-link { padding: 0; border: 0; color: #265641; background: transparent; text-decoration: underline; }
.customer-dialog {
  width: min(920px, calc(100% - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  color: #20352d;
  background: #fff;
  border: 1px solid #dce8e1;
  border-radius: 20px;
  box-shadow: 0 24px 80px #13291c40;
}
.customer-dialog::backdrop { background: #172b2270; }
.customer-dialog header {
  position: sticky;
  top: 0;
  margin: 0;
  align-items: center;
  padding: 1rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid #e6eee9;
}
.customer-dialog h2, .customer-dialog h3, .customer-dialog h4 { margin: 0; }
.customer-body { padding: 1.5rem; }
.customer-body h3 { font-size: clamp(1.3rem, 4vw, 1.8rem); }
.customer-note { margin: .85rem 0 0; padding: .7rem 1rem; background: #fbf5e5; border-radius: 9px; }
.customer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.customer-grid section { padding: 1rem; border-radius: 12px; background: #edf4ef; }
.customer-grid dl { margin: .65rem 0 0; }
.customer-grid dt { color: #456257; margin-top: .65rem; font-size: .87rem; }
.customer-grid dd { margin: .1rem 0 0; font-weight: 650; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .customer-grid { grid-template-columns: 1fr; }
  .customer-body, .customer-dialog header { padding: 1rem; }
}

/* Customer detail */
.customer-dialog { width: min(1000px, calc(100% - 2rem)); }
.customer-dialog header { z-index: 1; }
.customer-dialog header button { color: #fff; background: #214638; border-color: #214638; font-weight: 650; }
.customer-identity { display: flex; align-items: center; gap: 1rem; }
.customer-avatar {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: .8rem;
  background: #e6efe7;
  color: #214638;
  font-weight: 750;
}
.customer-highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: .65rem; margin-top: 1rem; }
.customer-highlights > div { display: grid; gap: .25rem; background: #e8f0e7; border-radius: .8rem; padding: .85rem 1rem; }
.customer-highlights > div:nth-child(2n) { background: #e8eff5; }
.customer-highlights span, .customer-empty { color: #4b6258; font-size: .9rem; }
.customer-highlights strong { font-size: 1.15rem; overflow-wrap: anywhere; }
.customer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.customer-grid section { background: #fff; border: 1px solid #e2eae5; }
.customer-grid dl { display: grid; gap: .25rem; }
.customer-empty { margin: .6rem 0 0; }
@media (max-width: 700px) { .customer-grid { grid-template-columns: 1fr; } }

.plans-table { padding: 1.15rem; border-radius: 18px; }
.plans-table th { background: #f2f3f0; font-size: .84rem; }
.plans-table td { padding-block: 1rem; }
.plans-table th:last-child, .plans-table td:last-child { white-space: nowrap; }
.plans-table .customer-link { color: #705600; font-weight: 700; }
.plans-table tbody tr:hover { background: #fafbf9; }

.admin-panel { min-width: 0; }
.admin-topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; padding: .75rem clamp(20px, 4vw, 56px); min-height: 72px; background: #fff; border-bottom: 1px solid #e0e3e5; }
.admin-logo { display: block; width: 138px; height: 52px; object-fit: contain; }
.admin-session { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; min-width: 0; }
.admin-profile { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.admin-avatar { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; background: #ffe375; color: #172127; font-weight: 700; }
.admin-avatar img { width: 100%; height: 100%; object-fit: cover; }
.admin-profile-text { display: grid; gap: .15rem; overflow-wrap: anywhere; }
.admin-profile-text small { color: #516069; }

.users-card + .users-card { margin-top: 1.25rem; }
.users-card h2 { font-size: 1.15rem; color: #172127; }
.users-card > p { margin: .4rem 0 1rem; color: #516069; font-size: .94rem; font-weight: 400; }
.users-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .75rem; align-items: end; margin-top: 1rem; }
.users-form label { display: grid; gap: .3rem; color: #516069; }
.users-form input, .users-form select { min-height: 42px; border: 1px solid #d8dddf; border-radius: 8px; padding: .5rem .65rem; background: white; color: #172127; min-width: 0; }
.users-feedback:not(:empty) { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: .8rem; }
.users-directory { list-style: none; padding: 0; margin: 1rem 0 0; }
.users-directory li { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; padding: .85rem 0; border-top: 1px solid #e9ebed; }
.users-identity { display: grid; gap: .2rem; flex: 1 1 15rem; min-width: 0; overflow-wrap: anywhere; }
.users-identity small { color: #516069; }
@media (max-width: 680px) { .users-form { grid-template-columns: 1fr; } }

.users-directory-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.users-count { min-width: 2rem; padding: .35rem .6rem; text-align: center; border-radius: 999px; background: #edf0f1; font-weight: 700; }
.users-filters { padding: .75rem; background: #f7f8f8; border: 1px solid #e7ebed; border-radius: 10px; }
.users-directory { display: grid; gap: .65rem; }
.users-directory li { padding: .85rem 1rem; border: 1px solid #e7ebed; border-radius: 10px; background: #fbfcfc; }
.users-avatar { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%; overflow: hidden; background: #ffefb6; color: #5b4500; font-weight: 750; }
.users-avatar img { width: 100%; height: 100%; object-fit: cover; }

.users-group > summary { cursor: pointer; list-style: none; }
.users-group > summary::-webkit-details-marker { display: none; }
.users-group > summary h2 { margin: 0; flex: 1; font-size: 1.25rem; }
.users-group > summary::after { content: '›'; font-size: 1.25rem; color: #516069; }
.users-group[open] > summary::after { transform: rotate(90deg); }
.users-group .users-directory { margin-bottom: 0; }
.users-group .users-directory li { min-height: 78px; padding: 1rem; }
.users-group .users-directory .users-empty { min-height: auto; color: #516069; }
.users-group .users-avatar { width: 48px; height: 48px; flex-basis: 48px; }

.users-group { padding: clamp(1.25rem, 2.2vw, 2.15rem); border-color: #e8e4de; }
.users-group > summary > div { flex: 1; }
.users-group > summary h2 { font-size: clamp(1.3rem, 1.8vw, 1.65rem); }
.users-directory-label { display: block; margin-bottom: .85rem; color: #686259; text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; }
.users-group .users-count, .users-role, .users-actions > summary { background: #f0eeea; color: #413e38; }
.users-group .users-filters { margin-top: 2rem; background: #faf9f7; border-color: #ece7e0; }
.users-group .users-directory li { min-height: 106px; gap: .9rem; padding: 1rem 1.25rem; border-color: #ece8e1; background: #fcfbfa; }
.users-role { border-radius: 999px; padding: .28rem .65rem; font-size: .82rem; font-weight: 700; }
.users-actions { position: relative; }
.users-actions > summary { display: grid; place-items: center; list-style: none; cursor: pointer; width: 36px; height: 36px; border-radius: 8px; font-weight: 800; }
.users-actions > summary::-webkit-details-marker { display: none; }
.users-actions > button { position: absolute; z-index: 1; inset-inline-end: 0; margin-top: .25rem; white-space: nowrap; }
.admin-logo-fallback { display: inline-flex; align-items: center; gap: .55rem; color: #172127; font-weight: 800; }

.customer-dialog { color: #172127; background: #f7f8f9; border: 0; border-radius: 16px; box-shadow: 0 24px 72px #111b2859; }
.customer-dialog::backdrop { background: #111b2866; }
.customer-dialog > header { margin: 0; padding: 1.45rem clamp(1rem, 4vw, 2rem); background: #172127; color: #fff; border-bottom: 3px solid #ffda46; align-items: center; gap: .75rem; }
.customer-dialog .customer-identity { min-width: 0; gap: .9rem; }
.customer-dialog .customer-avatar { flex: 0 0 46px; width: 46px; height: 46px; border-radius: 10px; color: #172127; background: #ffda46; }
.customer-heading { min-width: 0; }
.customer-kicker { display: block; color: #c8d1d7; text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 650; }
.customer-dialog .customer-heading h2 { margin-top: .15rem; font-size: clamp(1.4rem, 4vw, 2rem); line-height: 1.15; overflow-wrap: anywhere; }
.customer-dialog > header button { background: #25343e; border-color: #52616b; }
.customer-dialog > header button:hover { background: #344651; }
.customer-dialog .customer-body { padding: clamp(1rem, 4vw, 2rem); }
.customer-dialog .customer-body h3 { font-size: .98rem; }
.customer-overview .customer-highlights { margin-top: .6rem; }
.customer-dialog .customer-highlights > div { background: #fff; border: 1px solid #e0e5e9; border-inline-start: 3px solid #d5a915; border-radius: 8px; }
.customer-dialog .customer-highlights span, .customer-dialog .customer-empty, .customer-dialog .customer-grid dt { color: #52616b; }
.customer-dialog .customer-grid { gap: .85rem; align-items: start; }
.customer-dialog .customer-grid section { border-color: #e0e5e9; border-radius: 10px; padding: 0 1rem 1rem; }
.customer-dialog .customer-grid h3 { padding: .9rem 0 .65rem; border-bottom: 1px solid #e9edf0; }
.customer-dialog .customer-grid dt { margin-top: .55rem; }

.sales-history-overview { margin-bottom: 1.5rem; }
.sales-history h2, .sales-history-overview h2 { margin: 0 0 .65rem; font-size: 1.1rem; }
.sales-history-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: .85rem; margin: 0; }
.sales-history-metrics > div { background: #fff; border: 1px solid #e0e5e9; border-radius: 12px; padding: 1rem 1.2rem; }
.sales-history-metrics > div:last-child { border-inline-start: 3px solid #d5a915; }
.sales-history-metrics dt { color: #52616b; font-size: .88rem; }
.sales-history-metrics dd { margin: .35rem 0 0; color: #172127; font-size: clamp(1.35rem, 3vw, 1.75rem); font-weight: 750; font-variant-numeric: tabular-nums; }
.sales-history-empty { padding: 1.65rem 1.2rem; }
.sales-history-empty p { margin: .3rem 0 0; color: #52616b; }

.ops-context { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .35rem 1rem; margin-bottom: .9rem; color: #52616b; font-size: .86rem; }
.ops-context p { margin: 0; }
.ops-metrics { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, .78fr) minmax(0, 1fr); gap: 1rem; align-items: stretch; }
.ops-primary, .ops-stat, .ops-products { display: flex; flex-direction: column; gap: .65rem; padding: clamp(1rem, 2.5vw, 1.65rem); }
.ops-primary { background: linear-gradient(125deg, #ffdf58, #ffb83f); color: #172127; border-radius: 15px; }
.ops-dashboard h2 { margin: 0; font-size: 1.05rem; color: #172127; }
.ops-primary p, .ops-stat p { margin: 0; font-size: .9rem; color: #52616b; }
.ops-primary p { color: #463415; }
.ops-primary > strong, .ops-stat > strong { font-size: clamp(2.1rem, 5vw, 3.55rem); line-height: 1; font-variant-numeric: tabular-nums; }
.ops-primary > button { align-self: start; margin-top: auto; border-color: #172127; color: #fff; background: #172127; }
.ops-primary > button:hover { background: #33434e; }
.ops-product { display: grid; grid-template-columns: 1fr auto; gap: .2rem .65rem; padding: .55rem 0; border-bottom: 1px solid #e8ecee; }
.ops-product:last-child { border-bottom: 0; }
.ops-product > strong { font-variant-numeric: tabular-nums; }
.ops-product small { color: #52616b; }
.ops-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: .75rem; margin-top: 1rem; }
.ops-actions h2 { grid-column: 1 / -1; }
.ops-shortcut { display: grid; gap: .3rem; text-align: left; }
.ops-shortcut span { font-size: .85rem; color: #52616b; }
@media (max-width: 900px) { .ops-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ops-primary { grid-column: 1 / -1; } }
@media (max-width: 540px) { .ops-metrics { grid-template-columns: 1fr; } }
