:root {
  --bg: #f0ede8;
  --bg2: #e8e4de;
  --card: rgba(253,250,246,0.92);
  --card-solid: #fdfaf6;
  --ink: #1c1814;
  --ink2: #3a342e;
  --muted: #8c8077;
  --faint: #b5afa8;
  --border: rgba(28,24,20,0.10);
  --border-hard: rgba(28,24,20,0.18);
  --accent: #10b981;
  --accent-light: rgba(16,185,129,0.10);
  --accent-glow: rgba(16,185,129,0.22);
  --success: #1a7a4a;
  --success-bg: rgba(26,122,74,0.08);
  --error: #c0392b;
  --error-bg: rgba(192,57,43,0.08);
  --warning: #b07000;
  --warning-bg: rgba(176,112,0,0.08);
  --neu-out: 4px 4px 10px rgba(0,0,0,0.10), -3px -3px 8px rgba(255,255,255,0.80);
  --neu-in: inset 2px 2px 5px rgba(0,0,0,0.08), inset -2px -2px 4px rgba(255,255,255,0.72);
  --sidebar-w: 240px;
  --nav-h: 56px;
  --f-display: 'DM Serif Display', Georgia, serif;
  --f-body: 'Syne', system-ui, sans-serif;
  --f-mono: 'DM Mono', 'Fira Mono', monospace;
  --radius: 14px;
}

body.dark {
  --bg: #141210;
  --bg2: #1c1916;
  --card: rgba(28,24,20,0.92);
  --card-solid: #1e1a16;
  --ink: #f0ebe4;
  --ink2: #c8c0b6;
  --muted: #7a7268;
  --faint: #524c46;
  --border: rgba(240,235,228,0.08);
  --border-hard: rgba(240,235,228,0.15);
  --accent: #10b981;
  --accent-light: rgba(16,185,129,0.12);
  --accent-glow: rgba(16,185,129,0.24);
  --success: #3eb97a;
  --success-bg: rgba(62,185,122,0.10);
  --error: #e05c4a;
  --error-bg: rgba(224,92,74,0.10);
  --warning: #d4a017;
  --warning-bg: rgba(212,160,23,0.10);
  --neu-out: 4px 4px 10px rgba(0,0,0,0.40), -3px -3px 8px rgba(255,255,255,0.03);
  --neu-in: inset 2px 2px 5px rgba(0,0,0,0.35), inset -2px -2px 4px rgba(255,255,255,0.03);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  transition: background 0.35s, color 0.35s;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px;
}

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

.spin {
  display: inline-block;
  animation: spin 0.7s linear infinite;
}

/* SIDEBAR */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--card);
  backdrop-filter: blur(18px) saturate(1.5);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform 0.3s, background 0.35s;
  padding: 20px 0;
  transform: translateX(-100%);
}

.sidebar.open {
  transform: translateX(0);
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px 0;
}

.sb-logo {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--neu-out);
  flex-shrink: 0;
}

.sb-name {
  font-family: var(--f-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}

.sb-divider {
  height: 1px;
  background: var(--border);
  margin: 14px 18px;
}

.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 10px;
}

.sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--muted);
  transition: all 0.15s;
  border: none;
  background: none;
  cursor: pointer;
}

.sb-link i {
  width: 14px;
  text-align: center;
  flex-shrink: 0;
}

.sb-link:hover {
  color: var(--ink);
  background: var(--accent-light);
}

.sb-link.active {
  color: var(--accent);
  background: var(--accent-light);
  font-weight: 600;
}

.sb-admin {
  color: var(--accent);
}

.sb-spacer {
  flex: 1;
}

.sb-logout {
  margin: 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--error);
  background: var(--error-bg);
  border: 1px solid rgba(192, 57, 43, 0.2);
  cursor: pointer;
  transition: all 0.2s;
}

.sb-logout:hover {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}

/* TOPNAV */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--card);
  backdrop-filter: blur(18px) saturate(1.5);
  border-bottom: 1px solid var(--border);
  transition: background 0.35s;
}

.hamburger {
  display: flex;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s;
}

