:root {
  --grad-start: #ffbc00;
  --grad-end:   #ff0058;
  --primary: #ff0058;
  --primary-hover: #d4004a;
  --primary-light: #fff0f5;
  --success: #059669;
  --success-light: #ecfdf5;
  --error: #dc2626;
  --error-light: #fef2f2;
  --bg: #f3f3f6;
  --surface: #ffffff;
  --border: #e2e2e8;
  --border-focus: #ffbc00;
  --text: #07070f;
  --text-muted: #6b6b80;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
.header {
  background: linear-gradient(135deg, var(--grad-start), var(--grad-end));
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(255,0,88,.25);
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.03em;
  background: rgba(255,255,255,.25);
  border-radius: 8px;
  padding: 4px 10px;
  line-height: 1;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.15);
}

.header h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.1;
}

.header-subtitle {
  font-size: 11px;
  opacity: .82;
  margin-top: 2px;
  font-weight: 400;
  letter-spacing: .02em;
}

.btn-icon {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  border-radius: var(--radius);
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: background .15s;
}

.btn-icon:hover {
  background: rgba(255,255,255,.25);
}

/* ── Main content ── */
.content {
  padding: 20px 24px;
  flex: 1;
  overflow-y: auto;
}

/* ── Footer ── */
.footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 7px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  letter-spacing: .01em;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Form fields ── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.form-group:last-child {
  margin-bottom: 0;
}

label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

input[type="text"],
input[type="date"],
input[type="password"],
input[type="url"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(255,188,0,.2);
}

input::placeholder {
  color: #cbd5e1;
}

/* ── Audio row ── */
.file-row {
  display: flex;
  gap: 8px;
}

.file-row input,
.file-row select {
  flex: 1;
}

.btn-browse {
  padding: 9px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}

.btn-browse:hover {
  background: var(--border);
}

/* ── Submit button ── */
.btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: .02em;
  transition: background .15s, transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-primary:active:not(:disabled) {
  transform: scale(.99);
}

.btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* ── Status message ── */
.status {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  display: none;
}

.status.success {
  background: var(--success-light);
  border: 1px solid #a7f3d0;
  color: var(--success);
  display: flex;
}

.status.error {
  background: var(--error-light);
  border: 1px solid #fecaca;
  color: var(--error);
  display: flex;
}

.status-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* ── Spinner ── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Settings view ── */
.settings-back {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: var(--radius);
  padding: 7px 14px;
  transition: background .15s;
}

.settings-back:hover {
  background: rgba(255,255,255,.25);
}

.hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.btn-save {
  width: 100%;
  padding: 11px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
  margin-top: 8px;
}

.btn-save:hover {
  background: var(--primary-hover);
}

.save-status {
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--success);
  margin-top: 10px;
  height: 20px;
}

.btn-archive {
  width: 100%;
  padding: 10px;
  background: #f8f8fb;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  margin-top: 4px;
}

.btn-archive:hover {
  background: var(--border);
  border-color: #c8c8d4;
}

.archive-status {
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 8px;
  min-height: 18px;
}

.archive-status.success { color: var(--success); }
.archive-status.error   { color: var(--error); }

/* ── View toggle ── */
.view {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.view.active {
  display: flex;
}

/* ── Token toggle ── */
.token-row {
  position: relative;
}

.token-row input {
  padding-right: 40px;
}

.btn-toggle-pw {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  padding: 2px;
  line-height: 1;
}

.btn-toggle-pw:hover {
  color: var(--text);
}
