#session-status[hidden],
#session-retry[hidden] {
  display: none !important;
}

:root {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  color: #e9f0f7;
  background: #0d1724;
  line-height: 1.45;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: #0d1724;
}
.wrap {
  max-width: 1380px;
  margin: 0 auto;
  padding: 28px 30px 64px;
}
.top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 1px solid #26384b;
}
h1 {
  font-size: 29px;
  letter-spacing: 0;
  margin: 0 0 6px;
  color: #f3f7fb;
  font-weight: 700;
}
h1:before {
  content: "PRICE WATCH";
  display: block;
  color: #5bd6c0;
  font-size: 11px;
  letter-spacing: 0.16em;
  margin-bottom: 9px;
  font-weight: 700;
}
h2 {
  font-size: 21px;
  margin: 0;
  color: #f3f7fb;
}
h3 {
  font-size: 15px;
  margin: 0;
  color: #e8f1f6;
}
p {
  margin: 0;
  color: #91a4b8;
  font-size: 14px;
}
.actions,
.nav,
.toolbar,
.form-actions {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
}
.actions {
  flex-shrink: 0;
}
button {
  border: 1px solid #50cdb7;
  border-radius: 4px;
  padding: 9px 14px;
  background: #53cdb7;
  color: #08221f;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
button:hover {
  background: #72e0cd;
}
button:disabled {
  background: #526475;
  border-color: #526475;
  color: #c6d2dd;
  cursor: wait;
}
.button-quiet {
  background: #233548;
  border-color: #526475;
  color: #dce8f1;
}
.button-danger {
  background: #4a252e;
  border-color: #b75d69;
  color: #ffd9dc;
}
.badge {
  font-size: 12px;
  font-weight: 700;
  padding: 7px 10px;
  border-radius: 4px;
  background: #233548;
  color: #b5c5d4;
}
.badge.ok {
  color: #6ce1bc;
  background: #123d3a;
}
.badge.err {
  color: #ff9898;
  background: #4a252e;
}
.view-nav {
  display: flex;
  gap: 3px;
  margin: 20px 0 24px;
  border-bottom: 1px solid #26384b;
}
.tab {
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 11px 17px;
  background: transparent;
  color: #91a4b8;
}
.tab:hover {
  color: #dce8f1;
  background: #142333;
}
.tab.active {
  border-bottom-color: #53cdb7;
  color: #73e0ce;
  background: #142333;
}
.view {
  display: none;
}
.view.active {
  display: block;
}
.overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-bottom: 20px;
  background: #26384b;
  border: 1px solid #26384b;
}
.stat {
  background: #142333;
  padding: 16px 19px;
}
.stat-label {
  font-size: 11px;
  color: #8398aa;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: #f2f7fa;
  margin-top: 4px;
}
.panel {
  background: #142333;
  border: 1px solid #26384b;
  border-radius: 4px;
  padding: 17px 18px;
  margin-bottom: 18px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 15px;
  margin: 0 0 16px;
}
.page-head p {
  margin-top: 5px;
}
.filters,
.toolbar {
  background: #142333;
  border: 1px solid #26384b;
  border-radius: 4px;
  padding: 13px 15px;
  margin: 0 0 14px;
}
.filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  column-gap: 18px;
  row-gap: 12px;
}
.filters label,
.toolbar label,
.field label {
  color: #91a4b8;
  font-size: 12px;
  white-space: nowrap;
}
.filters select,
.filters input,
.toolbar select,
.field input,
.field select {
  border: 1px solid #38516a;
  border-radius: 3px;
  background: #0d1724;
  color: #e9f0f7;
  padding: 8px 10px;
  font-size: 13px;
}
.filters input {
  min-width: 210px;
}
.filter-count {
  color: #91a4b8;
  font-size: 12px;
  margin-left: auto;
}
.billing-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 14px;
  color: #91a4b8;
  font-size: 12px;
}
.billing-legend strong {
  color: #dce8f1;
  margin-right: 3px;
}
.legend-item {
  border: 1px solid #30465a;
  background: #142333;
  padding: 5px 8px;
  border-radius: 3px;
}
.model-table-wrap {
  background: #f6f8fa;
  border-radius: 4px;
  overflow: auto;
  box-shadow: 0 10px 24px #00000025;
}
.model-table {
  width: 100%;
  border-collapse: collapse;
  color: #15283b;
  font-size: 12px;
  min-width: 1100px;
}
.model-table th {
  position: sticky;
  top: 0;
  text-align: left;
  color: #718392;
  font-size: 11px;
  font-weight: 700;
  padding: 11px 13px;
  background: #e4edf1;
  border-bottom: 2px solid #cad8df;
  white-space: nowrap;
}
.model-table td {
  padding: 12px 13px;
  border-bottom: 1px solid #e3e9ee;
  vertical-align: top;
}
.model-table tbody tr.provider-start td {
  border-top: 3px solid #b8cbd2;
}
.model-table tbody tr:hover {
  background: #eef7f6;
}
.model-table .provider {
  font-weight: 700;
  color: #183c5b;
  white-space: nowrap;
  background: #e5eef1;
  border-left: 4px solid #7ccdc0;
}
.model-table .model-name {
  font-size: 14px;
  font-weight: 700;
  color: #102f4b;
  white-space: nowrap;
}
.model-table .model-id {
  font-size: 11px;
  color: #718392;
  margin-top: 3px;
}
.checked {
  color: #627789;
  white-space: nowrap;
  line-height: 1.5;
}
.checked strong {
  display: block;
  color: #28465f;
  font-size: 12px;
}
.price-cell {
  min-width: 640px;
}
.matrix {
  width: 100%;
  border-collapse: collapse;
  color: #294256;
  font-size: 12px;
}
.matrix th {
  text-align: left;
  color: #718392;
  font-size: 11px;
  font-weight: 700;
  padding: 6px 8px;
  background: #e7eff2;
  border-bottom: 1px solid #c9d8de;
}
.matrix td {
  padding: 7px 8px;
  border-top: 1px solid #dbe5e9;
  vertical-align: top;
}
.matrix-condition {
  color: #536b7b;
  min-width: 210px;
  line-height: 1.4;
}
.matrix-amount {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-weight: 800;
  color: #087d70;
  white-space: nowrap;
}
.matrix-amount small {
  display: inline-block;
  color: #31586b;
  font-weight: 700;
  font-size: 10px;
  line-height: 1.3;
  background: #dce9ed;
  border: 1px solid #c0d4da;
  border-radius: 3px;
  padding: 2px 5px;
}
.matrix-empty {
  color: #a6b3bb;
  text-align: center;
}
.not-found {
  font-size: 12px;
  color: #9a6411;
  background: #fff1cb;
  border-radius: 3px;
  padding: 8px 10px;
  line-height: 1.5;
}
.empty {
  color: #91a4b8;
  background: #142333;
  border: 1px dashed #3b5064;
  padding: 20px;
  border-radius: 4px;
  text-align: center;
}
.form-title {
  font-size: 14px;
  font-weight: 700;
  color: #dce8f1;
  margin-bottom: 12px;
}
.model-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field input {
  width: 190px;
}
.field input.aliases {
  width: 270px;
}
.field input:disabled {
  color: #718392;
  background: #1a2938;
}
.form-actions {
  padding-bottom: 1px;
}
.model-list {
  overflow: auto;
}
.admin-table,
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.admin-table th,
.history-table th {
  text-align: left;
  color: #91a4b8;
  font-weight: 700;
  background: #1a2a3a;
  padding: 10px;
  border-bottom: 1px solid #30465a;
  white-space: nowrap;
}
.admin-table td,
.history-table td {
  padding: 11px 10px;
  border-bottom: 1px solid #26384b;
  vertical-align: top;
  color: #dce8f1;
}
.admin-table tr:hover,
.history-table tr:hover {
  background: #1a2d3e;
}
.admin-table .key,
.history-table .time {
  color: #91a4b8;
  white-space: nowrap;
}
.admin-table .alias {
  color: #91a4b8;
  max-width: 300px;
  line-height: 1.5;
}
.history-table .ok {
  color: #6ce1bc;
}
.history-table .error {
  color: #ff9898;
}
.history-details {
  margin-top: 14px;
}
.history-details h3 {
  margin-bottom: 9px;
}
.history-error {
  color: #ff9b9b;
  margin-top: 4px;
  white-space: pre-wrap;
}
.history-provider {
  padding: 3px 0;
  color: #91a4b8;
}
.section-note {
  color: #91a4b8;
  font-size: 12px;
}
@media (max-width: 700px) {
  #prices-view .filters {
    display: grid; grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px 8px; align-items: center;
  }
  #prices-view .filters > input, #prices-view .filters > select {
    width: 100%; min-width: 0; box-sizing: border-box;
  }
  #prices-view .filters > .check-filter, #prices-view .filters > button,
  #prices-view .filters > #filter-count { grid-column: 1 / -1; justify-self: start; }
  .wrap {
    padding: 22px 14px 44px;
  }
  .top {
    display: block;
  }
  .actions {
    margin-top: 16px;
  }
  .overview {
    grid-template-columns: 1fr 1fr;
  }
  .overview .stat:last-child {
    grid-column: 1/-1;
  }
  .page-head {
    display: block;
  }
  .model-form .field,
  .field input,
  .field input.aliases {
    width: 100%;
  }
  .filters {
    gap: 12px;
  }
  .filters input,
  .filters select {
    min-width: 0;
    flex: 1 1 180px;
    width: 100%;
  }
  .filters label {
    margin-left: 2px;
  }
  .filter-count {
    margin-left: 0;
    width: 100%;
  }
}
/* Detail disclosure keeps the operational table usable on narrow screens. */
#model-history-dialog {
  width: min(900px, calc(100% - 32px));
  max-height: 85dvh;
  box-sizing: border-box;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 20px;
  color: var(--text-primary);
  background: var(--bg-surface, white);
}
#model-history-dialog::backdrop { background: rgb(0 0 0 / 35%); }
#model-history-dialog form { float: right; }
#model-history-dialog details { padding: 12px 0; border-bottom: 1px solid var(--border-subtle); }
#model-history-dialog summary { cursor: pointer; }
#estimate-result { display: block; margin-top: 12px; overflow-wrap: anywhere; }
[data-pair] { width: 130px; max-width: 100%; box-sizing: border-box; }
@media (min-width: 701px) {
  .home-model-table .price-cell > details > summary { display: none; }
}
@media (max-width: 700px) {
  #prices-view .home-model-table { min-width: 0 !important; table-layout: auto; }
  #prices-view .home-model-table > thead { display: none; }
  #prices-view .home-model-table > tbody > tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    border-bottom: 1px solid var(--border-subtle);
  }
  #prices-view .home-model-table > tbody > tr > td {
    width: auto !important; min-width: 0 !important; border: 0; overflow-wrap: anywhere;
  }
  #prices-view .home-model-table > tbody > tr > td.row-number { display: none; }
  #prices-view .home-model-table > tbody > tr > td.price-cell { grid-column: 1 / -1; overflow: auto; }
  #prices-view .home-model-table .price-cell > details > summary { cursor: pointer; padding: 8px 0; }
}
