:root {
  --bg: #f4f1ea;
  --panel: #fffaf0;
  --ink: #16202a;
  --muted: #5c6a75;
  --brand: #2fab9a;
  --brand-2: #ff9030;
  --brand-3: #ff5090;
  --line: #e0d7c6;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at 10% 20%, #dce8db 0, transparent 38%),
              radial-gradient(circle at 92% 12%, #f6d8b4 0, transparent 42%),
              var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

.bg-shape {
  position: fixed;
  border-radius: 50%;
  z-index: -1;
  opacity: .28;
}
.shape-1 { width: 320px; height: 320px; background: var(--brand); left: -80px; bottom: -110px; }
.shape-2 { width: 300px; height: 300px; background: var(--brand-2); right: -90px; top: -90px; }

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 1rem;
}

.topbar {
  background: #0d1117;
  color: #fff;
  padding: 1rem 1.2rem;
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  border-bottom: 3px solid var(--brand);
}

.topbar-brand { display: flex; align-items: center; gap: .7rem; }
.topbar-brand img { height: 34px; }
.topbar h1 { margin: 0; font-size: 1.2rem; }
.topbar p { margin: .25rem 0 0; opacity: .8; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 9px 24px rgba(20, 31, 46, 0.08);
  animation: rise .45s ease;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

h2 { margin-top: 0; }
.muted { color: var(--muted); }

.form-grid {
  display: grid;
  gap: .9rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid label {
  display: grid;
  gap: .35rem;
  font-weight: 600;
}

.full-width { grid-column: 1 / -1; }

input, select, textarea {
  width: 100%;
  border: 1px solid #d5d8df;
  border-radius: 10px;
  padding: .72rem;
  background: #fff;
  font: inherit;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: .65rem .95rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn.primary { background: var(--brand); color: #fff; }
.btn.secondary { background: #1f2937; color: #fff; }
.btn.tiny { background: #d9f2ee; color: #0d5c52; padding: .4rem .65rem; }
.btn.tiny.danger { background: #fde4e1; color: #8f2318; }

.alert {
  border-radius: 10px;
  padding: .65rem .8rem;
}

.alert.success { background: #dbf7e9; color: #075937; }
.alert.error { background: #fde4e1; color: #8f2318; }

.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

th, td {
  border-bottom: 1px solid #ddd;
  text-align: left;
  padding: .68rem .45rem;
}

.tag {
  background: #f1efe8;
  border: 1px solid #d4cab6;
  border-radius: 999px;
  font-size: .84rem;
  padding: .24rem .52rem;
}

.tag-admin    { background: #fde0ee; border-color: var(--brand-3); color: #99114f; }
.tag-jefatura { background: #d9f2ee; border-color: var(--brand); color: #0d5c52; }
.tag-guardia  { background: #ffe9d6; border-color: var(--brand-2); color: #99500e; }

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.inline-form {
  display: flex;
  align-items: end;
  gap: .7rem;
  flex-wrap: wrap;
  margin: .6rem 0 .95rem;
}

.image-preview img {
  max-width: 100%;
  width: 260px;
  border-radius: 10px;
  border: 1px solid #ddd;
}

.image-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  margin-bottom: 1rem;
}

.image-preview-grid img {
  max-width: 100%;
  width: 220px;
  border-radius: 10px;
  border: 1px solid #ddd;
}

.image-fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .85rem 1rem;
}

.image-fieldset legend {
  font-weight: 600;
  padding: 0 .4rem;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.image-grid label {
  display: grid;
  gap: .3rem;
  font-weight: 600;
  font-size: .93rem;
}

.full-detail {
  grid-column: 1 / -1;
}

.row-actions {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
}

.login-card {
  max-width: 440px;
  margin: 10vh auto;
}

@media (max-width: 760px) {
  .form-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .container { padding: .65rem; }
  .image-grid { grid-template-columns: 1fr; }
  .image-preview-grid img { width: 100%; }
}
