/* Console — lean key management */
.console-page {
  padding: 2.25rem 0 3.5rem;
  max-width: 920px;
}

.console-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.console-page h1 {
  font-family: var(--display);
  font-size: clamp(1.7rem, 4vw, 2.2rem);
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
}

.console-page .lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.dash-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.dash-top h2 {
  margin: 0;
  font-size: 1.15rem;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin: 0.75rem 0 0.85rem;
}

.usage-card {
  text-align: center;
  padding: 1rem 0.5rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 143, 171, 0.06);
}

.usage-card .n {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--peach);
  transition: transform 0.25s var(--ease);
}

.usage-card .l {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.usage-bar-wrap {
  height: 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin-bottom: 1.1rem;
}

.usage-bar {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--mint), var(--peach));
  transition: width 0.5s var(--ease);
}

.history-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.55rem;
}

.history-bars {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.4rem;
  align-items: end;
  min-height: 72px;
}

.history-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.history-col .bar {
  width: 100%;
  max-width: 28px;
  border-radius: 6px 6px 2px 2px;
  background: rgba(255, 143, 171, 0.45);
  min-height: 4px;
  transition: height 0.4s var(--ease);
}

.history-col .d,
.history-col .v {
  font-size: 0.65rem;
  font-family: var(--mono);
}

.history-col .d { color: var(--muted); }
.history-col .v { color: var(--text); }

.panel-head {
  margin-bottom: 0.85rem;
}

.panel-title {
  font-size: 1.05rem;
  margin: 0 0 0.25rem;
  font-family: var(--display);
}

.create-box {
  margin-bottom: 1rem;
  padding: 0.9rem;
  border-radius: 14px;
  border: 1px dashed rgba(255, 143, 171, 0.35);
  background: rgba(255, 143, 171, 0.04);
}

.name-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}

.chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}

.chip:hover,
.chip.is-on {
  border-color: rgba(255, 143, 171, 0.5);
  color: var(--peach);
  background: rgba(255, 143, 171, 0.1);
}

.create-row {
  display: flex;
  gap: 0.5rem;
}

.create-row input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--code-bg);
  color: var(--text);
  font: inherit;
  outline: none;
}

.create-row input:focus {
  border-color: rgba(255, 143, 171, 0.55);
  box-shadow: 0 0 0 3px rgba(255, 143, 171, 0.15);
}

.reveal-box {
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid rgba(94, 207, 186, 0.4);
  background: rgba(94, 207, 186, 0.08);
  animation: panel-in 0.3s var(--ease);
}

.reveal-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--mint);
}

.secret-row {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.secret-row input {
  flex: 1;
  font-family: var(--mono);
  font-size: 0.82rem;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--code-bg);
  color: var(--text);
}

.key-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.key-empty {
  text-align: center;
  color: var(--muted);
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.key-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), opacity 0.25s ease;
}

.key-card:hover {
  border-color: rgba(255, 143, 171, 0.3);
}

.key-card.is-out {
  opacity: 0;
  transform: translateX(12px);
}

.key-card.is-in {
  animation: panel-in 0.3s var(--ease);
}

.key-card-main {
  min-width: 0;
}

.key-name {
  font-weight: 700;
  font-size: 0.98rem;
  margin: 0 0 0.25rem;
}

.key-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  align-items: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.key-prefix {
  font-family: var(--mono);
  color: var(--mint);
  font-size: 0.8rem;
}

.badge {
  display: inline-block;
  font-size: 0.65rem;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  background: rgba(94, 207, 186, 0.15);
  color: var(--mint);
  font-weight: 600;
}

.key-usage {
  margin-top: 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.key-mini-bar {
  height: 5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 0.35rem;
  max-width: 220px;
}

.key-mini-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--mint), var(--peach));
  border-radius: 99px;
  transition: width 0.4s var(--ease);
}

.key-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

.key-actions .btn {
  padding: 0.42rem 0.7rem;
  font-size: 0.78rem;
  border-radius: 10px;
}

