:root {
  color-scheme: light;

  --bg: #f0f9ff;
  --panel: #ffffff;
  --panel-2: #e0f2fe;
  --border: #bae6fd;

  --text: #0f172a;
  --text-bright: #0c4a6e;
  --muted: #64748b;

  --accent: #0ea5e9;
  --accent-2: #0284c7;

  --success: #16a34a;
  --warn: #f59e0b;
  --danger: #dc2626;

  --radius: 14px;
}

/* ---------- Global ---------- */

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--bg) !important;
  color: var(--text) !important;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  min-height: 100vh;
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-bright) !important;
}

p {
  color: var(--text) !important;
}

strong,
b {
  color: var(--text-bright);
}

/* ---------- Topbar ---------- */

.topbar {
  background: #ffffff !important;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(14, 165, 233, 0.08);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
}

.brand {
  color: #0369a1 !important;
  font-weight: 800;
  font-size: 1.2rem;
  text-decoration: none;
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 18px;
}

.topbar-links a {
  color: #334155 !important;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
}

.topbar-links a:hover {
  color: var(--accent-2) !important;
}

/* ---------- Layout ---------- */

.app-layout {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  gap: 24px;
  padding: 24px 20px 60px;
  align-items: flex-start;
}

/* ---------- Sidebar ---------- */

.sidebar {
  width: 220px;
  flex-shrink: 0;

  background: #ffffff !important;

  border: 1px solid var(--border);
  border-radius: var(--radius);

  padding: 18px 12px;

  position: sticky;
  top: 78px;

  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.08);
}

.sidebar-section-title {
  color: #64748b !important;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 16px 10px 6px;
}

.sidebar-section-title:first-child {
  margin-top: 4px;
}

.nav-link {
  display: block;
  padding: 9px 10px;

  border-radius: 8px;

  text-decoration: none;

  color: #334155 !important;

  font-size: 0.9rem;
  margin-bottom: 2px;

  transition:
    background 0.15s,
    color 0.15s;
}

.nav-link:hover {
  background: #e0f2fe !important;
  color: #0369a1 !important;
}

.nav-link.active {
  background: #e0f2fe !important;
  color: #0284c7 !important;
  font-weight: 700;
}

.guest-badge {
  display: inline-block;
  margin: 6px 10px;

  font-size: 0.75rem;

  padding: 4px 10px;

  border-radius: 20px;

  background: #fef3c7;

  color: #92400e !important;
}

.main-content {
  flex: 1;
  min-width: 0;
}

/* ---------- Cards ---------- */

.card {
  background: #ffffff !important;

  color: var(--text) !important;

  border: 1px solid var(--border);

  border-radius: var(--radius);

  padding: 22px;

  margin-bottom: 22px;

  box-shadow: 0 4px 16px rgba(14, 165, 233, 0.07);
}

.card h1,
.card h2,
.card h3,
.card h4,
.card h5,
.card h6 {
  color: #0c4a6e !important;
}

.card p {
  color: #64748b !important;
}

/* ---------- Stats ---------- */

.stat-grid {
  display: grid;

  grid-template-columns:
    repeat(auto-fit, minmax(180px, 1fr));

  gap: 16px;

  margin-bottom: 24px;
}

.stat-card {
  background: #ffffff !important;

  color: var(--text) !important;

  border: 1px solid var(--border);

  border-radius: var(--radius);

  padding: 18px 20px;

  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.06);
}

.stat-card .label {
  color: #64748b !important;

  font-size: 0.82rem;

  margin-bottom: 6px;
}

.stat-card .value {
  color: #0369a1 !important;

  font-size: 1.7rem;

  font-weight: 800;
}

/* ---------- Tool Cards ---------- */

.tool-grid {
  display: grid;

  grid-template-columns:
    repeat(auto-fit, minmax(230px, 1fr));

  gap: 18px;

  margin-top: 22px;
}