.hamburger:hover {
  color: var(--accent);
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.theme-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-hard);
  background: var(--card-solid);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.78rem;
  box-shadow: var(--neu-out);
  transition: all 0.2s;
}

.theme-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.sb-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 190;
}

.sb-overlay.visible {
  display: block;
}

/* MAIN */
.main {
  padding: calc(var(--nav-h) + 28px) 32px 60px;
  max-width: 100%;
}

/* VERIFY BANNER */
.verify-banner {
  display: none;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: var(--warning-bg);
  border: 1px solid rgba(176, 112, 0, 0.25);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.verify-banner.show {
  display: flex;
}

.verify-banner > i {
  color: var(--warning);
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.vb-text {
  flex: 1;
  min-width: 160px;
  font-size: 0.82rem;
}

.vb-text strong {
  display: block;
  color: var(--ink);
  margin-bottom: 2px;
}

.vb-text span {
  color: var(--muted);
}

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

.vb-otp-row {
  display: none;
  width: 100%;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

.vb-otp-row.show {
  display: flex;
}

.vb-otp-row input {
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-hard);
  background: var(--card-solid);
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--ink);
  outline: none;
  width: 160px;
  letter-spacing: 0.1em;
  box-shadow: var(--neu-in);
}

.btn-verify {
  padding: 7px 14px;
  border-radius: 8px;
  border: none;
  background: var(--warning);
  color: #fff;
  font-family: var(--f-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-verify:hover { opacity: 0.85; }
.btn-verify:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-verify.success { background: var(--success); }
.btn-verify.ghost {
  background: none;
  color: var(--muted);
  border: 1px solid var(--border-hard);
}
.btn-verify.ghost:hover { color: var(--ink); }

/* ── PROFILE HEADER CARD ── */
.profile-header-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--neu-out);
  overflow: hidden;
  margin-bottom: 20px;
  min-height: 560px;
}

.profile-banner {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--bg2) 0%, var(--ink2) 100%);
  cursor: pointer;
  overflow: hidden;
  z-index: 0;
  width: 100%;
  height: 100%;
}

.profile-banner img,
.profile-banner video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  display: block;
  position: absolute;
  inset: 0;
}

.profile-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.04) 0%,
    rgba(0, 0, 0, 0.12) 50%,
    rgba(0, 0, 0, 0.65) 100%
  );
  pointer-events: none;
  z-index: 1;
}

.media-edit-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  cursor: pointer;
  color: #fff;
  font-size: 1.1rem;
  gap: 8px;
  z-index: 2;
}

.media-edit-overlay.round {
  border-radius: 50%;
  font-size: 0.9rem;
}

.profile-banner:hover .media-edit-overlay,
.profile-avatar:hover .media-edit-overlay {
  opacity: 1;
}

.profile-avatar-wrap {
  padding: 0 20px;
  position: relative;
  z-index: 2;
  margin-top: 0;
}

.profile-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--ink2);
  border: 3px solid rgba(255, 255, 255, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 2rem;
  color: var(--bg);
  font-weight: normal;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.30);
}

.profile-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.profile-header-content {
  position: relative;
  z-index: 2;
  padding-top: 430px;
  display: flex;
  flex-direction: column;
  padding-bottom: 20px;
}

/* PROFILE META CARD */
.profile-meta-card {
  background: var(--card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--neu-out);
  margin-bottom: 16px;
  overflow: hidden;
}

.profile-meta-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}

.p-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
}

