/* ============================================================
   SyncAdmin — Material UI inspired theme
   Roboto type · Material elevation · ripples · MUI palette
   ============================================================ */
:root {
  /* MUI default palette */
  --primary: #1976d2;
  --primary-dark: #1565c0;
  --primary-light: #42a5f5;
  --primary-12: rgba(25, 118, 210, .12);
  --primary-08: rgba(25, 118, 210, .08);
  --primary-04: rgba(25, 118, 210, .04);

  --success: #2e7d32;
  --success-bg: #e8f5e9;
  --danger: #d32f2f;
  --danger-bg: #fdecea;
  --warn: #ed6c02;
  --warn-bg: #fff4e5;

  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: rgba(0, 0, 0, .87);
  --text-2: rgba(0, 0, 0, .60);
  --text-3: rgba(0, 0, 0, .38);
  --line: rgba(0, 0, 0, .12);
  --muted: rgba(0, 0, 0, .60);

  --radius: 8px;
  --sidebar-w: 256px;

  /* Material elevation shadows */
  --e1: 0 2px 1px -1px rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 1px 3px 0 rgba(0,0,0,.12);
  --e2: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
  --e4: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12);
  --e8: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);

  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: .01071em;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 22px; line-height: 1; user-select: none;
}

/* ---------- Ripple ---------- */
.ripple-host { position: relative; overflow: hidden; }
.ripple {
  position: absolute; border-radius: 50%; transform: scale(0);
  background: currentColor; opacity: .28; pointer-events: none;
  animation: ripple .55s ease-out;
}
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

/* ---------- Buttons (MUI) ---------- */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 4px; cursor: pointer;
  padding: 8px 22px; font-family: inherit; font-size: 14px; font-weight: 500;
  letter-spacing: .02857em; text-transform: uppercase;
  transition: background-color .2s, box-shadow .2s;
}
.btn-sm { padding: 5px 14px; font-size: 13px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--e2); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--e4); }
.btn-ghost { background: transparent; color: var(--primary); box-shadow: none; border: 1px solid rgba(25,118,210,.5); }
.btn-ghost:hover { background: var(--primary-08); border-color: var(--primary); }
.btn-block { width: 100%; }

.icon-btn {
  position: relative; overflow: hidden;
  border: none; background: transparent; cursor: pointer; color: inherit;
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color .2s;
}
.icon-btn:hover { background: rgba(0, 0, 0, .06); }

/* ---------- Text fields (MUI outlined) ---------- */
.field { display: flex; flex-direction: column; gap: 0; margin-bottom: 18px; }
.field label {
  font-size: 12px; font-weight: 400; color: var(--text-2);
  margin-bottom: 6px; letter-spacing: .00938em;
}
.field input, .field select {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.field input:hover, .field select:hover { border-color: rgba(0,0,0,.55); }
.field input:focus, .field select:focus {
  outline: none; border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary);
}
.form-error { color: var(--danger); font-size: 12.5px; margin: 2px 0 12px; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-body {
  min-height: 100vh; display: grid; place-items: center;
  background: linear-gradient(135deg, #1976d2 0%, #0d47a1 100%);
  padding: 20px;
}
.login-wrap { width: 100%; max-width: 420px; }
.login-card {
  background: var(--surface); border-radius: var(--radius); padding: 32px;
  box-shadow: var(--e8);
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.login-brand h1 { font-size: 20px; font-weight: 500; }
.login-brand p { font-size: 13px; color: var(--muted); }
.brand-mark {
  width: 44px; height: 44px; flex: none; border-radius: 8px;
  background: var(--primary); color: #fff; font-weight: 500; font-size: 22px;
  display: grid; place-items: center; box-shadow: var(--e2);
}
.login-title { font-size: 18px; font-weight: 500; margin-bottom: 22px; }
.password-wrap { position: relative; display: flex; }
.password-wrap input { flex: 1; padding-right: 64px; }
.toggle-pass {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; color: var(--primary);
  font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  cursor: pointer; padding: 6px 8px; border-radius: 4px;
}
.toggle-pass:hover { background: var(--primary-08); }
.login-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; color: var(--text-2); }
.checkbox input { accent-color: var(--primary); width: 18px; height: 18px; }
.muted-link { color: var(--primary); font-size: 14px; font-weight: 500; }
.muted-link:hover { text-decoration: underline; }
.login-hint { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 20px; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }

/* Drawer */
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; height: 64px; border-bottom: 1px solid var(--line);
}
.brand-name { color: var(--text); font-weight: 500; font-size: 18px; }
.side-nav { padding: 12px 8px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; border-radius: 8px; color: var(--text-2);
  font-weight: 500; font-size: 14px; transition: background-color .2s, color .2s;
}
.nav-item:hover { background: rgba(0, 0, 0, .04); }
.nav-item.active { background: var(--primary-12); color: var(--primary); }
.nav-item.active .material-symbols-outlined { color: var(--primary); }
.nav-item .material-symbols-outlined { color: var(--text-3); font-size: 22px; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--line); }

