/* FanaticDev Mail - shared purple & black theme */
:root {
  --bg: #08060c;
  --bg-2: #0e0a15;
  --panel: #130d1c;
  --panel-2: #1a1226;
  --panel-3: #22182f;
  --border: #2c2040;
  --border-strong: #3d2d58;
  --text: #efe9f8;
  --muted: #a597bb;
  --faint: #6f6385;
  --accent: #8b5cf6;
  --accent-hi: #a78bfa;
  --accent-deep: #6d28d9;
  --accent-glow: rgba(139, 92, 246, 0.35);
  --accent-soft: rgba(139, 92, 246, 0.14);
  --danger: #f43f5e;
  --danger-soft: rgba(244, 63, 94, 0.14);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--border);
  --font: "Segoe UI", -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, rgba(109, 40, 217, 0.18), transparent 60%), var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-hi); }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
[hidden] { display: none !important; }
::selection { background: var(--accent-glow); }

/* Brand */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo {
  display: grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff; font-weight: 800; font-size: 14px; letter-spacing: 0.02em;
  box-shadow: 0 6px 20px var(--accent-glow);
}
.brand h1 { font-size: 17px; }
.brand .sub { margin: 0; color: var(--muted); font-size: 12px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text);
  font: 600 13px var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--panel-3); border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%); border-color: transparent; color: #fff; box-shadow: 0 4px 16px var(--accent-glow); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger); border-color: transparent; color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { height: 30px; padding: 0 12px; font-size: 12px; }
.link { background: none; border: 0; padding: 0; color: var(--accent-hi); font: inherit; cursor: pointer; text-decoration: underline; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.icon-btn svg, .btn svg { width: 18px; height: 18px; flex: none; }

:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }

/* Forms */
label { display: block; font-weight: 600; font-size: 12px; color: var(--muted); margin: 0 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.field { margin-bottom: 16px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], textarea, select {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--text);
  font: 14px var(--font); transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.check { display: flex; align-items: center; gap: 10px; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-suffix > span { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--panel-3); color: var(--muted); white-space: nowrap; }
.hint { color: var(--faint); font-size: 12px; margin: 6px 0 0; }
.error { color: #fda4af; background: var(--danger-soft); border: 1px solid rgba(244, 63, 94, .35); padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.success { color: #a7f3d0; background: var(--ok-soft); border: 1px solid rgba(52, 211, 153, .35); padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 16px; }

/* Cards, pills */
.card { background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0, 0, 0, .35); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--border-strong); color: var(--muted); }
.pill.ok { color: var(--ok); background: var(--ok-soft); border-color: rgba(52, 211, 153, .3); }
.pill.off { color: #fda4af; background: var(--danger-soft); border-color: rgba(244, 63, 94, .3); }
.pill.accent { color: var(--accent-hi); background: var(--accent-soft); border-color: rgba(139, 92, 246, .35); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
.avatar {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%); color: #fff; font-weight: 700; font-size: 13px; text-transform: uppercase;
}
.avatar.big { width: 42px; height: 42px; font-size: 16px; }

/* Dialogs */
dialog {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border: 1px solid var(--border-strong); border-radius: 16px; background: var(--panel); color: var(--text); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(4, 2, 8, .72); backdrop-filter: blur(3px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.dlg-head h2 { font-size: 17px; }
.dlg-body { padding: 20px 22px; overflow: auto; max-height: calc(100vh - 200px); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--bg-2); border-radius: 0 0 16px 16px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1000;
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 10px;
  background: var(--panel-3); border: 1px solid var(--accent); color: var(--text); box-shadow: var(--shadow); font-weight: 500;
}
.toast.bad { border-color: var(--danger); }

/* iPhones zoom into any text box smaller than 16px when it gets focus (and stay zoomed).
   Keeping text boxes at 16px on touch screens prevents that without disabling pinch-zoom. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (pointer: coarse), (max-width: 760px) {
  input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], textarea, select { font-size: 16px; }
}

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