.p-badge.green  { color:#fff; background:rgba(26,122,74,0.6);   border-color:rgba(255,255,255,0.2); }
.p-badge.accent { color:#fff; background:rgba(16,185,129,0.6);   border-color:rgba(255,255,255,0.2); }
.p-badge.blue   { color:#fff; background:rgba(3,105,161,0.6);   border-color:rgba(255,255,255,0.2); }
.p-badge.yellow { color:#fff; background:rgba(176,112,0,0.6);   border-color:rgba(255,255,255,0.2); }

.badge-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
}

.profile-meta-list {
  display: flex;
  flex-direction: column;
}

.profile-meta-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.profile-meta-item:last-child { border-bottom: none; }
.profile-meta-item:hover { background: var(--accent-light); }

.profile-meta-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--bg2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 0.8rem;
  flex-shrink: 0;
  box-shadow: var(--neu-out);
}

.profile-meta-label {
  font-family: var(--f-mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 2px;
}

.profile-meta-value {
  font-family: var(--f-body);
  font-size: 0.9rem;
  color: var(--ink);
  font-weight: 600;
}

.profile-meta-quota { flex: 1; min-width: 0; }

.quota-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 7px;
}

.quota-pct { color: var(--accent); font-weight: 500; }

.quota-track {
  height: 5px;
  background: var(--bg2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--neu-in);
  margin-bottom: 5px;
}

.quota-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.6s ease;
}

.quota-fill.warning { background: var(--error); }

.quota-sub {
  font-family: var(--f-mono);
  font-size: 0.62rem;
  color: var(--faint);
}

/* SECTION CARD */
.section-card {
  background: var(--card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--neu-out);
  margin-bottom: 16px;
  overflow: hidden;
  transition: border-color 0.2s;
  width: 100%;
}

.section-card:hover         { border-color: var(--border-hard); }
.section-card.card-danger   { border-color: rgba(192,57,43,0.2); }
.section-card.card-admin    { border-color: rgba(16,185,129,0.3); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.card-header:hover { background: var(--accent-light); }

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

.card-header-static {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
}

.card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 0.9rem;
  box-shadow: var(--neu-out);
  flex-shrink: 0;
}

.card-icon.accent { background: var(--accent-light); }
.card-icon.danger { background: var(--error-bg); color: var(--error); }

.card-title {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink);
}

.card-sub {
  font-family: var(--f-mono);
  font-size: 0.62rem;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.04em;
}

.card-chevron {
  color: var(--faint);
  font-size: 0.72rem;
  transition: transform 0.3s;
  flex-shrink: 0;
}

.card-header.collapsed .card-chevron { transform: none; }
.section-card.open .card-chevron     { transform: rotate(180deg); }

.card-body {
  display: none;
  border-top: 1px solid var(--border);
  padding: 20px;
  animation: fadeUp 0.2s ease;
}

.section-card.open .card-body { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* TAB SYSTEM */
.tab-bar {
  display: flex;
  gap: 2px;
  background: var(--bg2);
  border-radius: 9px;
  padding: 3px;
  margin-bottom: 18px;
  border: 1px solid var(--border-hard);
  box-shadow: var(--neu-in);
  width: fit-content;
}

.tab-btn {
  padding: 6px 16px;
  border-radius: 7px;
  font-family: var(--f-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--muted);
  transition: all 0.15s;
}

.tab-btn.active {
  background: var(--card-solid);
  color: var(--ink);
  box-shadow: var(--neu-out);
}

.tab-pane         { display: none; }
.tab-pane.active  { display: block; }

/* FORM ELEMENTS */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-family: var(--f-mono);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}

.input-wrap { position: relative; }

.input-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  font-size: 0.8rem;
  pointer-events: none;
}

.pw-toggle {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--faint);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s;
}

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

.form-control {
  width: 100%;
  padding: 10px 14px 10px 36px;
  border-radius: 9px;
  border: 1px solid var(--border-hard);
  background: var(--card-solid);
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--ink);
  box-shadow: var(--neu-in);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control.has-toggle  { padding-right: 38px; }
.form-control::placeholder { color: var(--faint); font-size: 0.72rem; }
.form-control:focus       { border-color: var(--accent); box-shadow: var(--neu-in), 0 0 0 3px var(--accent-light); }
.form-control.is-invalid  { border-color: var(--error);  box-shadow: var(--neu-in), 0 0 0 3px var(--error-bg); }
.form-control.is-valid    { border-color: var(--success); }

.field-hint { font-family: var(--f-mono); font-size: 0.64rem; margin-top: 5px; display: none; letter-spacing: 0.02em; }
.field-hint.show { display: block; }
.field-hint.ok   { color: var(--success); }
.field-hint.err  { color: var(--error); }

