/* Carona admin console. Dark, matching the apps. No external assets. */

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface-2: #171717;
  --surface-3: #1f1f1f;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f4f2;
  --muted: #9a9a94;
  --brand: #ff5a1f;
  --brand-soft: rgba(255, 90, 31, 0.14);
  --blue: #5cc8ff;
  --amber: #ffb454;
  --red: #ff5c5c;
  --green: #4fd18b;
  --radius: 16px;
  --radius-sm: 10px;
  --gutter: 16px;
  --tabbar-h: 64px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

h1,
h2,
h3,
p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
.xsmall {
  font-size: 12px;
}
.mono {
  font-family: var(--mono);
}
.break {
  overflow-wrap: anywhere;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.link {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}
.link:hover {
  text-decoration-color: var(--brand);
}

.icon {
  flex: none;
  display: block;
}

.boot {
  min-height: 60vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  padding: var(--gutter);
}

.skip {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  padding: 0;
  z-index: 100;
  background: var(--brand);
  color: #0a0a0a;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
}
.skip:focus {
  width: auto;
  height: auto;
  clip: auto;
  left: 8px;
  top: 8px;
  padding: 10px 14px;
}

/* --- Buttons ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--surface-2);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--brand);
  color: #0a0a0a;
}
.btn-primary:not(:disabled):hover {
  background: #ff7240;
}
.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-ghost:not(:disabled):hover {
  background: var(--surface-2);
}
.btn-danger {
  background: var(--red);
  color: #0a0a0a;
}
.btn-link {
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}
.btn-link:hover {
  color: var(--text);
}
.btn-block {
  width: 100%;
}
.btn-small {
  min-height: 36px;
  padding: 0 14px;
  font-size: 14px;
}
.btn.busy {
  position: relative;
  color: transparent;
}
.btn.busy::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(10, 10, 10, 0.35);
  border-top-color: #0a0a0a;
  animation: spin 0.7s linear infinite;
}
.btn-ghost.busy::after {
  border-color: rgba(255, 255, 255, 0.25);
  border-top-color: var(--text);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  flex: none;
}
.icon-btn:hover {
  background: var(--surface-2);
}
.icon-btn:disabled {
  cursor: default;
}
.icon-btn.spinning .icon {
  animation: spin 0.9s linear infinite;
}

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

/* --- Forms ------------------------------------------------------------------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.hint {
  font-size: 13px;
  color: var(--muted);
}
.input {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-size: 16px; /* no zoom on iOS */
  appearance: none;
  -webkit-appearance: none;
}
.input:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.input:disabled {
  opacity: 0.45;
}
select.input {
  padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.input-narrow {
  max-width: 180px;
}
.input-wrap {
  position: relative;
}
.input-with-btn {
  padding-right: 52px;
}
.input-btn {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 48px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.input-btn:hover {
  color: var(--text);
}
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
}
.check {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
  margin: 0;
}
.form-error {
  background: rgba(255, 92, 92, 0.12);
  border: 1px solid rgba(255, 92, 92, 0.35);
  color: #ffc9c9;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.form-card {
  padding: 18px;
  max-width: 560px;
}

/* --- Sign-in ------------------------------------------------------------------ */

.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px var(--gutter);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.wordmark {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.wordmark::after {
  content: ".";
  color: var(--brand);
}
.auth-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.auth-lead {
  margin-top: -8px;
}
.steps {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.steps li::marker {
  color: var(--brand);
  font-weight: 700;
}
.qr-box {
  background: #ffffff;
  border-radius: var(--radius);
  padding: 14px;
  width: 220px;
  max-width: 100%;
  align-self: center;
}
.qr-svg {
  display: block;
  width: 100%;
  height: auto;
}
.otp-open {
  display: none;
}
@media (hover: none) and (pointer: coarse) {
  .otp-open {
    display: inline-flex;
  }
}
.secret {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.secret-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 8px 8px 14px;
}
.secret-code {
  flex: 1;
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
  user-select: all;
}
.code-input {
  font-family: var(--mono);
  font-size: 28px;
  letter-spacing: 0.4em;
  text-align: center;
  padding-left: calc(14px + 0.4em);
  min-height: 60px;
}

/* --- Layout -------------------------------------------------------------------- */

.layout {
  min-height: 100vh;
}
.main {
  padding: 16px var(--gutter) calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom, 0px));
  max-width: 1200px;
  margin: 0 auto;
  outline: none;
}
.sidebar {
  display: none;
}
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--tabbar-h);
  padding: 6px 2px;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  background: transparent;
  border: 0;
  cursor: pointer;
  min-width: 0;
}
.tab span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tab[aria-current="page"],
.tab.active {
  color: var(--brand);
}

