:root {
  --bg-base: #090b10;
  --bg-surface: #111520;
  --bg-elevated: #171c2b;
  --bg-input: #0d1018;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-accent: rgba(139, 92, 246, 0.45);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-soft: rgba(139, 92, 246, 0.14);
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.14);
  --danger: #f43f5e;
  --danger-hover: #e11d48;
  --danger-soft: rgba(244, 63, 94, 0.14);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-card: 0 12px 32px rgba(0, 0, 0, 0.38);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html,
body {
  min-height: 100%;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -15%, rgba(139, 92, 246, 0.16), transparent 65%),
    radial-gradient(ellipse 50% 40% at 95% 10%, rgba(56, 189, 248, 0.06), transparent 60%);
  background-attachment: fixed;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

/* ===========================
   Buttons & Inputs
   =========================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.12s ease, opacity 0.16s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn--primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.28);
}

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

.btn--secondary {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn--secondary:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: #1d2336;
}

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn--ghost:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
}

.btn--danger {
  background: var(--danger-soft);
  border-color: rgba(244, 63, 94, 0.25);
  color: #fda4af;
}

.btn--danger:hover:not(:disabled) {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.btn--success {
  background: var(--success-soft);
  border-color: rgba(34, 197, 94, 0.35);
  color: #86efac;
}

.btn--sm {
  padding: 7px 12px;
  font-size: 13px;
}

.btn--full {
  width: 100%;
  padding: 12px 18px;
}

/* ===========================
   Topbar & App Shell
   =========================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(9, 11, 16, 0.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.brand__logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(56, 189, 248, 0.14));
  border: 1px solid rgba(139, 92, 246, 0.35);
  display: grid;
  place-items: center;
  color: #c4b5fd;
  flex-shrink: 0;
}

.brand__logo svg {
  width: 20px;
  height: 20px;
}

.topbar__divider {
  width: 1px;
  height: 20px;
  background: var(--border-strong);
}

.topbar__crumb {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

.user-pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 24px 64px;
}

/* ===========================
   Login Page
   =========================== */

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 410px;
  background: rgba(17, 21, 32, 0.88);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-card);
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.auth-header .brand__logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  margin: 0 auto 14px;
}

.auth-header .brand__logo svg {
  width: 28px;
  height: 28px;
}

.auth-header h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}

.auth-header p {
  font-size: 14px;
  color: var(--text-secondary);
}

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

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 7px;
}

.input-wrap {
  position: relative;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.form-input--password {
  padding-right: 44px;
}

.input-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.input-toggle:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 18px;
  display: none;
  align-items: center;
  gap: 10px;
}

.alert--visible {
  display: flex;
}

.alert--error {
  background: var(--danger-soft);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fecdd3;
}

.auth-footer {
  margin-top: 22px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ===========================
   Dashboard (Modular VPS Hub)
   =========================== */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.page-header__title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 6px;
}

.page-header__subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}

.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.tool-card--active:hover {
  transform: translateY(-3px);
  border-color: var(--border-accent);
  background: var(--bg-elevated);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(139, 92, 246, 0.15);
}

.tool-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tool-card__icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c4b5fd;
}

.tool-card__icon svg {
  width: 24px;
  height: 24px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge--active {
  background: var(--success-soft);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.28);
}

.status-badge--active::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.status-badge--soon {
  background: rgba(148, 163, 184, 0.1);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.tool-card__title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}

.tool-card__desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.55;
}

.tool-card__footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

.tool-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #c4b5fd;
  font-weight: 500;
  transition: transform 0.16s ease;
}

.tool-card--active:hover .tool-card__cta {
  transform: translateX(3px);
}

.tool-card--placeholder {
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(17, 21, 32, 0.42);
  box-shadow: none;
  cursor: default;
}

.tool-card--placeholder .tool-card__icon {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text-muted);
}

/* ===========================
   ImgHost Tool
   =========================== */

.imghost-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.upload-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.dropzone {
  position: relative;
  border: 2px dashed rgba(139, 92, 246, 0.35);
  border-radius: var(--radius-md);
  background: rgba(13, 16, 24, 0.65);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.16s ease;
}

.dropzone:hover {
  border-color: rgba(139, 92, 246, 0.65);
  background: rgba(139, 92, 246, 0.05);
}

.dropzone--dragover {
  border-color: var(--accent);
  background: rgba(139, 92, 246, 0.12);
  transform: scale(0.996);
}

.dropzone__icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--accent-soft);
  border: 1px solid rgba(139, 92, 246, 0.32);
  color: #c4b5fd;
  display: grid;
  place-items: center;
}

.dropzone__icon svg {
  width: 28px;
  height: 28px;
}

.dropzone__title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

.dropzone__subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.dropzone__hints {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-primary);
}

.upload-progress {
  margin-top: 18px;
  display: none;
}

.upload-progress--visible {
  display: block;
}

.upload-progress__meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.upload-progress__track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  overflow: hidden;
}

.upload-progress__bar {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8b5cf6, #38bdf8);
  transition: width 0.14s ease;
}

/* Uploaded Result Preview Panel */
.result-panel {
  display: none;
  background: var(--bg-surface);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-card);
  gap: 22px;
  align-items: center;
}

.result-panel--visible {
  display: grid;
  grid-template-columns: 200px 1fr;
}

.result-panel__thumb {
  width: 100%;
  height: 150px;
  border-radius: var(--radius-md);
  background: var(--bg-input);
  border: 1px solid var(--border);
  overflow: hidden;
  display: grid;
  place-items: center;
  cursor: zoom-in;
}

.result-panel__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.result-panel__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #86efac;
  margin-bottom: 10px;
}

.result-panel__url-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.result-panel__input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
}

.result-panel__input:focus {
  border-color: var(--accent);
}

.result-panel__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-muted);
}

.result-panel__actions {
  display: flex;
  gap: 8px;
}

/* Recent Gallery */
.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.gallery-header__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
}

.count-pill {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}

.gallery-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.16s ease, transform 0.16s ease;
}

.gallery-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.gallery-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--bg-input);
  overflow: hidden;
  cursor: zoom-in;
  border-bottom: 1px solid var(--border);
}

.gallery-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.22s ease;
}

.gallery-card:hover .gallery-card__media img {
  transform: scale(1.03);
}

.gallery-card__body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gallery-card__name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-card__meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.gallery-card__actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 52px 24px;
  background: rgba(17, 21, 32, 0.55);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}

.gallery-empty p {
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--text-muted);
}

/* ===========================
   Modals & Toasts
   =========================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(4, 6, 10, 0.82);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop--open {
  display: flex;
}

.lightbox {
  position: relative;
  max-width: min(92vw, 1060px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.lightbox__img {
  max-width: 100%;
  max-height: 76vh;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65);
}

.lightbox__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: 999px;
}

.lightbox__name {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  margin-right: 4px;
}

.confirm-dialog {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.confirm-dialog h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}

.confirm-dialog p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.confirm-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 13.5px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.2s ease;
}

.toast--success {
  border-color: rgba(34, 197, 94, 0.4);
}

.toast--error {
  border-color: rgba(244, 63, 94, 0.45);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===========================
   Responsive
   =========================== */

@media (max-width: 720px) {
  .topbar__inner {
    padding: 12px 16px;
  }

  .user-pill {
    display: none;
  }

  .container {
    padding: 24px 16px 48px;
  }

  .result-panel--visible {
    grid-template-columns: 1fr;
  }

  .result-panel__url-row {
    flex-direction: column;
  }

  .dropzone {
    padding: 36px 16px;
  }
}
