@import './docs/tokens.css';

/* ─── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ─── Base ────────────────────────────────────────────────────────────────── */
html, body {
  height: 100%;
  font-family: 'Courier Prime', monospace;
  color: var(--ink);
}

/* ─── Desk ────────────────────────────────────────────────────────────────── */
.desk {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--desk-bg-from), var(--desk-bg-to));
  padding: 20px;
}

/* ─── Card ────────────────────────────────────────────────────────────────── */
.card {
  width: var(--card-sm);
  background: var(--paper-bg);
  border-radius: var(--card-radius);
  box-shadow: 2px 3px 8px rgba(0,0,0,0.13), 0 1px 2px rgba(0,0,0,0.08);
  overflow: hidden;
  position: relative;
}

/* ─── Grid layers ─────────────────────────────────────────────────────────── */
.grid-fine,
.grid-bold {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.grid-fine {
  background-image:
    linear-gradient(to right, var(--grid-fine-color) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-fine-color) 1px, transparent 1px);
  background-size: var(--grid-fine-size) var(--grid-fine-size);
  opacity: var(--grid-fine-opacity);
}

.grid-bold {
  background-image:
    linear-gradient(to right, var(--grid-bold-color) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-bold-color) 1px, transparent 1px);
  background-size: var(--grid-bold-size) var(--grid-bold-size);
  opacity: var(--grid-bold-opacity);
}

/* ─── Card content ────────────────────────────────────────────────────────── */
.card-content {
  position: relative;
  z-index: 1;
  padding: 40px 30px;
}

/* ─── Logo ────────────────────────────────────────────────────────────────── */
.logo {
  font-size: 12px;
  line-height: 20px;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

/* ─── Page title ──────────────────────────────────────────────────────────── */
h1 {
  font-size: 20px;
  line-height: 30px;
  font-weight: 700;
  margin-bottom: 30px;
}

/* ─── Field ───────────────────────────────────────────────────────────────── */
.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-size: 9px;
  line-height: 20px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-label);
}

/* ─── Input wrap ──────────────────────────────────────────────────────────── */
.input-wrap {
  position: relative;
  height: 40px;
}

.input-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  font-family: 'Courier Prime', monospace;
  font-size: 14px;
  color: var(--ink);
  background: transparent !important;
  border: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 1;
}

.input-wrap input::placeholder {
  color: var(--ink-placeholder);
}

input:-webkit-autofill,
input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0px 1000px var(--paper-bg) inset !important;
  -webkit-text-fill-color: var(--ink) !important;
}

.input-wrap svg {
  position: absolute;
  inset: 0;
  width: 100%;
  pointer-events: none;
}

/* ─── Button ──────────────────────────────────────────────────────────────── */
.btn-wrapper {
  position: relative;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  margin-top: 30px;
}

.btn-wrapper span {
  position: relative;
  z-index: 1;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--ink);
}

.btn-wrapper svg {
  position: absolute;
  inset: 0;
  width: 100%;
  pointer-events: none;
}

.btn-highlight {
  position: absolute;
  top: 5px;
  left: 3px;
  width: calc(100% - 6px);
  height: calc(100% - 8px);
  background: rgba(255, 215, 0, 0);
  transform: skewX(-1deg);
  transition: background 0.1s ease;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.btn-wrapper:hover .btn-highlight {
  background: var(--highlight);
}

/* ─── Error message ───────────────────────────────────────────────────────── */
.error-msg {
  font-size: 11px;
  line-height: 20px;
  color: #c0392b;
  min-height: 20px;
  margin-top: 10px;
}

/* ─── Separator ───────────────────────────────────────────────────────────── */
.separator {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 20px;
  margin-top: 10px;
}

.separator span {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-placeholder);
  flex-shrink: 0;
}

.sep-line {
  flex: 1;
  height: 20px;
}