.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .5);
  z-index: 40; display: none;
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* AppBar */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 64px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: var(--primary); color: #fff;
  box-shadow: var(--e4);
}
.topbar .icon-btn { color: #fff; }
.topbar .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.page-title { font-size: 20px; font-weight: 500; letter-spacing: .0075em; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 12px 4px 4px; border-radius: 999px; font-size: 14px; font-weight: 500;
  transition: background-color .2s; cursor: pointer;
}
.user-chip:hover { background: rgba(255, 255, 255, .12); }
.menu-btn { display: none; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  background: #e0e0e0; flex: none;
}
.avatar-md { width: 64px; height: 64px; }
.avatar-lg { width: 96px; height: 96px; box-shadow: var(--e2); }

.content { padding: 24px; flex: 1; }

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--surface); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--e1);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.panel-head h2 { font-size: 16px; font-weight: 500; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 20px; }
.stat-card {
  background: var(--surface); border-radius: var(--radius); padding: 20px;
  display: flex; align-items: center; gap: 16px; box-shadow: var(--e1);
  transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: var(--e4); }
.stat-ico {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
}
.stat-ico .material-symbols-outlined { font-size: 26px; }
.ico-total { background: var(--primary-12); color: var(--primary); }
.ico-success { background: var(--success-bg); color: var(--success); }
.ico-failed { background: var(--danger-bg); color: var(--danger); }
.ico-pending { background: var(--warn-bg); color: var(--warn); }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 500; letter-spacing: 0; }

.last-sync-bar {
  background: var(--surface); border-radius: var(--radius); padding: 14px 20px;
  margin-bottom: 20px; font-size: 14px; color: var(--muted); box-shadow: var(--e1);
  border-left: 4px solid var(--primary);
}
.last-sync-bar strong { color: var(--text); font-weight: 500; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }
.dot-live { background: var(--success); box-shadow: 0 0 0 3px var(--success-bg); }

/* ---------- Charts ---------- */
.chart-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 20px; }
.donut-wrap { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; justify-content: center; }
.donut-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.donut-legend li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.donut-legend .swatch { width: 14px; height: 14px; border-radius: 3px; }
.donut-legend b { margin-left: auto; font-weight: 500; }
.bar-chart { width: 100%; height: auto; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 20px; }
.filters .field { margin-bottom: 0; }
.field-grow { flex: 1 1 220px; }
.field-btn { justify-content: flex-end; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border-radius: 4px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.data-table th, .data-table td { padding: 14px 16px; text-align: left; }
.data-table thead th {
  color: var(--text-2); font-size: 13px; font-weight: 500;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table tbody tr { border-bottom: 1px solid var(--line); transition: background-color .15s; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--primary-04); }
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--text); }
.sort-ind::after { content: "unfold_more"; font-family: "Material Symbols Outlined"; font-size: 18px; vertical-align: -4px; opacity: .4; margin-left: 2px; }
.sortable.asc .sort-ind::after { content: "arrow_upward"; opacity: 1; color: var(--primary); }
.sortable.desc .sort-ind::after { content: "arrow_downward"; opacity: 1; color: var(--primary); }
.err-text { color: var(--danger); }
.no-err { color: var(--text-3); }

/* Chips */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  height: 24px;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-failed { background: var(--danger-bg); color: var(--danger); }
.badge-pending { background: var(--warn-bg); color: var(--warn); }

.table-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; flex-wrap: wrap; gap: 12px; }
.pager { display: flex; gap: 4px; }
.pager button {
  position: relative; overflow: hidden;
  min-width: 34px; height: 34px; border: none; background: transparent;
  border-radius: 50%; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text-2);
  transition: background-color .2s;
}
.pager button:hover:not(:disabled) { background: rgba(0, 0, 0, .06); }
.pager button.active { background: var(--primary); color: #fff; }
.pager button:disabled { opacity: .35; cursor: default; }

/* ---------- Profile ---------- */
.profile-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
.profile-card { text-align: center; }
.profile-card .avatar-lg { margin: 0 auto 16px; }
.profile-card h2 { font-size: 18px; font-weight: 500; }
.role-badge {
  display: inline-block; margin-top: 12px; padding: 4px 12px;
  background: var(--primary-12); color: var(--primary); border-radius: 999px;
  font-size: 12.5px; font-weight: 500;
}
.account-details { margin: 22px 0 0; text-align: left; border-top: 1px solid var(--line); padding-top: 18px; }
.account-details > div { display: flex; justify-content: space-between; padding: 8px 0; }
.account-details dt { color: var(--muted); font-size: 13.5px; }
.account-details dd { margin: 0; font-weight: 500; font-size: 13.5px; }
.profile-forms { display: flex; flex-direction: column; gap: 20px; }
.avatar-row { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
.save-note { color: var(--success); font-weight: 500; margin-left: 12px; font-size: 14px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1000px) {
  .chart-grid { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 780px) {
  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 50; height: 100vh; box-shadow: var(--e8);
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .app-shell.nav-open .sidebar { transform: translateX(0); }
  .app-shell.nav-open .sidebar-backdrop { display: block; }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 0 12px; }
  #topName { display: none; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .login-card { padding: 24px; }
}



.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.alert {
    position: relative;
    padding: 1rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: 0.375rem;
}