:root {
  color-scheme: light;
  font-family: Inter, "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: #17201f;
  background: #f4f7f6;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(13, 148, 136, 0.12), transparent 34rem),
    #f4f7f6;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 64px;
}

.auth-card {
  width: min(420px, 100%);
  margin: 8vh auto 0;
  padding: 38px;
  border: 1px solid #dfe8e5;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 70px rgba(17, 45, 41, 0.12);
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 22px;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: #0f766e;
  font-size: 24px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 6px;
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(27px, 4vw, 38px);
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 0;
  font-size: 23px;
  letter-spacing: -0.02em;
}

.subtitle,
.footnote {
  color: #667572;
}

.subtitle {
  margin-bottom: 28px;
}

.stack {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: #354541;
  font-size: 14px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid #cbd8d4;
  border-radius: 11px;
  padding: 12px 13px;
  color: #17201f;
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
}

select {
  min-height: 44px;
  cursor: pointer;
}

.primary,
.secondary {
  border-radius: 11px;
  padding: 11px 18px;
  font-weight: 800;
}

.primary {
  border: 1px solid #0f766e;
  color: #fff;
  background: #0f766e;
}

.primary:hover:not(:disabled) {
  background: #0b625b;
}

.secondary {
  border: 1px solid #cbd8d4;
  color: #354541;
  background: #fff;
}

.admin-view {
  display: grid;
  gap: 24px;
}

.admin-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px;
  border: 1px solid #dfe8e5;
  border-radius: 14px;
  background: #fff;
}

.nav-tab {
  flex: 1 0 auto;
  border: 0;
  border-radius: 9px;
  padding: 11px 16px;
  color: #596966;
  background: transparent;
  font-weight: 800;
}

.nav-tab:hover {
  color: #0f766e;
  background: #f0f8f6;
}

.nav-tab.active {
  color: #fff;
  background: #0f766e;
}

.tab-content {
  display: grid;
  gap: 24px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.account {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #667572;
  font-size: 14px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid #dfe8e5;
  border-radius: 16px;
  background: #fff;
}

.summary > div {
  display: grid;
  gap: 5px;
  padding: 20px 24px;
}

.summary > div + div {
  border-left: 1px solid #e5ecea;
}

.summary-label {
  color: #72817e;
  font-size: 12px;
  font-weight: 700;
}

.panel {
  overflow: hidden;
  border: 1px solid #dfe8e5;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 40px rgba(17, 45, 41, 0.07);
}

.panel-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 26px;
  border-bottom: 1px solid #e5ecea;
}

.unit {
  color: #667572;
  font-size: 13px;
  font-weight: 700;
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid #e5ecea;
  background: #fafcfb;
}

.sales-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 24px;
}

.sale-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid #dfe8e5;
  border-radius: 14px;
  padding: 20px;
  background: #fafcfb;
}

.sale-card span {
  display: grid;
  gap: 6px;
}

.sale-card strong {
  font-size: 16px;
}

.sale-card small {
  color: #667572;
  font-weight: 500;
}

.sale-card input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: #0f766e;
}

.plan-catalog {
  padding: 0 24px 24px;
}

.plan-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.plan-card {
  min-width: 190px;
  border-radius: 12px;
  padding: 16px 18px;
  color: #0f4f49;
  background: #eaf7f4;
}

.plan-card strong,
.plan-card span {
  display: block;
}

.plan-card span {
  margin-top: 5px;
  color: #465652;
  font-size: 13px;
}

.filter-bar label {
  min-width: 170px;
}

.filter-bar .search-field {
  flex: 1 1 320px;
}

.filter-bar input,
.filter-bar select {
  min-height: 44px;
  background: #fff;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 17px 20px;
  border-bottom: 1px solid #edf2f0;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #72817e;
  background: #fafcfb;
  font-size: 12px;
  letter-spacing: 0.035em;
}

td {
  font-size: 14px;
}

td strong {
  display: block;
  font-size: 14px;
}

.cell-detail {
  display: block;
  margin-top: 5px;
  color: #72817e;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.nowrap {
  white-space: nowrap;
}

.reference,
.failure-detail {
  max-width: 280px;
  overflow-wrap: anywhere;
  color: #667572;
  font-size: 12px;
}

.failure-detail {
  color: #b42318;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-success {
  color: #08745f;
  background: #e8f7f2;
}

.status-warning {
  color: #9a5b08;
  background: #fff5d9;
}

.status-error {
  color: #b42318;
  background: #feeceb;
}

.status-muted {
  color: #596966;
  background: #edf2f0;
}

tr:last-child td {
  border-bottom: 0;
}

.operator {
  min-width: 120px;
  font-size: 16px;
  font-weight: 800;
}

.rate-input {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.rate-input input {
  width: 112px;
  font-size: 16px;
  font-weight: 800;
  text-align: right;
}

.prefixes {
  min-width: 240px;
  color: #465652;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.note {
  min-width: 250px;
  color: #667572;
  line-height: 1.55;
}

.inline-warning {
  color: #b45309;
  font-size: 12px;
  font-weight: 800;
}

.actions {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding: 16px 24px;
  border-top: 1px solid #e5ecea;
  background: #fafcfb;
}

.message {
  margin: 0 auto 0 0;
  color: #465652;
  font-size: 13px;
  font-weight: 700;
}

.message.error {
  color: #b42318;
}

.message.success {
  color: #08745f;
}

.auth-card .message {
  margin-top: 18px;
}

.loading {
  padding: 38px;
  color: #72817e;
  text-align: center;
}

.table-error {
  color: #b42318;
}

.pagination {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 14px 24px;
  border-top: 1px solid #e5ecea;
  color: #667572;
  background: #fafcfb;
  font-size: 13px;
  font-weight: 700;
}

.pager-button {
  min-width: 72px;
  padding: 8px 12px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.footnote {
  margin: -8px 2px 0;
  font-size: 12px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding-top: 24px;
  }

  .auth-card {
    margin-top: 3vh;
    padding: 28px 22px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .account {
    width: 100%;
    justify-content: space-between;
  }

  .summary {
    grid-template-columns: 1fr;
  }

  .sales-grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .summary > div + div {
    border-top: 1px solid #e5ecea;
    border-left: 0;
  }

  .panel-heading,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-bar {
    align-items: stretch;
    flex-direction: column;
    padding: 14px 16px;
  }

  .filter-bar label,
  .filter-bar .search-field {
    min-width: 0;
    flex-basis: auto;
  }

  .filter-bar .secondary {
    width: 100%;
  }

  .pagination {
    justify-content: center;
    padding-inline: 14px;
  }

  .actions .primary {
    width: 100%;
  }
}