.key-actions .btn-danger {
  border-color: rgba(255, 107, 129, 0.45);
  color: #ff8a9a;
  background: rgba(255, 107, 129, 0.08);
}

.key-actions .btn-danger:hover,
.key-actions .btn-danger.is-confirm {
  background: rgba(255, 107, 129, 0.22);
  color: #fff;
  border-color: rgba(255, 107, 129, 0.7);
}

.btn.is-busy {
  opacity: 0.65;
  pointer-events: none;
}

.tos-check {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin: 0.5rem 0 0.85rem;
  cursor: pointer;
}

.tos-check input {
  margin-top: 0.2rem;
  width: auto;
}

#embedOut {
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 0.75rem;
}

.footer-note {
  text-align: center;
  margin-top: 1.5rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(12px);
  z-index: 100;
  padding: 0.7rem 1.15rem;
  border-radius: 12px;
  background: rgba(18, 26, 42, 0.96);
  border: 1px solid rgba(255, 143, 171, 0.45);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  pointer-events: none;
  max-width: min(90vw, 360px);
  text-align: center;
}

.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#authPanel[hidden],
#dashPanel[hidden],
#revealBox[hidden],
#registerForm[hidden],
#loginForm[hidden],
#toast[hidden] {
  display: none !important;
}

#authPanel,
#dashPanel {
  animation: panel-in 0.35s var(--ease);
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .usage-grid { grid-template-columns: 1fr; }
  .console-hero { flex-direction: column; }
  .key-card {
    grid-template-columns: 1fr;
  }
  .key-actions {
    justify-content: flex-start;
  }
  .create-row {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  .key-card, .usage-bar, .history-col .bar, .toast {
    transition: none;
  }
  .key-card.is-in { animation: none; }
}

.auth-card {
  max-width: 420px;
  margin: 0 auto;
  padding: 1.45rem 1.4rem 1.25rem;
  border-color: rgba(255, 255, 255, 0.11);
}

.auth-seg {
  margin-bottom: 1.1rem;
}

.auth-stack {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.auth-stack > input {
  width: 100%;
  min-height: 44px;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  font: inherit;
  outline: none;
}

.auth-stack > input:focus {
  border-color: color-mix(in srgb, var(--peach) 55%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--peach) 18%, transparent);
}

.auth-submit {
  width: 100%;
  min-height: 44px;
  justify-content: center;
}

.oauth-split {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.05rem 0 0.9rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.oauth-split::before,
.oauth-split::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.btn-github {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 0.55rem;
  min-height: 46px;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  background: linear-gradient(180deg, #2b3139 0%, #1b1f24 100%);
  color: #f5f7fa !important;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  transition: transform 0.18s var(--ease), border-color 0.18s ease, background 0.18s ease;
}
.btn-github:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--peach) 40%, rgba(255, 255, 255, 0.12));
  background: linear-gradient(180deg, #353b44 0%, #22272e 100%);
}
.btn-github:active {
  transform: translateY(0);
}
.btn-github .gh-ico {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82A7.65 7.65 0 0 1 8 4.77c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='black' d='M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82A7.65 7.65 0 0 1 8 4.77c.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.oauth-hint {
  margin: 0.55rem 0 0;
  text-align: center;
  line-height: 1.45;
  font-size: 0.78rem;
}
.oauth-hint a {
  color: var(--peach);
  text-decoration: none;
}
.oauth-hint a:hover {
  text-decoration: underline;
}

#authMsg:not(:empty) {
  margin-top: 0.85rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
}

.account-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.1rem;
  margin: 0 0 1rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
}
.account-meta {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  font-size: 0.9rem;
  min-width: 0;
}
.account-label {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.account-actions {
  margin-left: auto;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .account-actions {
    margin-left: 0;
    width: 100%;
  }
  .account-actions .btn {
    flex: 1;
    justify-content: center;
  }
}

/* billing */
.billing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.85rem;
  margin-top: 0.75rem;
}
.billing-card {
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.billing-price {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.billing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}
