:root {
  color-scheme: light;
  --ink: #07111f;
  --navy: #041d35;
  --blue: #108de4;
  --blue-deep: #09599b;
  --line: #dbe5ee;
  --paper: #ffffff;
  --muted: #667384;
  --wash: #eef5fb;
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--wash); color: var(--ink); }
a { color: inherit; }
button, input { font: inherit; }

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  color: #e8f4ff;
  background: var(--navy);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  font-weight: 900;
}

.brand strong { font-size: 20px; }
.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a, .sidebar nav button, .sidebar-logout {
  min-height: 44px;
  display: flex;
  align-items: center;
  border: 0;
  padding: 0 14px;
  border-radius: 8px;
  color: #dcecff;
  background: transparent;
  text-decoration: none;
  cursor: pointer;
}
.sidebar nav a:hover, .sidebar nav button:hover, .sidebar-logout:hover { background: rgba(255,255,255,.1); }
.sidebar-logout { margin-top: auto; width: 100%; }

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar, .section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue-deep);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 36px; line-height: 1.08; }
h2 { margin-bottom: 18px; font-size: 24px; }

.primary, .ghost {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  text-decoration: none;
  cursor: pointer;
}

.primary { color: #fff; background: var(--blue); font-weight: 800; }
.ghost { color: var(--blue-deep); background: #eaf4fc; font-weight: 700; }
.danger { color: #c0362c; }
.muted { color: var(--muted); }
.notice, .form-error {
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 700;
}
.notice { color: #09599b; background: #e3f3ff; }
.form-error { color: #b42318; background: #fff1f0; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 26px 0;
}

.metric, .panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 18px 40px rgba(7, 17, 31, .07);
}

.metric { padding: 20px; }
.metric span { color: var(--muted); }
.metric strong { display: block; margin-top: 8px; font-size: 34px; }

.panel { padding: 22px; }
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, .88fr);
  gap: 20px;
  align-items: stretch;
  margin-top: 26px;
}

.preview-panel, .contacts-panel { margin: 0; }
.contacts-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.contact-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.profile-upload-preview {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #f8fbfe;
}
.profile-upload-preview .avatar.large {
  width: 126px;
  height: 126px;
  margin: 0;
  border-color: #fff;
  box-shadow: 0 8px 24px rgba(7, 17, 31, .12);
  font-size: 14px;
}
.profile-upload-preview p { margin: 0; }
.contact-form label { display: grid; gap: 7px; color: #243244; font-size: 13px; font-weight: 800; }
.contact-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfdbe6;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fbfdff;
}
.contact-form .two, .contact-form button { grid-column: 1 / -1; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.file-field input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; pointer-events: none; }
.file-field span {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #8db8db;
  border-radius: 8px;
  color: var(--blue-deep);
  background: #f3faff;
  cursor: pointer;
}

.generated { display: grid; gap: 16px; }
.card-preview-shell {
  display: grid;
  place-items: center;
  min-height: 460px;
  border-radius: 8px;
  padding: 16px;
  background: linear-gradient(135deg, #e7f2fb, #f8fbfe);
  overflow: hidden;
}
.card-preview {
  width: min(100%, 330px);
  max-height: 560px;
  object-fit: contain;
  filter: drop-shadow(0 18px 28px rgba(7, 17, 31, .18));
}
.selected-summary {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}
.selected-summary strong, .selected-summary span, .selected-summary a { display: block; }
.selected-summary span { color: var(--muted); }
.selected-summary a { color: var(--blue-deep); overflow-wrap: anywhere; }
.link-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.copy-button {
  width: 42px;
  min-height: 42px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--blue-deep);
  background: #eaf4fc;
  cursor: pointer;
  font-size: 22px;
  font-weight: 900;
}
.copy-button:hover { background: #d9ecfb; }

.avatar {
  width: 82px;
  height: 82px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border: 4px solid #fff;
  border-radius: 999px;
  background: #dbe7f1;
  color: var(--blue-deep);
  font-weight: 900;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.small { width: 48px; height: 48px; border-width: 2px; }
.avatar.large { width: 132px; height: 132px; margin-bottom: 12px; }

.activity-panel { margin-top: 20px; }
.count { color: var(--muted); font-weight: 700; }
.contact-list, .activity-list { display: grid; gap: 10px; }
.contact-list {
  flex: 1 1 auto;
  max-height: 640px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}
.contact-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}
.contact-row.active { border-color: var(--blue); background: #f3faff; }
.contact-row > button {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.contact-row strong, .contact-row em { display: block; }
.contact-row em { color: var(--muted); font-style: normal; }
.row-actions { display: flex; gap: 12px; align-items: center; }
.row-actions a, .row-actions button { border: 0; background: transparent; font-weight: 800; cursor: pointer; text-decoration: none; }
.row-actions .edit-icon, .row-actions .action-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--blue-deep);
  background: #eaf4fc;
  font-size: 18px;
}
.row-actions .action-icon { color: #243244; }
.row-actions .danger { color: #c0362c; }
.row-actions .edit-icon:hover, .row-actions .action-icon:hover { background: #d9ecfb; }
.activity {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.activity time { color: var(--muted); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
  color: var(--muted);
  font-weight: 800;
}

.pagination button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--blue-deep);
  background: #eaf4fc;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.pagination button:disabled {
  cursor: not-allowed;
  opacity: .42;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(4, 29, 53, .58);
}

.modal-panel {
  width: min(920px, 100%);
  max-height: min(860px, calc(100vh - 44px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(7, 17, 31, .28);
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: #eaf4fc;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 70% 0%, #d9ecfb, #eef5fb 54%);
}

.login-panel {
  width: min(430px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(7, 17, 31, .14);
}

.login-panel h1 { margin-bottom: 18px; font-size: 30px; }
.login-brand { margin-bottom: 24px; color: var(--ink); }
.login-form, .config-form { display: grid; gap: 14px; }
.login-form label, .config-form label {
  display: grid;
  gap: 7px;
  color: #243244;
  font-size: 13px;
  font-weight: 800;
}
.login-form input, .config-form input {
  min-height: 42px;
  border: 1px solid #cfdbe6;
  border-radius: 8px;
  padding: 0 12px;
}

.config-grid {
  display: grid;
  grid-template-columns: minmax(280px, .9fr) minmax(280px, 1fr);
  gap: 20px;
  margin-top: 26px;
  align-items: start;
}

.logo-preview {
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 18px;
  background: #f8fbfe;
}

.logo-preview img {
  max-width: 260px;
  max-height: 110px;
  object-fit: contain;
}

.phone-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 14px;
  background: #dce7f0;
}
.phone-card {
  width: min(430px, 100%);
  overflow: hidden;
  border-radius: 34px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(7, 17, 31, .25);
}
.profile-hero {
  padding: 36px 22px 32px;
  color: #fff;
  text-align: center;
  background: radial-gradient(circle at 70% 0%, #174d85, var(--navy) 64%);
}
.profile-hero h1 { font-size: 30px; }
.profile-hero .role { margin: 8px 0; color: #1fb2ff; font-size: 18px; }
.action-stack { display: grid; gap: 10px; padding: 18px 14px; }
.action {
  min-height: 58px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 3px 10px rgba(7, 17, 31, .12);
  text-decoration: none;
}
.action span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-weight: 900;
}
.action strong {
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
}
.socials { display: flex; justify-content: center; gap: 24px; padding: 4px 0 18px; }
.socials a {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
  text-decoration: none;
}
.save-contact {
  display: block;
  padding: 0 0 22px;
  color: var(--ink);
  text-align: center;
  text-decoration: none;
  font-size: 18px;
  font-weight: 800;
}

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar nav { grid-template-columns: repeat(3, 1fr); }
  .metric-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .config-grid { grid-template-columns: 1fr; }
  .contact-form, .two { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .workspace { padding: 18px; }
  .topbar, .section-head, .contact-row, .activity { grid-template-columns: 1fr; display: grid; }
  .row-actions { flex-wrap: wrap; }
  h1 { font-size: 30px; }
}
