:root {
  --pink: #E20074;
  --navy: #002147;
  --navy-soft: #0a3358;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #5c6b7a;
  --border: #d8dee6;
  --ok: #0a7a3e;
  --warn: #b86b00;
  --danger: #b00020;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,33,71,.08);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100vh;
}
a { color: var(--pink); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem 1rem;
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.brand-mark {
  background: var(--pink);
  width: 1.75rem; height: 1.75rem;
  border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .95rem;
}
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; }
.nav a { color: #fff; opacity: .92; }
.nav a:hover { opacity: 1; color: #fff; }
.nav-user { color: #c9d6e5; font-size: .9rem; }

.container { max-width: 1100px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 1rem; }

h1 { margin: 0 0 1rem; font-size: 1.45rem; color: var(--navy); }
h2 { margin: 1.25rem 0 .75rem; font-size: 1.15rem; color: var(--navy); }
.sub { color: var(--muted); margin: -.5rem 0 1rem; font-size: .95rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.btn {
  display: inline-block;
  border: none;
  border-radius: 8px;
  padding: .55rem .9rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--pink);
  color: #fff;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.05); text-decoration: none; }
.btn-secondary { background: var(--navy); }
.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255,255,255,.45);
  color: #fff;
  padding: .35rem .7rem;
  font-weight: 500;
}
.btn-outline {
  background: #fff;
  color: var(--navy);
  border: 1px solid var(--border);
}
.btn-danger { background: var(--danger); }
.btn-sm { padding: .35rem .65rem; font-size: .85rem; }
.btn-block { display: block; width: 100%; text-align: center; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .75rem 0; }

label { display: block; font-weight: 600; margin: .65rem 0 .25rem; font-size: .92rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=file], select, textarea {
  width: 100%;
  padding: .55rem .65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
textarea { min-height: 80px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.hint { color: var(--muted); font-size: .85rem; margin: .2rem 0 .4rem; }
.checkbox-row { display: flex; align-items: center; gap: .5rem; margin: .75rem 0; }
.checkbox-row label { margin: 0; font-weight: 500; }
.checkbox-row input { width: auto; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .45rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--navy); font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; }
.thumb {
  width: 56px; height: 56px; object-fit: cover;
  border-radius: 6px; background: #eee; display: block;
}
.thumb-placeholder {
  width: 56px; height: 56px; border-radius: 6px;
  background: #e8edf3; color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: .7rem;
}

.badge {
  display: inline-block;
  padding: .15rem .45rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-available { background: #d9f5e5; color: var(--ok); }
.badge-sold_partner { background: #e8edf3; color: var(--muted); }
.badge-sold_seller { background: #e8edf3; color: var(--muted); } /* legacy alias */
.badge-sold_compuvilla { background: #dde8ff; color: var(--navy); }
.badge-withdrawn { background: #e8edf3; color: var(--muted); } /* legacy alias → sold_partner */
.badge-active { background: #d9f5e5; color: var(--ok); }
.badge-disabled { background: #fde7eb; color: var(--danger); }

.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-ok { background: #d9f5e5; color: var(--ok); }
.alert-error { background: #fde7eb; color: var(--danger); }
.alert-info { background: #e8f0ff; color: var(--navy); }

.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-soft) 55%, #3a0a2a 100%);
}
.login-card {
  width: 100%; max-width: 400px;
  background: #fff; border-radius: 14px;
  padding: 1.5rem; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.login-card h1 { margin-bottom: .25rem; }
.creds-box {
  background: #f7f9fc;
  border: 1px dashed var(--pink);
  border-radius: 8px;
  padding: .85rem;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88rem;
}
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .65rem; align-items: end; }
.filters .btn { margin-top: .25rem; }
.stats { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.stat {
  background: #fff; border: 1px solid var(--border);
  border-radius: 8px; padding: .5rem .8rem; font-size: .9rem;
}
.stat strong { color: var(--navy); }

.password-field {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.password-field input {
  border: none !important;
  border-radius: 0 !important;
  margin: 0 !important;
  flex: 1;
  min-width: 0;
}
.password-field input:focus {
  outline: none;
  box-shadow: none;
}
.password-field:focus-within {
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(226,0,116,.15);
}
.password-toggle {
  border: none;
  border-left: 1px solid var(--border);
  background: #f7f9fc;
  color: var(--navy);
  font-weight: 600;
  font-size: .85rem;
  padding: 0 .85rem;
  cursor: pointer;
  white-space: nowrap;
}
.password-toggle:hover { background: #eef2f7; }
.password-toggle[aria-pressed="true"] { color: var(--pink); }