.pw-strength-wrap { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

.pw-bars { display: flex; gap: 3px; flex: 1; }

.pw-bar {
  flex: 1;
  height: 3px;
  border-radius: 999px;
  background: var(--border-hard);
  transition: background 0.3s;
}

.pw-bar.weak   { background: var(--error); }
.pw-bar.medium { background: var(--warning); }
.pw-bar.strong { background: var(--success); }

.pw-label { font-family: var(--f-mono); font-size: 0.62rem; color: var(--muted); white-space: nowrap; }

/* BUTTONS */
.btn-save {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--f-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  border: none;
  cursor: pointer;
  box-shadow: var(--neu-out);
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-save:hover    { background: var(--accent); transform: translateY(-1px); box-shadow: 0 6px 20px var(--accent-glow); }
.btn-save:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: var(--neu-out); }

.btn-danger-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 9px;
  border: 1px solid rgba(192, 57, 43, 0.3);
  background: var(--error-bg);
  color: var(--error);
  font-family: var(--f-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--neu-out);
}

.btn-danger-outline:hover { background: var(--error); color: #fff; border-color: var(--error); }

.btn-danger-solid {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 9px;
  background: var(--error);
  color: #fff;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(192, 57, 43, 0.3);
  transition: all 0.2s;
}

.btn-danger-solid:hover    { opacity: 0.88; transform: translateY(-1px); }
.btn-danger-solid:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 9px;
  background: var(--card-solid);
  color: var(--muted);
  border: 1px solid var(--border-hard);
  font-family: var(--f-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: var(--neu-out);
  transition: all 0.2s;
}

.btn-ghost:hover { color: var(--ink); border-color: var(--border-hard); }

.btn-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }

/* ALERT */
.alert {
  display: none;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 14px;
  border-radius: 9px;
  font-family: var(--f-mono);
  font-size: 0.72rem;
  line-height: 1.6;
  margin-bottom: 14px;
  border: 1px solid transparent;
}

.alert.show { display: flex; }
.alert i    { flex-shrink: 0; margin-top: 1px; }

.alert-success { background: var(--success-bg); color: var(--success); border-color: rgba(26,122,74,0.2); }
.alert-error   { background: var(--error-bg);   color: var(--error);   border-color: rgba(192,57,43,0.2); }

/* APIKEY BOX */
.apikey-display-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg2);
  border: 1px solid var(--border-hard);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: var(--neu-in);
  margin-bottom: 10px;
}

.apikey-display-box code {
  flex: 1;
  font-family: var(--f-mono);
  font-size: 0.78rem;
  color: var(--accent);
  word-break: break-all;
}

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

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: var(--card-solid);
  border: 1px solid var(--border-hard);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--neu-out);
  transition: all 0.15s;
}

.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

.info-note {
  font-family: var(--f-mono);
  font-size: 0.65rem;
  color: var(--faint);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* MEDIA UPLOAD */
.media-upload-area { display: flex; gap: 20px; align-items: flex-start; }
.media-upload-area.vertical { flex-direction: column; }
.media-preview-wrap { position: relative; flex-shrink: 0; }
.media-preview-wrap.full { width: 100%; }

.media-preview {
  background: var(--bg2);
  border: 1px solid var(--border-hard);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: var(--neu-in);
}

.avatar-preview { width: 100px; height: 100px; border-radius: 50%; }

.banner-preview { width: 100%; height: 120px; border-radius: 10px; }

.media-preview img,
.media-preview video { width: 100%; height: 100%; object-fit: cover; display: block; }

.preview-placeholder { color: var(--faint); font-size: 1.5rem; }

.media-edit-btn {
  margin-top: 8px;
  text-align: center;
  font-family: var(--f-mono);
  font-size: 0.62rem;
  color: var(--accent);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--accent-light);
  border: 1px solid rgba(16,185,129,0.2);
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.media-edit-btn:hover { background: var(--accent); color: #fff; }

.media-inputs { flex: 1; min-width: 0; }

.file-drop {
  border: 1.5px dashed var(--border-hard);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.file-drop:hover,
.file-drop.drag-over { border-color: var(--accent); background: var(--accent-light); }

.file-drop i     { font-size: 1.4rem; color: var(--faint); }
.file-drop span  { font-family: var(--f-mono); font-size: 0.72rem; color: var(--muted); }
.file-drop small { font-family: var(--f-mono); font-size: 0.6rem; color: var(--faint); }

/* INFO GRID */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.info-item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--neu-in);
}

.info-item-label {
  font-family: var(--f-mono);
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.info-item-value { font-family: var(--f-mono); font-size: 0.8rem; color: var(--ink2); font-weight: 500; }

/* DANGER ZONE */
.danger-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  flex-wrap: wrap;
}

.danger-title { font-family: var(--f-body); font-size: 0.9rem; font-weight: 600; color: var(--ink); margin-bottom: 3px; }
.danger-desc  { font-family: var(--f-mono); font-size: 0.66rem; color: var(--muted); }

/* MODALS */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(6px);
}

