/* =============================================
   GPG Key Manager Simple — Styles
   Theme: Security dark mode, terminal aesthetic
   ============================================= */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #2ECC71;
  --primary-dim: rgba(46, 204, 113, 0.15);
  --primary-glow: rgba(46, 204, 113, 0.3);
  --secondary: #636E72;
  --accent: #E74C3C;
  --accent-dim: rgba(231, 76, 60, 0.15);
  --bg: #0A0F1A;
  --bg-card: #0F1524;
  --bg-hover: #141B2E;
  --bg-input: #0D1220;
  --border: rgba(99, 110, 114, 0.25);
  --border-focus: rgba(46, 204, 113, 0.5);
  --text: #E8ECEF;
  --text-dim: #8B95A5;
  --text-muted: #5A6577;
  --radius: 8px;
  --radius-lg: 12px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --transition: 0.2s ease;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(46, 204, 113, 0.1);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* Subtle grid background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(46, 204, 113, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 204, 113, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* --- App Container --- */
.app-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  position: relative;
  z-index: 1;
}

/* --- Header --- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--bg-card), rgba(15, 21, 36, 0.8));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

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

.lock-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-dim);
  border-radius: var(--radius);
  color: var(--primary);
  flex-shrink: 0;
}

.app-header h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.header-subtitle {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), #27ae60);
  color: #0A0F1A;
  font-weight: 600;
  border: none;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-dim);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: none;
  padding: 8px;
  position: relative;
}

.btn-ghost:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
  border-color: rgba(231, 76, 60, 0.3);
  color: var(--accent);
}

.btn-danger:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.78rem;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 0.95rem;
}

.badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

/* --- Tab Navigation --- */
.tab-nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.tab.active {
  color: var(--primary);
  background: var(--primary-dim);
  border-color: rgba(46, 204, 113, 0.2);
}

.tab:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

/* --- Panels --- */
.panel {
  animation: panelIn 0.3s ease;
}

.panel[hidden] {
  display: none;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-header {
  margin-bottom: 24px;
}

.panel-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.panel-header p {
  color: var(--text-dim);
  font-size: 0.88rem;
}

/* --- Forms --- */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.required {
  color: var(--accent);
}

.optional {
  color: var(--text-muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-dim);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%238B95A5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

.input-with-toggle {
  position: relative;
}

.input-with-toggle input {
  padding-right: 40px;
}

.toggle-visibility {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition);
}

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

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

.form-actions {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* --- Key Generation Progress --- */
.keygen-progress {
  margin-top: 24px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.progress-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-weight: 500;
  color: var(--primary);
}

.progress-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--primary-dim);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.progress-bar-container {
  height: 4px;
  background: rgba(46, 204, 113, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #27ae60);
  width: 0%;
  transition: width 0.5s ease;
  border-radius: 2px;
}

.progress-log {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.8;
}

.progress-log .log-line {
  display: flex;
  gap: 8px;
}

.progress-log .log-line::before {
  content: '›';
  color: var(--primary);
  flex-shrink: 0;
}

/* --- Key Result --- */
.key-result {
  margin-top: 24px;
  border: 1px solid rgba(46, 204, 113, 0.2);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(46, 204, 113, 0.05), transparent);
  overflow: hidden;
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.key-result-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.key-result-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.key-result-icon.verified {
  background: var(--primary-dim);
  color: var(--primary);
}

.key-result-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.fingerprint-display {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 2px;
  word-break: break-all;
}

/* Key tabs */
.key-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.key-tab {
  flex: 1;
  padding: 10px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-dim);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}

.key-tab:hover {
  color: var(--text);
}

.key-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.key-content {
  position: relative;
}

.key-block {
  display: none;
}

.key-block.active {
  display: block;
}

.key-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
}

.key-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
}

.key-label.safe {
  background: var(--primary-dim);
  color: var(--primary);
}

.key-label.danger {
  background: var(--accent-dim);
  color: var(--accent);
}

.key-text {
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--text-dim);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

.key-result-actions {
  display: flex;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* --- Keyring --- */
.keyring-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  padding-left: 36px;
}

.keyring-filters {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}

.filter-btn {
  padding: 6px 14px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-dim);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}

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

.filter-btn.active {
  color: var(--primary);
  background: var(--primary-dim);
}

/* Keyring list */
.keyring-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.key-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}

.key-card:hover {
  border-color: rgba(46, 204, 113, 0.3);
  background: var(--bg-hover);
  transform: translateX(2px);
}

.key-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.2rem;
}

.key-card-icon.own {
  background: var(--primary-dim);
  color: var(--primary);
}

.key-card-icon.imported {
  background: rgba(52, 152, 219, 0.15);
  color: #3498DB;
}

