/* Admin UI */

:root {
  --bg: #f3f6f4;
  --surface: #ffffff;
  --ink: #14231c;
  --muted: #667870;
  --line: #dbe5df;
  --brand: #0f766e;
  --brand-dark: #0b5a54;
  --danger: #b91c1c;
  --success: #047857;
  --shadow: 0 10px 30px rgba(20, 35, 28, 0.06);
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Outfit", "DM Sans", sans-serif;
  --radius: 16px;
}

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

body.admin-body,
body.admin-login-page {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 400px at 100% 0%, rgba(15, 118, 110, 0.08), transparent 60%),
    var(--bg);
  min-height: 100vh;
}

a {
  color: var(--brand);
}

h1, h2, h3 {
  font-family: var(--display);
  margin: 0 0 0.35rem;
}

.muted {
  color: var(--muted);
}

.muted.small,
.small {
  font-size: 0.82rem;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--brand), #115e59);
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

/* Login */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(800px 400px at 20% 0%, rgba(196, 160, 53, 0.18), transparent 50%),
    linear-gradient(160deg, #06281e, #0b3d2e 55%, #125c45);
}

.login-card {
  width: min(100%, 420px);
  background: var(--surface);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.login-brand .brand-mark {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
}

.login-brand h1 {
  font-size: 1.35rem;
}

.login-brand p {
  margin: 4px 0 0;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label,
.form-grid label {
  display: grid;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="file"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(15, 118, 110, 0.25);
  border-color: var(--brand);
}

.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(160deg, var(--brand), var(--brand-dark));
  border-color: transparent;
  color: #fff;
}

.btn-ghost {
  background: transparent;
}

.btn-danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--danger);
}

.btn-sm {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
  border-radius: 9px;
}

.btn-block {
  width: 100%;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-row.center {
  justify-content: center;
}

/* Topbar */
.admin-topbar {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.admin-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
}

.admin-nav {
  display: flex;
  gap: 8px;
  flex: 1;
}

.admin-nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.92rem;
}

.admin-nav a.active,
.admin-nav a:hover {
  color: var(--brand);
  background: rgba(15, 118, 110, 0.08);
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.admin-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0 20px 28px;
}

.page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.alert {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 0.92rem;
}

.alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.search-bar input {
  max-width: 420px;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: 0.9rem;
}

.data-table th {
  background: #f8faf9;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.data-table .empty {
  text-align: center;
  color: var(--muted);
  padding: 32px;
}

.thumb-sm,
.thumb-round {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 10px;
  background: #eef5f1;
}

.thumb-round,
.thumb-round.lg,
.avatar-fallback.round {
  border-radius: 50%;
}

.thumb-round.lg {
  width: 72px;
  height: 72px;
}

.avatar-fallback {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #e0f2ee;
  color: var(--brand);
  font-weight: 700;
}

.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-success {
  background: #d1fae5;
  color: var(--success);
}

.badge-muted {
  background: #e5e7eb;
  color: #4b5563;
}

.actions,
.actions-wrap {
  white-space: nowrap;
}

.actions-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 320px;
  white-space: normal;
}