.modal-overlay.show { display: flex; animation: fadeIn 0.15s ease; }

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

.modal-box {
  background: var(--card-solid);
  border-radius: 18px;
  padding: 24px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-hard);
  position: relative;
}

.modal-box.danger       { border-color: rgba(192,57,43,0.3); }
.modal-box.editor-modal { max-width: 560px; }

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg2);
  border: 1px solid var(--border-hard);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.78rem;
  transition: all 0.2s;
  box-shadow: var(--neu-out);
}

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

.modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 14px;
}

.modal-icon.danger { background: var(--error-bg); color: var(--error); }

.modal-title  { font-family: var(--f-display); font-style: italic; font-size: 1.1rem; color: var(--ink); margin-bottom: 8px; }
.modal-body   { font-family: var(--f-mono); font-size: 0.72rem; color: var(--muted); line-height: 1.7; margin-bottom: 16px; }
.modal-body strong { color: var(--error); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

/* IMAGE EDITOR */
.editor-preview-wrap {
  position: relative;
  width: 100%;
  height: 300px;
  background: var(--bg2);
  border-radius: 10px;
  border: 1px solid var(--border-hard);
  box-shadow: var(--neu-in);
  overflow: hidden;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#editorCanvas { max-width: 100%; max-height: 100%; display: block; }

.editor-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  font-size: 1.5rem;
  color: var(--faint);
}

.editor-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }

.editor-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  background: var(--bg2);
  border: 1px solid var(--border-hard);
  color: var(--muted);
  font-family: var(--f-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: var(--neu-out);
  transition: all 0.15s;
}

.editor-tool-btn:hover,
.editor-tool-btn.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}

.editor-crop-hint {
  font-family: var(--f-mono);
  font-size: 0.64rem;
  color: var(--muted);
  margin-bottom: 10px;
  padding: 6px 10px;
  background: var(--accent-light);
  border-radius: 6px;
  border: 1px solid rgba(16,185,129,0.2);
}

/* RESPONSIVE */
@media (max-width: 900px) {
  .main { padding: calc(var(--nav-h) + 20px) 20px 48px; }
}

@media (max-width: 560px) {
  .main { padding: calc(var(--nav-h) + 16px) 14px 40px; }

  .profile-header-card { min-height: 360px; }
  .profile-header-content { padding-top: 260px; }

  .media-upload-area { flex-direction: column; }
  .avatar-preview    { width: 80px; height: 80px; }
  .info-grid         { grid-template-columns: 1fr; }
  .tab-bar           { width: 100%; }
  .tab-btn           { flex: 1; text-align: center; }

  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn-save,
  .modal-actions .btn-danger-solid,
  .modal-actions .btn-ghost { width: 100%; justify-content: center; }
}

/* PHONE REMINDER MODAL */
.modal-box.reminder-modal { max-width: 420px; text-align: center; }

.modal-icon.reminder {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 1.8rem;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reminder-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-direction: column;
}

.reminder-actions .btn-ghost,
.reminder-actions .btn-save { width: 100%; justify-content: center; }

.reminder-actions ul  { list-style: none; padding: 0; }
.reminder-actions li  { margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }

@media (min-width: 480px) {
  .reminder-actions { flex-direction: row; }
}