.key-card-info {
  flex: 1;
  min-width: 0;
}

.key-card-name {
  font-weight: 600;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.key-card-email {
  font-size: 0.82rem;
  color: var(--text-dim);
}

.key-card-fp {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.key-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.trust-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.trust-badge.ultimate { background: var(--primary-dim); color: var(--primary); }
.trust-badge.full { background: rgba(52, 152, 219, 0.15); color: #3498DB; }
.trust-badge.marginal { background: rgba(243, 156, 18, 0.15); color: #F39C12; }
.trust-badge.none { background: var(--accent-dim); color: var(--accent); }
.trust-badge.unknown { background: rgba(99, 110, 114, 0.15); color: var(--secondary); }

.key-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.expiry-tag {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.expiry-tag.expired {
  color: var(--accent);
}

.expiry-tag.soon {
  color: #F39C12;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-icon {
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-dim);
}

.empty-state p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* --- Sign & Verify --- */
.sign-verify-container {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 24px;
}

.divider-vertical {
  width: 1px;
  background: var(--border);
  margin: 0 8px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

/* --- Import --- */
.import-container {
  max-width: 640px;
}

/* --- Output Blocks --- */
.output-block {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
}

.output-text {
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.7;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

/* --- Verify Result --- */
.verify-result {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  font-size: 0.9rem;
}

.verify-result.valid {
  background: var(--primary-dim);
  border: 1px solid rgba(46, 204, 113, 0.3);
  color: var(--primary);
}

.verify-result.invalid {
  background: var(--accent-dim);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: var(--accent);
}

/* --- Modals --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

.modal-overlay[hidden] {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlide 0.3s ease;
}

.modal-lg {
  max-width: 700px;
}

@keyframes modalSlide {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition);
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-description {
  color: var(--text-dim);
  font-size: 0.88rem;
  margin-bottom: 16px;
}

/* Backup warning */
.backup-warning {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(243, 156, 18, 0.1);
  border: 1px solid rgba(243, 156, 18, 0.2);
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 0.88rem;
  color: #F39C12;
}

.backup-warning.danger {
  background: var(--accent-dim);
  border-color: rgba(231, 76, 60, 0.2);
  color: var(--accent);
}

.backup-warning svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.backup-warning p {
  color: var(--text-dim);
}

/* Backup checklist */
.backup-checklist {
  margin-bottom: 20px;
}

.backup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.backup-item:last-child {
  border-bottom: none;
}

.backup-status {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.7rem;
}

.backup-status.backed-up {
  background: var(--primary-dim);
  color: var(--primary);
}

.backup-status.not-backed-up {
  background: var(--accent-dim);
  color: var(--accent);
}

/* Git instructions */
.instruction-step {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
}

.step-number {
  width: 28px;
  height: 28px;
  background: var(--primary-dim);
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.82rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.instruction-step p {
  color: var(--text-dim);
  font-size: 0.88rem;
  margin-bottom: 8px;
}

.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--primary);
  overflow-x: auto;
}

/* Key detail modal */
.detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 16px;
  margin-bottom: 20px;
}

.detail-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-value {
  font-size: 0.88rem;
  color: var(--text);
  word-break: break-all;
}

.detail-value.mono {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.detail-actions {
  display: flex;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* --- Toast --- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease;
  min-width: 240px;
  max-width: 380px;
}

.toast.success {
  border-color: rgba(46, 204, 113, 0.3);
}

.toast.error {
  border-color: rgba(231, 76, 60, 0.3);
}

.toast-icon {
  flex-shrink: 0;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(12px) scale(0.95);
  }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .app-container {
    padding: 12px 12px 40px;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .sign-verify-container {
    grid-template-columns: 1fr;
  }

  .divider-vertical {
    width: 100%;
    height: 1px;
    margin: 0;
  }

  .tab-nav {
    overflow-x: auto;
  }

  .tab {
    padding: 10px 12px;
    font-size: 0.8rem;
    min-width: 0;
  }

  .tab svg {
    display: none;
  }

  .key-card {
    flex-wrap: wrap;
  }

  .key-card-meta {
    width: 100%;
    margin-top: 8px;
    justify-content: space-between;
  }

  .key-result-actions {
    flex-direction: column;
  }

  .key-result-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    max-height: 80vh;
  }
}

@media (max-width: 480px) {
  .app-header h1 {
    font-size: 1.15rem;
  }

  .panel-header h2 {
    font-size: 1.1rem;
  }

  .keyring-toolbar {
    flex-direction: column;
  }

  .keyring-filters {
    width: 100%;
  }

  .filter-btn {
    flex: 1;
    text-align: center;
  }
}