@media (min-width: 769px) {
  .layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
  }
  .tabbar {
    display: none;
  }
  .sidebar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 20px 12px;
    border-right: 1px solid var(--border);
    background: var(--bg);
  }
  .side-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 20px;
  }
  .side-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .side-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 12px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
    background: transparent;
    border: 0;
    width: 100%;
    text-align: left;
    cursor: pointer;
  }
  .side-link:hover {
    color: var(--text);
    background: var(--surface);
  }
  .side-link[aria-current="page"] {
    color: var(--text);
    background: var(--surface-2);
  }
  .side-link[aria-current="page"] .icon {
    color: var(--brand);
  }
  .side-foot {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
  }
  .side-who {
    padding: 0 12px;
  }
  .main {
    padding: 28px 32px 48px;
    width: 100%;
  }
}

/* --- Page header ----------------------------------------------------------------- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.page-head-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 200px;
}
.page-title {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.page-sub {
  font-size: 14px;
}
.updated {
  font-size: 13px;
  min-height: 1.3em;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  min-height: 32px;
  margin-left: -4px;
  align-self: flex-start;
}
.back-link:hover {
  color: var(--text);
}
@media (max-width: 480px) {
  .page-actions .btn {
    padding: 0 14px;
  }
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.toolbar .search {
  flex: 1 1 260px;
}
.filters select.input {
  flex: 1 1 150px;
  width: auto;
  min-width: 0;
}
/* On a phone two selects side by side cut their own labels ("Todos os papéi"),
   so each one takes the whole row. */
@media (max-width: 480px) {
  .filters select.input {
    flex: 1 1 100%;
  }
}
.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search .icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  pointer-events: none;
}
.search .input {
  padding-left: 42px;
}
.count {
  font-size: 13px;
  margin-bottom: 10px;
}

/* --- Cards, KPIs -------------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.section {
  margin-bottom: 24px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.section-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 12px;
}
.section-head .section-title {
  margin-bottom: 0;
}
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row dense;
  gap: 10px;
}
.kpi {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  text-decoration: none;
}
.kpi-link {
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.kpi-link:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.kpi-wide {
  grid-column: 1 / -1;
}
.kpi-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.kpi-value {
  font-size: clamp(19px, 5.2vw, 24px);
  font-weight: 750;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}
.kpi-sub {
  font-size: 12.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.kpi-triple {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.tone-danger .kpi-value {
  color: var(--red);
}
@media (min-width: 640px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .kpi-grid .kpi-wide {
    grid-column: span 2;
  }
  .kpi-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--text);
  white-space: nowrap;
  line-height: 1.5;
}
.badge-brand {
  background: var(--brand-soft);
  color: var(--brand);
}
.badge-ok {
  background: rgba(79, 209, 139, 0.13);
  color: var(--green);
}
.badge-warn {
  background: rgba(255, 180, 84, 0.14);
  color: var(--amber);
}
.badge-danger {
  background: rgba(255, 92, 92, 0.14);
  color: var(--red);
}
.badge-muted {
  background: var(--surface-3);
  color: var(--muted);
}

/* --- Usage bars ------------------------------------------------------------------------ */