.inline-form {
  display: inline;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

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

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.form-actions.between {
  justify-content: space-between;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 10px;
  grid-template-columns: none !important;
}

.checkbox-label input {
  width: auto;
}

.field-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.current-media {
  min-height: 120px;
  margin-bottom: 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #f7fbf9;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 8px;
}

.current-media img,
.media-full {
  max-width: 100%;
  border-radius: 12px;
  display: block;
}

.current-media.round {
  width: 140px;
  height: 140px;
  min-height: 140px;
  border-radius: 50%;
  padding: 0;
}

.current-media.round img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.preview-placeholder {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 12px;
  text-align: center;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.wizard-step {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.wizard-step span {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #eef2f0;
  font-weight: 700;
  font-size: 0.75rem;
}

.wizard-step.current,
.wizard-step.done {
  border-color: rgba(15, 118, 110, 0.35);
  color: var(--ink);
}

.wizard-step.current span,
.wizard-step.done span {
  background: var(--brand);
  color: #fff;
}

.upload-zone {
  display: block;
  border: 2px dashed #b7d0c4;
  border-radius: 16px;
  background: #f7fbf9;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  margin: 16px 0;
}

.upload-zone input {
  display: none;
}

.upload-zone-inner {
  display: grid;
  gap: 6px;
  justify-items: center;
  color: var(--muted);
}

.upload-zone-inner i {
  font-size: 1.8rem;
  color: var(--brand);
}

.upload-zone-inner strong {
  color: var(--ink);
}

.upload-zone-round {
  width: 160px;
  height: 160px;
  margin-left: auto;
  margin-right: auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 16px;
}

.preview-frame img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 12px;
  background: #f3f6f4;
}

.preview-round {
  width: 140px;
  height: 140px;
  margin: 12px auto 0;
  border-radius: 50%;
  overflow: hidden;
  background: #eef5f1;
}

.preview-round img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-preview-frame {
  display: flex;
  justify-content: center;
  padding: 12px;
  background:
    radial-gradient(600px 300px at 50% 0%, #1a7a5c 0%, transparent 55%),
    linear-gradient(165deg, #06281e, #0b3d2e);
  border-radius: 16px;
}

.admin-preview-frame .dvc-card {
  width: min(100%, 360px);
  background: #fff;
  border-radius: 20px;
  padding: 24px 18px;
}

.admin-preview-frame .dvc-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.admin-preview-frame .dvc-logo,
.admin-preview-frame .dvc-logo-fallback {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #e8f5ef;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.7rem;
}

.admin-preview-frame .dvc-avatar {
  width: 100px;
  height: 100px;
  margin: 0 auto 12px;
  border-radius: 50%;
  overflow: hidden;
  background: #e8f5ef;
}

.admin-preview-frame .dvc-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-preview-frame .dvc-name {
  text-align: center;
  margin: 0;
  font-family: var(--display);
}

.admin-preview-frame .dvc-role,
.admin-preview-frame .dvc-org {
  text-align: center;
  margin: 4px 0 0;
}

.admin-preview-frame .dvc-primary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 14px 24px;
  margin-top: 16px;
}

.admin-preview-frame .dvc-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 0;
  background: none;
  font-size: 0.72rem;
  font-weight: 600;
}

.admin-preview-frame .dvc-btn.call { background: none; color: #0f766e; }
.admin-preview-frame .dvc-btn.wa { background: none; color: #25d366; }
.admin-preview-frame .dvc-btn.mail { background: none; color: #1d4ed8; }

.detail-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.detail-header {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.detail-list dd {
  margin: 0;
}

.qr-admin {
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
}

.qr-admin .qr-large {
  width: min(100%, 320px);
  height: auto;
  margin: 18px auto 12px;
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.qr-person-name {
  margin: 0;
  font-family: var(--display);
  font-size: 1.4rem;
}

.qr-person-role {
  margin: 6px 0 0;
  color: var(--brand);
  font-weight: 600;
}

.qr-person-org {
  margin: 4px 0 0;
  color: var(--muted);
}

.qr-url-line {
  margin: 16px 0 0;
  word-break: break-all;
}

.qr-url-line a {
  font-weight: 600;
}

.qr-caption {
  color: var(--muted);
  margin: 0 0 8px;
}

.qr-regen-form {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.danger-zone {
  border-color: #fecaca;
  background: #fffafa;
}

@media (max-width: 800px) {
  .form-grid,
  .detail-grid,
  .wizard-steps {
    grid-template-columns: 1fr;
  }

  .admin-topbar-inner {
    flex-wrap: wrap;
  }

  .admin-nav {
    order: 3;
    width: 100%;
  }
}