.tool-card {
  background: #ffffff !important;

  border: 1px solid var(--border);

  border-radius: var(--radius);

  padding: 22px;

  text-decoration: none;

  color: var(--text) !important;

  display: block;

  transition:
    transform 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
}

.tool-card:hover {
  transform: translateY(-3px);

  border-color: var(--accent);

  box-shadow:
    0 8px 24px rgba(14, 165, 233, 0.14);
}

.tool-card .icon {
  font-size: 1.8rem;

  display: block;

  margin-bottom: 10px;
}

.tool-card h3 {
  color: #0c4a6e !important;

  margin: 0 0 6px;
}

.tool-card p {
  color: #64748b !important;

  margin: 0;

  font-size: 0.9rem;
}

/* ---------- Forms ---------- */

label {
  display: block;

  margin-bottom: 6px;

  font-size: 0.85rem;

  color: #475569 !important;
}

/* Input */

.form-control,
.form-select,
textarea.form-control,
input.form-control,
select.form-select,
textarea {
  background-color: #ffffff !important;

  color: #0f172a !important;

  border: 1px solid #bae6fd !important;

  border-radius: 8px !important;

  -webkit-text-fill-color: #0f172a !important;

  opacity: 1 !important;
}

/* Placeholder */

.form-control::placeholder,
.form-select::placeholder,
textarea.form-control::placeholder,
input::placeholder,
textarea::placeholder {
  color: #94a3b8 !important;

  opacity: 1 !important;

  -webkit-text-fill-color: #94a3b8 !important;
}

.form-control::-moz-placeholder,
input::-moz-placeholder,
textarea::-moz-placeholder {
  color: #94a3b8 !important;

  opacity: 1 !important;
}

.form-control::-webkit-input-placeholder,
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
  color: #94a3b8 !important;

  opacity: 1 !important;
}

/* Focus */

.form-control:focus,
.form-select:focus,
textarea.form-control:focus,
input.form-control:focus {
  background-color: #ffffff !important;

  color: #0f172a !important;

  border-color: #0ea5e9 !important;

  box-shadow:
    0 0 0 3px rgba(14, 165, 233, 0.18) !important;

  outline: none !important;

  -webkit-text-fill-color: #0f172a !important;
}

/* Select */

.form-select option {
  background: #ffffff !important;

  color: #0f172a !important;
}

/* Date / time */

input[type="date"],
input[type="datetime-local"],
input[type="time"] {
  background-color: #ffffff !important;

  color: #0f172a !important;

  -webkit-text-fill-color: #0f172a !important;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: 0.7;
}

/* Checkbox */

.form-check-input {
  background-color: #ffffff !important;

  border-color: #bae6fd !important;
}

.form-check-input:checked {
  background-color: #0ea5e9 !important;

  border-color: #0ea5e9 !important;
}

.form-check-label {
  color: #334155 !important;
}

/* ---------- Buttons ---------- */

.btn {
  color: #ffffff !important;
}

.btn-primary {
  background: #0ea5e9 !important;

  border-color: #0ea5e9 !important;

  color: #ffffff !important;

  font-weight: 600;
}

.btn-primary:hover,
.btn-primary:focus {
  background: #0284c7 !important;

  border-color: #0284c7 !important;

  color: #ffffff !important;
}

.btn-outline-light {
  background: #ffffff !important;

  border-color: #bae6fd !important;

  color: #0369a1 !important;
}

.btn-outline-light:hover {
  background: #e0f2fe !important;

  border-color: #0ea5e9 !important;

  color: #0369a1 !important;
}

/* ---------- Form Row ---------- */

.row-gap {
  display: flex;

  gap: 14px;

  flex-wrap: wrap;
}

.row-gap > * {
  flex: 1;

  min-width: 180px;
}

/* ---------- Result Panels ---------- */

.result-box {
  background: #f8fdff !important;

  border: 1px solid #bae6fd !important;

  border-radius: 10px;

  padding: 16px;

  margin-top: 16px;

  word-break: break-all;

  color: #0f172a !important;

  -webkit-text-fill-color: #0f172a !important;
}