/* ─── Register link ───────────────────────────────────────────────────────── */
.register-link {
  display: block;
  text-align: center;
  font-size: 10px;
  line-height: 20px;
  color: var(--ink);
  margin-top: 10px;
}

/* ─── Card large ─────────────────────────────────────────────────────────── */
.card-lg {
  width: var(--card-lg);
}

/* ─── Balance display ────────────────────────────────────────────────────── */
#balance-display {
  font-size: 30px;
  line-height: 40px;
  font-weight: 700;
}

/* ─── Subtitle ───────────────────────────────────────────────────────────── */
.subtitle {
  font-size: 11px;
  line-height: 20px;
  color: var(--ink-muted);
  margin-top: 10px;
}

/* ─── Tool items ─────────────────────────────────────────────────────────── */
.tool-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 40px;
}

.tool-name {
  font-size: 13px;
  color: var(--ink);
}

.tool-toggle {
  position: relative;
  display: flex;
  height: 26px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  overflow: hidden;
}

.tool-toggle svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.tool-toggle-on,
.tool-toggle-off {
  position: relative;
  z-index: 2;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--ink-muted);
}

.tool-toggle-highlight {
  position: absolute;
  top: 3px;
  height: calc(100% - 6px);
  width: 36px;
  background: rgba(255, 215, 0, 0);
  transform: skewX(-1deg);
  transition: left 0.15s ease, background 0.1s ease;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 1;
}

.tool-toggle.is-on .tool-toggle-highlight {
  left: 1px;
  background: var(--highlight);
}

.tool-toggle.is-on .tool-toggle-on {
  color: var(--ink);
}

.tool-toggle.is-off .tool-toggle-highlight {
  left: 36px;
  background: var(--highlight);
}

.tool-toggle.is-off .tool-toggle-off {
  color: var(--ink);
}

/* ─── Agent keys ─────────────────────────────────────────────────────────── */
.agent-key-empty {
  font-size: 11px;
  line-height: 20px;
  color: var(--ink-muted);
}

.agent-key-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 30px;
}

.agent-key-item.is-inactive {
  opacity: 0.4;
}

.agent-key-info {
  display: flex;
  gap: 8px;
  overflow: hidden;
}

.agent-key-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agent-key-prefix {
  font-size: 11px;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.agent-key-revoke {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 74px;
  height: 26px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
  overflow: hidden;
}

.agent-key-revoke svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.agent-key-revoke-label {
  position: relative;
  z-index: 2;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  color: var(--ink);
}

.agent-key-revoke-highlight {
  position: absolute;
  top: 3px;
  left: 1px;
  height: calc(100% - 6px);
  width: calc(100% - 2px);
  background: rgba(255, 215, 0, 0);
  transform: skewX(-1deg);
  transition: background 0.1s ease;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 1;
}

.agent-key-revoke:hover .agent-key-revoke-highlight {
  background: var(--highlight);
}

.new-key-notice {
  font-size: 10px;
  color: var(--ink-muted);
}

.new-key-value {
  font-size: 11px;
  font-weight: 700;
  word-break: break-all;
  margin-top: 4px;
  cursor: pointer;
  background: var(--highlight);
  mix-blend-mode: multiply;
  padding: 2px 0;
}

/* ─── Tools list ─────────────────────────────────────────────────────────── */
.tools-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
}

.tool-card {
  padding: 10px 0;
  border-bottom: 1px solid var(--grid-fine-color);
}

.tool-card:last-child {
  border-bottom: none;
}

.tool-card-name {
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  color: var(--ink);
}

.tool-card-catalog {
  font-size: 11px;
  line-height: 20px;
  color: var(--ink-muted);
  margin-top: 4px;
}

.tool-card-meta {
  font-size: 10px;
  line-height: 20px;
  color: var(--ink-label);
  word-break: break-all;
}

/* ─── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 420px) {
  .desk {
    padding: 0;
    background: none;
  }

  .card {
    width: 100%;
    min-height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }
}
