:root {
  --navy: #174f95;
  --navy-strong: #092958;
  --navy-soft: #eaf2fd;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    sans-serif;
  color: #14151a;
  background: #f5f6f8;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
}
.hidden {
  display: none !important;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--navy-strong), var(--navy));
  color: #fff;
  padding: 11px 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 7px 18px #123d7826;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px #123d7840;
}
button:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px #123d7830;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}
.secondary {
  background: #f4f6fa;
  color: var(--navy);
  border: 1px solid #d4dded;
  box-shadow: 0 2px 8px #0b2a5708;
}
.secondary:hover {
  background: #e8ecf4;
  border-color: #b7c5dc;
}
.brand-logo {
  width: 58px;
  height: 58px;
  border-radius: 17px;
  object-fit: contain;
  box-shadow:
    inset 0 0 0 1px #ffffff20,
    0 12px 28px #0002;
}
.brand-logo.small {
  width: 41px;
  height: 41px;
  border-radius: 12px;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  font-weight: 800;
  color: #858892;
  margin: 0 0 8px;
}
.muted {
  color: #767983;
}
.error {
  color: #d93939;
  min-height: 20px;
  font-size: 13px;
}
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(
    circle at 50% 20%,
    #fff 0,
    #f4f5f7 45%,
    #eceef1 100%
  );
}
.login-card {
  width: min(420px, calc(100vw - 32px));
  padding: 42px;
  background: #fff;
  border: 1px solid #e4e5e9;
  border-radius: 24px;
  box-shadow: 0 24px 70px #16181d16;
}
.login-card .brand-logo {
  margin-bottom: 30px;
}
.login-card h1 {
  font-size: 30px;
  margin: 0;
}
.login-card button {
  width: 100%;
  margin-top: 8px;
}
.login-card label {
  display: grid;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  margin: 28px 0 16px;
}
input,
select,
textarea {
  width: 100%;
  border: 1px solid #d9dbe1;
  background: #fff;
  border-radius: 11px;
  padding: 11px 13px;
  outline: none;
}
select {
  appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23092958' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px #102a5614;
}
header {
  height: 72px;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid #ffffff24;
  background:
    radial-gradient(circle at 15% 0%, #3979c8 0, transparent 34%),
    linear-gradient(115deg, #092958 0%, #123d78 58%, #1d5ca4 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  box-shadow: 0 10px 30px #0929581f;
}
header::after {
  position: absolute;
  top: -92px;
  right: 10%;
  width: 280px;
  height: 180px;
  border: 1px solid #ffffff18;
  border-radius: 50%;
  box-shadow:
    58px 42px 0 -1px #ffffff0a,
    116px 82px 0 -1px #ffffff08;
  content: "";
  transform: rotate(-12deg);
  pointer-events: none;
}
header > * {
  position: relative;
  z-index: 1;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand b,
.brand span {
  display: block;
}
.brand b {
  color: #fff;
}
.brand span {
  font-size: 12px;
  color: #c8daf3;
  margin-top: 2px;
}
header .brand-logo.small {
  box-shadow:
    inset 0 0 0 1px #ffffff35,
    0 8px 22px #061a384d;
}
header .secondary {
  border-color: #ffffff42;
  background: #ffffff14;
  color: #fff;
  box-shadow: none;
  backdrop-filter: blur(8px);
}
header .secondary:hover {
  border-color: #ffffff70;
  background: #ffffff25;
  box-shadow: 0 8px 20px #061a3833;
}
.container {
  max-width: 1180px;
  margin: auto;
  padding: 52px 28px;
}
.page-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.page-title h1 {
  font-size: 36px;
  letter-spacing: -0.04em;
  margin: 0 0 8px;
  color: var(--navy-strong);
}
.page-title p:last-child {
  margin: 0;
}
.toolbar {
  margin-top: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.toolbar input {
  width: 360px;
  background: #fff;
}
.toolbar-filters {
  display: flex;
  align-items: center;
  gap: 9px;
}
.toolbar-filters select {
  width: auto;
  min-width: 170px;
  background-color: #fff;
}
.table-wrap {
  margin-top: 16px;
  background: #fff;
  border: 1px solid #e1e2e6;
  border-radius: 17px;
  overflow-x: auto;
  overflow-y: hidden;
  box-shadow: 0 5px 20px #1111;
  scrollbar-color: #b7c3d6 #eef1f5;
  scrollbar-width: thin;
}
.table-wrap::-webkit-scrollbar {
  height: 10px;
}
.table-wrap::-webkit-scrollbar-track {
  background: #eef1f5;
}
.table-wrap::-webkit-scrollbar-thumb {
  background: #b7c3d6;
  border: 2px solid #eef1f5;
  border-radius: 20px;
}
table {
  width: 100%;
  min-width: 1258px;
  border-collapse: collapse;
  text-align: left;
}
th {
  padding: 13px 10px;
  color: #82858e;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #fafafa;
  border-bottom: 1px solid #e5e6e9;
  white-space: nowrap;
}
td {
  padding: 16px 10px;
  border-bottom: 1px solid #ececef;
  font-size: 14px;
  white-space: nowrap;
}
th:nth-child(1),
td:nth-child(1) {
  width: 180px;
}
th:nth-child(2),
td:nth-child(2) {
  width: 275px;
}
th:nth-child(3),
td:nth-child(3) {
  width: 170px;
}
th:nth-child(4),
td:nth-child(4) {
  width: 130px;
}
th:nth-child(5),
td:nth-child(5) {
  width: 95px;
}
th:nth-child(6),
td:nth-child(6) {
  width: 80px;
}
th:nth-child(7),
td:nth-child(7) {
  width: 180px;
}
th:nth-child(8),
td:nth-child(8) {
  width: 120px;
  min-width: 120px;
  position: sticky;
  right: 118px;
  z-index: 2;
  background: #fff;
  box-shadow: -10px 0 18px -18px #092958cc;
}
th:nth-child(9),
td:nth-child(9) {
  width: 118px;
  min-width: 118px;
  position: sticky;
  right: 0;
  z-index: 2;
  background: #fff;
}
th:nth-child(8),
th:nth-child(9) {
  z-index: 3;
  background: #fafafa;
}
th:nth-child(8) {
  padding-right: 6px;
  text-align: right;
}
td:nth-child(8) {
  padding-right: 6px;
  text-align: right;
}
td:nth-child(9) {
  padding-left: 6px;
}
td:nth-child(9) .row-actions {
  justify-content: flex-start;
}
tbody tr:last-child td {
  border-bottom: 0;
}
.customer {
  display: block;
  max-width: 160px;
  overflow: hidden;
  font-weight: 750;
  color: var(--navy-strong);
  text-overflow: ellipsis;
}
.key-prefix {
  font-family: ui-monospace, SFMono-Regular, monospace;
  color: #686b74;
}
.key-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 265px;
}
.key-cell code {
  font-family: ui-monospace, SFMono-Regular, monospace;
  color: #393b43;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.current-device-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 170px;
}
.current-device-cell > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.current-device-cell code {
  color: var(--navy-strong);
  font:
    700 12px ui-monospace,
    SFMono-Regular,
    monospace;
}
.current-device-cell small {
  color: #858892;
  font-size: 11px;
}
.no-device {
  color: #989ba3;
  font-size: 12px;
  white-space: nowrap;
}
.copy-key-button {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  padding: 7px;
  border-radius: 8px;
  color: var(--navy);
  background: var(--navy-soft);
  border: 1px solid #cedbef;
}
.copy-key-button svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.regenerate-key-button {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 8px;
  color: #9b3036;
  background: #fff2f2;
  border: 1px solid #f1cfd1;
  font-size: 11px;
}
.badge {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 750;
}
.remaining {
  display: inline-flex;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 750;
}
.remaining-ok {
  color: var(--navy);
}
.remaining-warning {
  color: #b56b09;
}
.remaining-urgent,
.remaining-ended {
  color: #b62f35;
}
.active {
  background: #e7f8ee;
  color: #177845;
}
.revoked,
.expired {
  background: #ffebeb;
  color: #b62f35;
}
.device {
  font-weight: 750;
  background: #e8f0fe;
  color: var(--navy);
  border: 1px solid #c5d9f7;
  box-shadow: none;
}
.device:hover {
  background: #d4e4fc;
  border-color: #a8c4f0;
}
.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}
.row-actions button {
  padding: 7px 12px;
  font-size: 12px;
  border-radius: 8px;
}
.row-actions button.secondary {
  background: #ffebeb;
  color: #b62f35;
  border: 1px solid #f0c8cc;
  box-shadow: none;
}
.row-actions button.secondary:hover {
  background: #ffd6da;
  border-color: #df9fa5;
}
.row-actions .delete-license-button {
  border: 1px solid #f0c8cc;
  background: #ffebeb;
  color: #b62f35;
  box-shadow: none;
}
.row-actions .delete-license-button:hover {
  border-color: #df9fa5;
  background: #ffd6da;
  box-shadow: 0 4px 12px #b62f351a;
}
.empty {
  text-align: center;
  padding: 64px;
  color: #888;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.pagination .pagination-button {
  display: grid;
  width: 38px;
  height: 38px;
  min-width: 38px;
  padding: 0;
  place-items: center;
  border-radius: 10px;
}
.pagination-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pagination span {
  min-width: 86px;
  color: #666b75;
  font-size: 13px;
  font-weight: 750;
  text-align: center;
}
dialog {
  border: 0;
  border-radius: 20px;
  padding: 0;
  width: min(570px, calc(100vw - 30px));
  box-shadow: 0 35px 90px #0004;
  max-height: calc(100vh - 32px);
}
dialog::backdrop {
  background: #11182080;
  backdrop-filter: blur(3px);
}
#license-form {
  padding: 28px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
.password-card {
  padding: 28px;
}
.password-fields {
  grid-template-columns: 1fr;
}
.password-card .error {
  margin: 12px 0 0;
}
.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.dialog-head h2 {
  margin: 0;
  font-size: 25px;
}
.icon {
  border-radius: 50%;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 22px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
  margin-top: 26px;
}
.form-grid label {
  font-size: 12px;
  font-weight: 750;
  display: grid;
  gap: 7px;
}
.full {
  grid-column: 1/-1;
}
.duration-field {
  border: 0;
  padding: 0;
  margin: 0;
}
.duration-field legend {
  font-size: 12px;
  font-weight: 750;
  margin-bottom: 9px;
}
.duration-options {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}
.duration-options button {
  padding: 10px 7px;
  color: #4c4f58;
  background: #fff;
  border: 1px solid #dcdde2;
  font-size: 12px;
}
.duration-options button.selected {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}
.form-grid small {
  color: #858892;
  font-weight: 500;
}
.device-limit-note {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 13px 14px;
  border-radius: 12px;
  background: #f4f5f7;
  color: #555861;
  font-size: 12px;
}
.device-limit-note b {
  color: #1b1c21;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 25px;
}
.sticky-actions {
  position: sticky;
  bottom: -28px;
  padding: 16px 0 2px;
  background: #fff;
  border-top: 1px solid #ececef;
  z-index: 2;
}
.key-card {
  text-align: center;
  padding: 38px;
}
.success-icon {
  margin: auto;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #e3f8ec;
  color: #16824a;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 900;
}
.key-card code {
  display: block;
  margin: 24px 0 14px;
  padding: 16px;
  border-radius: 12px;
  background: #f1f2f4;
  font-size: 16px;
  font-weight: 800;
  word-break: break-all;
}
.key-card button {
  width: 100%;
  margin-top: 8px;
}
.device-card {
  padding: 28px;
}
.device-empty {
  padding: 35px 12px;
  text-align: center;
  color: #81848c;
}
.device-detail {
  margin-top: 24px;
  border: 1px solid #e2e3e7;
  border-radius: 14px;
  overflow: hidden;
}
.device-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #fafbfc;
  border-bottom: 1px solid #e2e3e7;
}
.device-kind {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
}
.device-kind.current {
  color: #166c45;
  background: #e7f8ee;
}
.device-kind.history {
  color: #6d7078;
  background: #eceef1;
}
.device-current {
  border-color: #b9cae2;
  box-shadow: 0 0 0 2px #102a560d;
}
.device-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid #ececef;
  font-size: 13px;
}
.device-row:last-child {
  border-bottom: 0;
}
.device-restore-row {
  padding: 12px 14px;
  background: var(--navy-soft);
  border-top: 1px solid #d9e3f2;
}
.device-restore-note {
  padding: 11px 14px;
  color: #777a83;
  background: #f5f6f8;
  border-top: 1px solid #e4e5e8;
  font-size: 12px;
}
.restore-device-button {
  width: 100%;
  padding: 9px 12px;
  background: var(--navy);
  font-size: 12px;
}
.device-row span:first-child {
  color: #858892;
}
.device-id {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  word-break: break-all;
}
.danger-button {
  background: #c8323a;
}
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: var(--navy-strong);
  color: #fff;
  padding: 13px 17px;
  border-radius: 11px;
  box-shadow: 0 10px 30px #0003;
}
.danger {
  color: #c62f36 !important;
}
@media (max-width: 760px) {
  header {
    padding: 0 18px;
  }
  .container {
    padding: 32px 16px;
  }
  .page-title {
    align-items: flex-start;
    flex-direction: column;
  }
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .toolbar input {
    width: 100%;
  }
  .toolbar-filters {
    width: 100%;
    flex-wrap: wrap;
  }
  .toolbar-filters select {
    flex: 1 1 180px;
  }
  .table-wrap {
    overflow: auto;
  }
  table {
    min-width: 1258px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid label {
    grid-column: 1;
  }
  .duration-options {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  .brand span {
    display: none;
  }
  .header-actions {
    gap: 6px;
  }
  header .secondary {
    padding: 9px 10px;
    font-size: 12px;
  }
}

/* ── Crawl history ──────────────────────────────────────────── */
#crawl-dialog {
  width: min(855px, calc(100vw - 30px));
}
#crawl-dialog .device-card {
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}
#crawl-dialog .dialog-head {
  flex-shrink: 0;
}
#crawl-dialog .crawl-summary {
  flex-shrink: 0;
}
#crawl-dialog #crawl-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}
#crawl-dialog .dialog-actions {
  flex-shrink: 0;
}
.crawl-summary {
  padding: 10px 16px;
  background: var(--navy-soft);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--navy-strong);
}
.crawl-btn {
  font-variant-numeric: tabular-nums;
  background: #e8f0fe;
  color: var(--navy);
  border: 1px solid #c5d9f7;
  box-shadow: none;
  font-weight: 700;
}
.crawl-btn:hover {
  background: #d4e4fc;
  border-color: #a8c4f0;
}
.crawl-session-card {
  border: 1px solid #e5e6e9;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: #fff;
}
.crawl-session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.crawl-session-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.crawl-session-num {
  font-weight: 700;
  font-size: 14px;
  color: var(--navy);
}
.crawl-session-date {
  font-size: 12px;
  color: #82858e;
}
.crawl-session-count {
  background: #d4edda;
  color: #155724;
  font-weight: 600;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.crawl-asin-section {
  margin-top: 10px;
  border-top: 1px solid #f0f0f2;
  padding-top: 8px;
}
.crawl-asin-label {
  font-size: 12px;
  color: #82858e;
  margin-bottom: 6px;
}
.asin-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.asin-tag {
  display: inline-block;
  padding: 3px 8px;
  background: #e8f0fe;
  color: var(--navy);
  border-radius: 4px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-decoration: none;
  transition: background 0.15s;
}
.asin-tag:hover {
  background: #c5d9f7;
}
.asin-expand-btn {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--navy);
  background: transparent;
  border: 1px dashed #b7c3d6;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.asin-expand-btn:hover {
  background: var(--navy-soft);
}
.asin-hidden-block {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.asin-hidden-block.show {
  display: flex;
}