.result-box * {
  color: #0f172a !important;
}

.result-box strong,
.result-box b,
.result-box h1,
.result-box h2,
.result-box h3,
.result-box h4,
.result-box h5,
.result-box h6 {
  color: #0c4a6e !important;
}

/* ---------- Key Value Table ---------- */

.kv-table {
  width: 100%;
}

.kv-table td {
  padding: 6px 8px;

  border-bottom: 1px solid #e0f2fe;

  font-size: 0.9rem;

  vertical-align: top;

  color: #334155 !important;

  -webkit-text-fill-color: #334155 !important;
}

.kv-table td:first-child {
  color: #64748b !important;

  -webkit-text-fill-color: #64748b !important;

  width: 200px;
}

.kv-table td:last-child {
  color: #0f172a !important;

  -webkit-text-fill-color: #0f172a !important;
}

/* ---------- Redirect Chain ---------- */

.redirect-chain {
  display: flex;

  flex-direction: column;

  align-items: flex-start;

  gap: 4px;

  margin-top: 10px;
}

.redirect-chain .hop {
  background: #f0f9ff !important;

  border: 1px solid #bae6fd;

  border-radius: 8px;

  padding: 8px 12px;

  font-size: 0.85rem;

  width: 100%;

  word-break: break-all;

  color: #0369a1 !important;

  -webkit-text-fill-color: #0369a1 !important;
}

.redirect-chain .arrow {
  color: #64748b !important;

  -webkit-text-fill-color: #64748b !important;

  padding-left: 12px;

  font-size: 0.8rem;
}

/* ---------- Status Badges ---------- */

.badge-status {
  display: inline-block;

  padding: 4px 12px;

  border-radius: 20px;

  font-weight: 700;

  font-size: 0.85rem;
}

.badge-2xx {
  background: #dcfce7 !important;

  color: #15803d !important;
}

.badge-3xx {
  background: #fef3c7 !important;

  color: #b45309 !important;
}

.badge-4xx,
.badge-5xx,
.badge-err {
  background: #fee2e2 !important;

  color: #b91c1c !important;
}

.badge-ssl-valid {
  background: #dcfce7 !important;

  color: #15803d !important;

  padding: 3px 10px;

  border-radius: 20px;

  font-size: 0.78rem;
}

.badge-ssl-invalid,
.badge-ssl-none {
  background: #fee2e2 !important;

  color: #b91c1c !important;

  padding: 3px 10px;

  border-radius: 20px;

  font-size: 0.78rem;
}

/* ---------- Tables ---------- */

table {
  color: #334155 !important;
}

table.data-table {
  width: 100%;

  border-collapse: collapse;
}

table.data-table th,
table.data-table td {
  text-align: left;

  padding: 10px;

  border-bottom: 1px solid #e0f2fe;

  font-size: 0.87rem;

  color: #334155 !important;

  -webkit-text-fill-color: #334155 !important;
}

table.data-table th {
  color: #64748b !important;

  -webkit-text-fill-color: #64748b !important;

  font-weight: 600;

  background: #f8fdff;
}

table.data-table tbody td {
  color: #0f172a !important;

  -webkit-text-fill-color: #0f172a !important;
}

table.data-table tbody tr:hover {
  background: #f0f9ff !important;
}

/* ---------- Short Links Table ---------- */

.short-links-table,
.short-links-table th,
.short-links-table td {
  color: #0f172a !important;

  -webkit-text-fill-color: #0f172a !important;
}

.short-links-table th {
  color: #64748b !important;

  -webkit-text-fill-color: #64748b !important;
}

/* ---------- Short Link Text ---------- */

.short-link,
.short-link a,
.short-url,
.short-url a {
  color: #0284c7 !important;

  -webkit-text-fill-color: #0284c7 !important;

  font-weight: 600;
}