.usage {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.usage-text {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
}
.usage-pct {
  font-weight: 700;
}
.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--brand);
}
.bar-none {
  background: repeating-linear-gradient(90deg, var(--surface-3) 0 6px, transparent 6px 10px);
}
.usage-warn .bar-fill {
  background: var(--amber);
}
.usage-warn .usage-pct {
  color: var(--amber);
}
.usage-over .bar-fill {
  background: var(--red);
}
.usage-over .usage-pct {
  color: var(--red);
}

/* --- Companies ---------------------------------------------------------------------------- */

.card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
@media (min-width: 700px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1100px) {
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.company-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.company-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.company-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.company-name {
  font-size: 17px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.list-card {
  padding: 4px 16px;
}
.rep-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.rep-row:last-child {
  border-bottom: 0;
}
.rep-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}
@media (min-width: 700px) {
  .rep-row {
    grid-template-columns: minmax(140px, 1fr) minmax(0, 2fr);
    align-items: center;
    gap: 16px;
  }
}

/* --- Tables (cards on phones) ------------------------------------------------------------------ */

.table-wrap {
  width: 100%;
}
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 14px;
}
.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table .cell-actions {
  text-align: right;
  width: 1%;
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.error-text {
  font-family: var(--mono);
  font-size: 12.5px;
  color: #ffc9c9;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (min-width: 769px) {
  .table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow-x: auto;
  }
  .table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.02);
  }
  .jobs-table .cell-error {
    max-width: 420px;
  }
  /* Long e-mails and company names stay on one line so rows keep their height. */
  .people-table th,
  .people-table td {
    padding: 12px 8px;
  }
  .people-table .cell-primary .muted {
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .people-table td[data-label="Empresa"] {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .people-table .badge {
    font-size: 11.5px;
    padding: 2px 8px;
  }
  .people-table td[data-label="Último acesso"] {
    white-space: nowrap;
  }
  .people-table td[data-label="Empresa"] .link {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
  }
}

@media (max-width: 768px) {
  .table.responsive,
  .table.responsive tbody,
  .table.responsive tr,
  .table.responsive td {
    display: block;
    width: 100%;
  }
  .table.responsive thead {
    display: none;
  }
  .table.responsive tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .table.responsive tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 14px;
  }
  .table.responsive td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    text-align: right;
  }
  .table.responsive td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    flex: none;
  }
  .table.responsive td > * {
    min-width: 0;
  }
  .table.responsive td .stack {
    align-items: flex-end;
  }
  .table.responsive td.cell-primary {
    display: block;
    text-align: left;
    padding: 10px 0;
  }
  .table.responsive td.cell-primary .stack {
    align-items: flex-start;
  }
  .table.responsive td.cell-primary::before,
  .table.responsive td.cell-actions::before {
    content: none;
  }
  .table.responsive td.cell-actions {
    border-bottom: 0;
    justify-content: flex-end;
    padding: 10px 0 8px;
  }
  .table.responsive td.cell-error {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }
  .table.responsive tr > td:last-child {
    border-bottom: 0;
  }
  .table .num {
    white-space: normal;
  }
  .table.responsive td.cell-actions .btn {
    width: 100%;
  }
}

/* --- Audit ------------------------------------------------------------------------------------ */

.audit-list {
  list-style: none;
  margin: 0;
  padding: 0 16px;
}
.audit-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.audit-item:last-child {
  border-bottom: 0;
}
.audit-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.audit-top time {
  white-space: nowrap;
}
.details {
  margin: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}
.detail {
  display: flex;
  gap: 8px;
  min-width: 0;
}
.detail dt {
  color: var(--muted);
  flex: none;
}
.detail dt::after {
  content: ":";
}
.detail dd {
  margin: 0;
  min-width: 0;
}
.form-card .details {
  font-size: 15px;
  gap: 8px;
  margin-bottom: 12px;
}

