
:root{
  --bg1:#0b1220;
  --bg2:#101a2f;
  --card: rgba(18, 26, 40, 0.78);
  --text:#e7eefc;
  --muted:#a9b6d2;
  --line: rgba(255,255,255,0.10);
  --accent:#7dd3fc;  /* light sky */
  --accent2:#a78bfa; /* soft purple */
  --danger:#ef4444;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color:var(--text);

  background:
    linear-gradient(180deg, rgba(8,12,20,0.40), rgba(8,12,20,0.70)),
    url("/static/img/bg-housing.jpg") center / cover no-repeat fixed,
    radial-gradient(1200px 800px at 20% 10%, rgba(125,211,252,0.18), transparent 60%),
    radial-gradient(1000px 700px at 80% 20%, rgba(167,139,250,0.15), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg2));

  overflow-x:hidden;
}

/* If templates still include these divs, disable them */
.bg, .bg-overlay{ display:none !important; }

/* Layout */
.topbar{
  position:sticky;
  top:0;
  z-index:10;
  border-bottom:1px solid var(--line);
  backdrop-filter: blur(10px);
  background: rgba(10, 15, 24, 0.55);
}

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

.brand{ display:flex; align-items:center; gap:12px; }
.brand-mark{
  width:40px; height:40px;
  display:grid; place-items:center;
  border-radius:12px;
  background: linear-gradient(135deg, rgba(125,211,252,0.25), rgba(167,139,250,0.25));
  border:1px solid var(--line);
  font-weight:800;
}
.brand-title{ font-weight:800; letter-spacing:0.2px; }
.brand-sub{ font-size:12px; color:var(--muted); margin-top:2px; }

