:root {
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-soft: #ede9fe;
  --foreground: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --card: #ffffff;
  --background: #f8fafc;
  --success: #059669;
  --danger: #dc2626;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  width: 380px;
  min-height: 520px;
  max-height: 600px;
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--background);
  color: var(--foreground);
  display: flex;
  flex-direction: column;
}

.header {
  padding: 20px 16px 14px;
  text-align: center;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.header-logo {
  height: 36px;
  width: auto;
}

.user-info {
  margin-top: 12px;
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #ddd6fe;
  padding: 5px 12px;
  border-radius: 999px;
}

.status-bar {
  margin: 0;
  padding: 8px 16px;
  font-size: 12px;
  text-align: center;
  flex-shrink: 0;
  display: none;
}

.status-bar.visible {
  display: block;
}

.status-bar.error {
  background: #fef2f2;
  color: var(--danger);
  border-bottom: 1px solid #fecaca;
}

.status-bar.success {
  background: #ecfdf5;
  color: var(--success);
  border-bottom: 1px solid #a7f3d0;
}

.status-bar.info {
  background: var(--primary-soft);
  color: var(--primary);
  border-bottom: 1px solid #ddd6fe;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  background: transparent;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  cursor: pointer;
}

.tab.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  position: relative;
}

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input,
select {
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  font-size: 14px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

select.domain-readonly {
  background: var(--background);
  color: var(--muted);
  cursor: not-allowed;
}

select.domain-readonly:focus {
  border-color: var(--border);
  box-shadow: none;
}

.radio-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 14px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  font-size: 13px;
  color: var(--foreground);
  cursor: pointer;
}

.radio-option input {
  width: auto;
  margin: 0;
}

.btn-primary {
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

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

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

.preset-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.preset-btn {
  flex: 1;
  padding: 10px;
  text-align: center;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--primary);
}

.preset-btn:hover {
  background: var(--primary-soft);
  border-color: #c4b5fd;
}

.result-box {
  display: none;
  margin-bottom: 14px;
  padding: 12px;
  background: var(--card);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
  background: #ecfdf5;
}

.result-box.visible {
  display: block;
}

.result-box a {
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  word-break: break-all;
  text-decoration: none;
}

.result-box a:hover {
  text-decoration: underline;
}

.link-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
}

.link-short {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  word-break: break-all;
  margin-bottom: 4px;
}

.link-long {
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
  margin-bottom: 10px;
}

.action-group {
  display: flex;
  gap: 6px;
}

.btn-sm {
  flex: 1;
  padding: 8px 4px;
  border: none;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  color: #fff;
}

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

.btn-edit {
  background: #64748b;
}

.btn-copy {
  background: #0ea5e9;
}

.btn-delete {
  background: var(--danger);
}

#edit-overlay {
  position: absolute;
  inset: 0;
  background: var(--background);
  display: none;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
  z-index: 10;
}

.bulk-delete {
  width: 100%;
  padding: 12px;
  margin-bottom: 14px;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  background: #fef2f2;
  color: var(--danger);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.logout-btn {
  width: 100%;
  margin-top: 8px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.logout-btn:hover {
  border-color: #fecaca;
  color: var(--danger);
}

.footer {
  flex-shrink: 0;
  padding: 12px;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--muted);
  background: var(--card);
  border-top: 1px solid var(--border);
}

#login-screen {
  padding: 48px 32px;
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: var(--card);
}

#login-screen h2 {
  font-size: 14px;
  font-weight: 700;
  color: var(--foreground);
  margin: 12px 0 0;
}

#login-screen .version {
  color: var(--primary);
}

.empty-state {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
}