/* --- Charts ----------------------------------------------------------------------------------- */

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
@media (min-width: 1024px) {
  .chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chart-grid > :first-child {
    grid-column: 1 / -1;
  }
}
.chart-card {
  padding: 14px 14px 8px;
  min-width: 0;
}
.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.chart-title {
  font-size: 15px;
  font-weight: 700;
}
.chart-total {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.chart-body {
  width: 100%;
  min-height: 190px;
  position: relative;
}
.chart-wrap {
  position: relative;
}
.chart {
  display: block;
  touch-action: pan-y;
  border-radius: 8px;
}
.chart .grid {
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 1;
}
.chart .axis {
  fill: var(--muted);
  font-size: 11px;
  font-family: var(--font);
}
.chart .bar-mark {
  fill: var(--brand);
}
.chart.c-blue .bar-mark {
  fill: var(--blue);
}
.chart .line-mark {
  fill: none;
  stroke: var(--brand);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart .area-mark {
  fill: var(--brand);
  fill-opacity: 0.18;
}
.chart.c-blue .line-mark {
  stroke: var(--blue);
}
.chart.c-blue .area-mark {
  fill: var(--blue);
}
.chart .guide {
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.chart .dot {
  fill: var(--text);
  stroke: var(--bg);
  stroke-width: 2;
}
.chart-tip {
  position: absolute;
  pointer-events: none;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.chart-tip .tip-day {
  color: var(--muted);
}
.chart-tip .tip-value {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.chart-empty {
  min-height: 190px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 16px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  font-size: 14px;
}

.seg {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}
.seg-btn {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.seg-btn[aria-pressed="true"] {
  background: var(--surface-3);
  color: var(--text);
}

/* --- Empty, error, skeleton ---------------------------------------------------------------------- */

.empty {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty-title {
  font-weight: 700;
}
.error-state .icon {
  color: var(--red);
}

.sk {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: shimmer 1.2s ease-in-out infinite;
}
.sk-w40 {
  width: 40%;
  height: 12px;
}
.sk-w60 {
  width: 60%;
  height: 16px;
}
.sk-big {
  width: 55%;
  height: 26px;
  margin-top: 6px;
}
.sk-bar {
  width: 100%;
  height: 8px;
  margin-top: 8px;
}
.sk-area {
  height: 170px;
  margin-top: 12px;
}
.sk-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sk-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sk-chart {
  padding: 14px;
  margin-top: 24px;
}
@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

/* --- Sheet / modal ------------------------------------------------------------------------------ */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.backdrop.open {
  opacity: 1;
}
.sheet {
  width: 100%;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  padding: 8px var(--gutter) calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateY(24px);
  transition: transform 0.2s ease;
}
.backdrop.open .sheet {
  transform: none;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-right: -8px;
  min-height: 52px;
}
.sheet-title {
  font-size: 19px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.sheet-head .icon-btn {
  border: 0;
  background: transparent;
}
.sheet-desc {
  color: var(--muted);
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}
.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}
@media (max-width: 480px) {
  .sheet .sheet-actions {
    flex-direction: column-reverse;
  }
  .sheet .sheet-actions .btn {
    width: 100%;
  }
}
@media (min-width: 769px) {
  .backdrop {
    align-items: center;
    padding: 24px;
  }
  .sheet {
    max-width: 480px;
    border-radius: 20px;
    border-bottom: 1px solid var(--border);
    padding: 12px 24px 24px;
  }
}
.action-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 0;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.action-item:hover {
  background: var(--surface-3);
}
.action-item .icon {
  color: var(--muted);
}
.action-item.danger,
.action-item.danger .icon {
  color: var(--red);
}

/* --- Toasts -------------------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2 * var(--gutter));
  max-width: 460px;
  top: calc(12px + env(safe-area-inset-top, 0px));
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 460px;
  width: 100%;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  font-size: 14px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.toast-ok .icon {
  color: var(--green);
}
.toast-error .icon {
  color: var(--red);
}

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