@import url("tokens.css");

[x-cloak] { display: none; }

body {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.5;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input, textarea {
  font-feature-settings: "calt" 0;
}

body.auth-canvas {
  background: hsl(240 5% 92%);
}
.dark body.auth-canvas {
  background: hsl(240 10% 7%);
}

h1:not([data-slot]), h2:not([data-slot]), h3:not([data-slot]) {
  color: hsl(var(--foreground));
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

h1:not([data-slot]) { font-size: 1.5rem; margin-bottom: 1rem; }
h2:not([data-slot]) { font-size: 1.25rem; margin-bottom: 0.75rem; }
h3:not([data-slot]) { font-size: 1.125rem; margin-bottom: 0.5rem; }

.contract-terms-embed .package-name:not([data-slot]) { font-size: 1rem; margin-bottom: 0; }
.contract-terms-embed h2:not([data-slot]) { font-size: 0.875rem; margin-bottom: 0.5rem; }
.contract-terms-embed h3:not([data-slot]) { font-size: 0.8125rem; margin-bottom: 0; }

.contract-terms-embed .section-header h2:not([data-slot]) { font-size: 0.75rem; margin-bottom: 0; }
.contract-terms-embed .rate-table-section h2:not([data-slot]) { font-size: 0.75rem; }
.contract-terms-embed .highlight-grid h3:not([data-slot]) { font-size: 0.9375rem; }

.contract-terms-embed .section-header h2:not([data-slot]),
.contract-terms-embed .package .rate-table-section h2:not([data-slot]) { color: var(--ct-accent); }

.container {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.5rem;
}

.flash-messages {
  padding: 0 1.5rem;
  max-width: 1120px;
  margin: 0 auto;
}

.flash-messages:empty {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.25rem;
  padding: 0 1rem;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
  text-decoration: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring));
}

.btn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.btn-bankid {
  background: #183e4f;
  color: #ffffff;
  height: 2.5rem;
  padding: 0 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 150ms ease;
  font-family: var(--font-sans);
}

.btn-bankid:hover {
  background: #12303d;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.table th,
.table td {
  padding: 0 0.75rem;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
}

.table th {
  font-weight: 500;
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  border-bottom: 1px solid hsl(var(--border));
  height: 2.5rem;
  vertical-align: middle;
}

.table td {
  border-bottom: 1px solid hsl(var(--border));
  height: 2.75rem;
  vertical-align: middle;
}

.table tbody tr:hover {
  background: hsl(var(--muted) / 0.5);
}

.col-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table td.col-amount,
.table th.col-amount {
  text-align: right;
}

.row-voided {
  opacity: 0.6;
}

.filter-bar {
  margin-bottom: 1rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: hsl(var(--muted-foreground));
}

.empty-state h1,
.empty-state h3 {
  margin-bottom: 0.5rem;
  color: hsl(var(--foreground));
}

.bankid-message {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

.data-table-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.data-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.data-table-toolbar-left {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.data-table-filter-input {
  height: 2rem;
  width: 9.375rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--input));
  background: transparent;
  padding: 0.25rem 0.625rem;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  line-height: 1.25rem;
  color: hsl(var(--foreground));
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.data-table-filter-input::placeholder {
  color: hsl(var(--muted-foreground));
}

.data-table-filter-input:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

@media (min-width: 1024px) {
  .data-table-filter-input {
    width: 15.625rem;
  }
}

.data-table-container {
  overflow-x: auto;
  border-radius: 0.375rem;
  border: 1px solid hsl(var(--border));
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table-head {
  height: 2.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  text-align: left;
  vertical-align: middle;
  font-weight: 500;
  white-space: nowrap;
  color: hsl(var(--muted-foreground));
  border-bottom: 1px solid hsl(var(--border));
}

.data-table-head.col-amount {
  text-align: right;
}

.data-table-cell {
  padding: 0.5rem;
  vertical-align: middle;
  white-space: nowrap;
  border-bottom: 1px solid hsl(var(--border));
}

.data-table-row {
  transition: background-color 150ms ease;
}

.data-table-row:hover {
  background-color: hsl(var(--muted) / 0.5);
}

.data-table-row:last-child .data-table-cell {
  border-bottom: none;
}

.data-table-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 500;
  height: 1.75rem;
  padding: 0 0.625rem;
  margin-left: -0.625rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease;
  text-decoration: none;
}

.data-table-sort-btn:hover {
  background-color: hsl(var(--muted));
  color: hsl(var(--foreground));
}

.data-table-sort-btn--active {
  color: hsl(var(--foreground));
}

.data-table-sort-btn svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.data-table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  padding: 0 0.25rem;
}

.data-table-pagination-info {
  font-size: 0.8125rem;
  color: hsl(var(--muted-foreground));
  font-variant-numeric: tabular-nums;
}

.data-table-pagination-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.data-table-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background-color 150ms ease;
  text-decoration: none;
}

.data-table-page-btn:hover {
  background-color: hsl(var(--muted));
}

.data-table-page-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.data-table-page-btn svg {
  width: 1rem;
  height: 1rem;
}

@media (max-width: 767px) {
  .container {
    padding: 1rem;
  }

  .data-table-container {
    border: none;
    border-radius: 0;
  }

  .data-table-head {
    display: none;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody tr {
    display: block;
    margin-bottom: 0.5rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 0.5rem;
  }

  .data-table-cell {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    border-bottom: none;
    height: auto;
    white-space: normal;
  }

  .data-table-cell::before {
    content: attr(data-label);
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
  }

  .data-table-sort-btn {
    display: none;
  }

  .data-table-pagination {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .table thead { display: none; }

  .table tbody tr {
    display: block;
    margin-bottom: 0.5rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 0.5rem;
  }

  .table td {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    border-bottom: none;
    height: auto;
  }

  .table td::before {
    content: attr(data-label);
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    font-size: 0.75rem;
  }
}

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

dialog[open] {
  opacity: 1;
  scale: 1;
  transition:
    opacity 160ms ease,
    scale 160ms ease,
    overlay 160ms ease allow-discrete,
    display 160ms ease allow-discrete;
}
dialog {
  opacity: 0;
  scale: 0.96;
}
@starting-style {
  dialog[open] {
    opacity: 0;
    scale: 0.96;
  }
}
dialog::backdrop {
  transition:
    opacity 160ms ease,
    overlay 160ms ease allow-discrete,
    display 160ms ease allow-discrete;
  opacity: 0;
}
dialog[open]::backdrop {
  opacity: 1;
}
@starting-style {
  dialog[open]::backdrop {
    opacity: 0;
  }
}

.skip-link { position: absolute; left: 0.5rem; top: -4rem; z-index: 1000; padding: 0.5rem 0.75rem; background: hsl(var(--card)); color: hsl(var(--foreground)); border: 2px solid hsl(var(--ring)); border-radius: var(--radius); font-size: 0.875rem; font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 0.5rem; }
main[tabindex="-1"]:focus { outline: none; }