.original-url,
.original-url a {
  color: #475569 !important;

  -webkit-text-fill-color: #475569 !important;
}

.short-link a:hover,
.short-url a:hover,
.original-url a:hover {
  color: #0369a1 !important;
}

/* ---------- Truncate ---------- */

.truncate {
  max-width: 260px;

  overflow: hidden;

  text-overflow: ellipsis;

  white-space: nowrap;

  display: inline-block;

  vertical-align: bottom;

  color: #0f172a !important;

  -webkit-text-fill-color: #0f172a !important;
}

/* ---------- Loading ---------- */

.loading-spinner {
  display: inline-block;

  width: 18px;

  height: 18px;

  border: 2px solid rgba(14, 165, 233, 0.2);

  border-top-color: #0ea5e9;

  border-radius: 50%;

  animation: spin 0.7s linear infinite;
}

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

/* ---------- Empty State ---------- */

.empty-state {
  text-align: center;

  padding: 40px 20px;

  color: #64748b !important;
}

.empty-state .icon {
  font-size: 2.2rem;

  display: block;

  margin-bottom: 10px;
}

.empty-state h1,
.empty-state h2,
.empty-state h3,
.empty-state h4,
.empty-state h5,
.empty-state h6 {
  color: #0c4a6e !important;
}

.empty-state p {
  color: #64748b !important;
}

/* ---------- Toasts ---------- */

#toast-container {
  position: fixed;

  top: 18px;

  right: 18px;

  z-index: 999;

  display: flex;

  flex-direction: column;

  gap: 10px;
}

.toast-msg {
  min-width: 260px;

  max-width: 340px;

  padding: 12px 16px;

  border-radius: 10px;

  font-size: 0.88rem;

  box-shadow:
    0 8px 24px rgba(14, 165, 233, 0.18);

  animation: slideIn 0.2s ease;
}

.toast-msg.success {
  background: #f0fdf4 !important;

  border: 1px solid #86efac;

  color: #166534 !important;
}

.toast-msg.error {
  background: #fef2f2 !important;

  border: 1px solid #fca5a5;

  color: #991b1b !important;
}

.toast-msg.info {
  background: #f0f9ff !important;

  border: 1px solid #7dd3fc;

  color: #075985 !important;
}

.toast-msg.success *,
.toast-msg.error *,
.toast-msg.info * {
  color: inherit !important;
}

@keyframes slideIn {
  from {
    opacity: 0;

    transform: translateX(20px);
  }

  to {
    opacity: 1;

    transform: translateX(0);
  }
}

/* ---------- Footer ---------- */

.site-footer {
  text-align: center;

  color: #64748b !important;

  font-size: 0.82rem;

  padding: 30px 0 40px;
}

/* ---------- Bootstrap Overrides ---------- */

.text-dark,
.text-body,
.text-black {
  color: #0f172a !important;
}

.text-muted {
  color: #64748b !important;
}

.card-body {
  color: #334155 !important;
}

.card-title {
  color: #0c4a6e !important;
}

.card-text {
  color: #475569 !important;
}

.card .text-muted,
.card small,
.card .small {
  color: #64748b !important;
}

/* ---------- Main Content Links ---------- */

.main-content a {
  color: #0284c7;
}

.main-content a:hover {
  color: #0369a1;
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;

    position: static;

    display: flex;

    flex-wrap: wrap;

    gap: 4px;
  }

  .sidebar-section-title {
    display: none;
  }

  .topbar-links a:not(.btn) {
    display: none;
  }
}

@media (max-width: 600px) {
  .app-layout {
    padding: 16px 12px 40px;
  }

  .card {
    padding: 16px;
  }

  .topbar-inner {
    padding: 12px 14px;
  }

  .row-gap {
    flex-direction: column;
  }

  .row-gap > * {
    min-width: 100%;
  }

  table.data-table {
    display: block;

    overflow-x: auto;
  }
}