.nav{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.nav-link{
  text-decoration:none;
  color:var(--text);
  font-size:14px;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid transparent;
}
.nav-link:hover{
  border-color:var(--line);
  background: rgba(255,255,255,0.04);
}
.nav-form{ margin:0; }

.page{ padding:26px 0 40px; }
.container{
  max-width:1100px;
  margin:0 auto;
  padding:0 18px;
}
.card{
  border:1px solid var(--line);
  border-radius:18px;
  background: var(--card);
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  padding:22px;
}

/* Typography */
h1{ margin:0 0 12px; font-size:26px; letter-spacing:0.2px; }
h2{ margin:18px 0 10px; font-size:18px; }
p{ color:var(--text); line-height:1.55; }
.muted{ color:var(--muted); }
.small{ font-size:12px; }

/* Forms */
label{ display:block; font-size:13px; color:var(--muted); margin-top:10px; }
input, textarea, select{
  width:100%;
  margin-top:6px;
  padding:11px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background: rgba(10, 15, 24, 0.55);
  color:var(--text);
  outline:none;
}
textarea{ min-height:140px; resize:vertical; }
input:focus, textarea:focus, select:focus{
  border-color: rgba(125,211,252,0.55);
  box-shadow: 0 0 0 4px rgba(125,211,252,0.12);
}
.row{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
@media (max-width: 820px){ .row{ grid-template-columns:1fr; } }

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

/* =========================
   Buttons (Glass + slight glow)
   ========================= */
.btn{
  border:1px solid rgba(255,255,255,0.18);
  border-radius:12px;
  padding:10px 14px;
  font-weight:700;
  cursor:pointer;

  color: var(--text);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  /* ✅ Uniform sizing */
  min-width: 78px;
  min-height: 38px;
  line-height: 1;
  white-space: nowrap;

  box-shadow:
    0 6px 22px rgba(0,0,0,0.30),
    inset 0 1px 0 rgba(255,255,255,0.12);
  transition: all 0.22s ease;
}
.btn:hover{
  background: rgba(255,255,255,0.14);
  transform: translateY(-1px);
  box-shadow:
    0 0 10px rgba(125,211,252,0.28),
    0 0 18px rgba(167,139,250,0.22),
    0 10px 28px rgba(0,0,0,0.40);
}
.btn:active{
  transform: translateY(1px);
  box-shadow:
    0 6px 18px rgba(0,0,0,0.30);
}

.btn-ghost{
  background: rgba(255,255,255,0.06);
  border:1px solid rgba(255,255,255,0.14);
  color:var(--text);

  /* ✅ Uniform sizing */
  min-width: 78px;
  min-height: 38px;
  line-height: 1;
  white-space: nowrap;

  box-shadow:
    0 6px 18px rgba(0,0,0,0.22),
    inset 0 1px 0 rgba(255,255,255,0.10);
  transition: all 0.22s ease;
}
.btn-ghost:hover{
  background: rgba(255,255,255,0.10);
  box-shadow:
    0 0 8px rgba(125,211,252,0.18),
    0 10px 26px rgba(0,0,0,0.35);
}

.btn-danger{
  background: rgba(239,68,68,0.12);
  border:1px solid rgba(239,68,68,0.35);
  color: #ffd6d6;

  /* ✅ Uniform sizing */
  min-width: 78px;
  min-height: 38px;
  line-height: 1;
  white-space: nowrap;

  box-shadow:
    0 6px 18px rgba(0,0,0,0.24),
    inset 0 1px 0 rgba(255,255,255,0.10);
  transition: all 0.22s ease;
}
.btn-danger:hover{
  background: rgba(239,68,68,0.18);
  box-shadow:
    0 0 10px rgba(239,68,68,0.25),
    0 10px 26px rgba(0,0,0,0.40);
}

/* Tables */
table{
  width:100%;
  border-collapse:collapse;
  margin-top:12px;
  overflow:hidden;
  border-radius:14px;
  border:1px solid var(--line);
}
th, td{
  padding:10px 12px;
  border-bottom:1px solid var(--line);
  text-align:left;
  vertical-align:top;
}
th{
  color:var(--muted);
  font-weight:700;
  background: rgba(255,255,255,0.04);
}
tr:hover td{ background: rgba(255,255,255,0.03); }

.code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  color: #d7e5ff;
  background: rgba(0,0,0,0.25);
  border:1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  overflow:auto;
}

/* Footer */
.footer{
  margin-top:14px;
  display:flex;
  flex-direction:column;
  gap:6px;
  align-items:center;
  justify-content:center;
  color:var(--muted);
  font-size:12px;
  opacity:0.9;
}

.footer-row{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
}

.footer-mail{
  white-space:nowrap;
}
.dot{ opacity:0.6; }

.footer-mail{
  color: var(--accent);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: rgba(125,211,252,0.60);
  text-underline-offset: 3px;
}
.footer-mail:hover{
  color: #c4b5fd;
  text-decoration-color: rgba(196,181,253,0.85);
}

/* Default links in content */
.card a:link,
.card a:visited,
table a:link,
table a:visited,
.page a:link,
.page a:visited{
  color: var(--accent) !important;
  font-weight: 700;
  text-decoration: underline !important;
  text-decoration-color: rgba(125,211,252,0.60) !important;
  text-underline-offset: 3px;
}

.card a:hover,
table a:hover,
.page a:hover{
  color: #c4b5fd !important;
  text-decoration-color: rgba(196,181,253,0.85) !important;
}

/* Anchor buttons should look like buttons (glass too) */
a.btn:link,
a.btn:visited,
.card a.btn:link,
.card a.btn:visited,
.page a.btn:link,
.page a.btn:visited,
table a.btn:link,
table a.btn:visited{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  padding:10px 14px !important;

  background: rgba(255,255,255,0.08) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;

  color: var(--text) !important;
  border: 1px solid rgba(255,255,255,0.18) !important;
  border-radius:12px !important;

  text-decoration:none !important;
  text-decoration-color: transparent !important;
  font-weight:700 !important;

  opacity:1 !important;
  filter:none !important;

  /* ✅ Uniform sizing for anchor-buttons too */
  min-width: 78px !important;
  min-height: 38px !important;
  line-height: 1 !important;
  white-space: nowrap !important;

  box-shadow:
    0 6px 22px rgba(0,0,0,0.30),
    inset 0 1px 0 rgba(255,255,255,0.12) !important;
}

a.btn:hover,
.card a.btn:hover,
.page a.btn:hover,
table a.btn:hover{
  background: rgba(255,255,255,0.14) !important;
  box-shadow:
    0 0 10px rgba(125,211,252,0.28),
    0 0 18px rgba(167,139,250,0.22),
    0 10px 28px rgba(0,0,0,0.40) !important;
  text-decoration:none !important;
  transform: translateY(-1px);
}

a.btn:active,
.card a.btn:active,
.page a.btn:active,
table a.btn:active{
  transform: translateY(1px);
}

.nav a.nav-link:link,
.nav a.nav-link:visited{
  color: var(--text) !important;
  font-weight: 600;
  text-decoration: none !important;
}

a[href$="/new"],
a[href*="/new?"],
a[href*="/new/"]{
  display:inline-block;
  margin: 6px 0 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(125,211,252,0.12);
  border: 1px solid rgba(125,211,252,0.25);
  text-decoration: none !important;
  font-weight: 800;
}
a[href$="/new"]:hover,
a[href*="/new?"]:hover,
a[href*="/new/"]:hover{
  background: rgba(125,211,252,0.18);
}

/* =========================
   MOBILE FIXES (prevents "zoomed out" basket/table)
   ========================= */
@media (max-width: 720px){

  /* Use full width on mobile */
  .topbar-inner,
  .container{
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Reduce padding so cards have room */
  .topbar-inner{
    padding: 12px 12px;
    gap: 12px;
    align-items:flex-start;
  }

  .container{
    padding: 0 12px;
  }

  .page{
    padding: 18px 0 28px;
  }

  .card{
    padding: 16px;
    border-radius: 16px;
  }

  h1{ font-size:22px; }
  h2{ font-size:16px; }

  /* Keep nav tidy on small screens */
  .nav{
    gap: 8px;
  }
  .nav-link{
    padding: 7px 9px;
    font-size: 13px;
  }

  /* Tables: scroll horizontally instead of shrinking the whole page */
  table{
    display:block;
    width:100%;
    overflow-x:auto;              /* <-- key */
    overflow-y:hidden;
    -webkit-overflow-scrolling: touch;
    border-radius: 14px;
  }

  th, td{
    white-space: nowrap;          /* keeps columns readable */
    padding: 10px 10px;
  }

  table, th, td{
    font-size: 14px;
  }

  /* Buttons wrap nicely */
  .actions{
    gap: 10px;
  }

  .btn{
    padding: 10px 14px;
  }
}