/* =========================================================
   Vaal Websites — Customer Dashboard
   Google Cloud Console-inspired theme.
   This is the ONLY stylesheet for /dashboard/*. It styles both
   the persistent shell (index.html) and every fragment loaded
   into #dashApp (pages/*.html).
   ========================================================= */

:root {
  /* Brand */
  --blue:        #9333ea;
  --blue-dark:   #7c22ce;
  --blue-bg:     #e8f0fe;

  /* Status */
  --green:       #188038;
  --green-bg:    #e6f4ea;
  --yellow:      #b06000;
  --yellow-bg:   #fef7e0;
  --red:         #d93025;
  --red-bg:      #fce8e6;
  --grey:        #5f6368;
  --grey-bg:     #f1f3f4;

  /* Neutrals */
  --text:        #202124;
  --muted:       #5f6368;
  --border:      #dadce0;
  --border-light:#e8eaed;
  --surface:     #ffffff;
  --bg:          #f8f9fa;

  --radius-sm:   4px;
  --radius-md:   8px;
  --shadow-sm:   0 1px 2px rgba(60,64,67,.30), 0 1px 3px 1px rgba(60,64,67,.15);
  --shadow-md:   0 1px 3px rgba(60,64,67,.30), 0 4px 8px 3px rgba(60,64,67,.15);
  --font:        "Google Sans Text", Roboto, -apple-system, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: inherit; }

/* ---------------------------------------------------------
   Shell layout
   --------------------------------------------------------- */
.main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.dashTop {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 20;
}

.logo {
  flex: 0 0 auto;
  font-weight: 500;
  font-size: 20px;
  color: var(--muted);
  white-space: nowrap;
}
.logo span { color: var(--blue); font-weight: 700; }

.search-box {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
  background: var(--grey-bg);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 6px 0 14px;
  transition: background .15s ease, box-shadow .15s ease;
}
.search-box:focus-within {
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.search-box input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 14px;
  padding: 9px 0;
  background: transparent;
  font-family: var(--font);
}
.search-box button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  border-radius: 50%;
  background: transparent;
}
.search-box button img { width: 18px; opacity: .65; }

.dash-user-menu {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.dash-user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.3;
}
.dash-user-meta span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-user-meta small {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.dash-avatar {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}
.dash-signout {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.dash-signout:hover { background: var(--grey-bg); border-color: #c4c7cc; }

.dashContent {
  display: flex;
  flex: 1;
  align-items: flex-start;
}

/* ---------------------------------------------------------
   Sidebar
   --------------------------------------------------------- */
.dash-sidebar {
  width: 256px;
  flex: 0 0 256px;
  background: var(--surface);
  border-right: 1px solid var(--border-light);
  padding: 12px 8px 20px;
  min-height: calc(100vh - 64px);
  position: sticky;
  top: 64px;
}

.dashNav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }

.dashNav a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  border-radius: 0 20px 20px 0;
  transition: background .15s ease, color .15s ease;
}
.dashNav a:hover { background: var(--grey-bg); }
.dashNav a.active { background: var(--blue-bg); color: var(--blue-dark); font-weight: 700; }

.dashNav .nav-icon,
.dash-secondary .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dashNav .nav-icon img,
.dash-secondary .nav-icon img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  opacity: .75;
}
.dashNav a:hover .nav-icon img,
.dashNav a.active .nav-icon img { opacity: 1; }

.dash-nav-divider { height: 1px; background: var(--border-light); margin: 16px 12px; }

.dash-secondary ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.dash-secondary a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  border-radius: 0 20px 20px 0;
  transition: background .15s ease, color .15s ease;
}
.dash-secondary a:hover { background: var(--grey-bg); color: var(--text); }

.dash-sidebar-footer {
  margin: 20px 12px 0;
  padding: 14px;
  background: var(--grey-bg);
  border-radius: var(--radius-md);
  color: var(--muted);
}
.dash-sidebar-footer strong { display: block; margin-bottom: 4px; font-size: 13px; color: var(--text); }
.dash-sidebar-footer p { margin: 0 0 8px; font-size: 12px; line-height: 1.5; }
.dash-sidebar-footer p:last-child { margin-bottom: 0; }
.dash-sidebar-footer a { color: var(--blue); text-decoration: none; font-weight: 600; }
.dash-sidebar-footer a:hover { text-decoration: underline; }

/* ---------------------------------------------------------
   Content area
   --------------------------------------------------------- */
.dashApp {
  flex: 1;
  min-width: 0;
  padding: 28px 32px 60px;
}

.dash-page-header { margin-bottom: 24px; }
.dash-overline {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--blue);
}
.dash-page-header h1 {
  margin: 4px 0 6px;
  font-size: 28px;
  font-weight: 400;
  color: var(--text);
}
.dash-page-desc { margin: 0; color: var(--muted); font-size: 14px; max-width: 640px; }

/* Grids */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.dash-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .dash-grid-3 { grid-template-columns: 1fr; } }
.dash-card-wide { grid-column: 1 / -1; }

.dash-support-col { display: flex; flex-direction: column; gap: 16px; }
.dash-support-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) { .dash-support-grid { grid-template-columns: 1fr; } }

/* Cards */
.dash-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
}
.dash-panel { transition: box-shadow .15s ease; }
.dash-panel:hover { box-shadow: var(--shadow-sm); }

.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.dash-card-header h3 { margin: 0; font-size: 15px; font-weight: 500; color: var(--text); }
.dash-card-header-link { font-size: 13px; color: var(--blue); text-decoration: none; font-weight: 500; white-space: nowrap; }
.dash-card-header-link:hover { text-decoration: underline; }
.dash-panel-note { margin: 0 0 16px; color: var(--muted); font-size: 13px; }

/* Stat cards */
.dash-stat-card { display: flex; flex-direction: column; gap: 6px; }
.stat-top { display: flex; }
.dash-stat-icon { width: 30px; object-fit: contain; }
.dash-stat-value { font-size: 28px; font-weight: 500; color: var(--text); }
.dash-stat-label { font-size: 13px; color: var(--muted); }

/* Quicklinks */
.dash-quicklinks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.dash-quicklink {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: var(--text);
}
.dash-quicklink .ql-icon { font-size: 22px; margin-bottom: 6px; }
.dash-quicklink strong { font-size: 14px; font-weight: 500; }
.dash-quicklink span { font-size: 12px; color: var(--muted); }
.dash-quicklink:hover { border-color: var(--blue); }

/* Metric grid (key/value pairs) */
.dash-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.metric-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.dash-metric-grid strong { font-size: 14px; font-weight: 500; color: var(--text); }

/* Buttons */
.dash-btn,
.dash-primary-btn,
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--blue);
  transition: background .15s ease, box-shadow .15s ease;
}
.dash-btn:hover { background: var(--blue-bg); }

.dash-primary-btn,
.btn-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.dash-primary-btn:hover,
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.dash-primary-btn:disabled { opacity: .6; cursor: default; }

.dash-btn-danger { color: var(--red); border-color: var(--red); }
.dash-btn-danger:hover { background: var(--red-bg); }

.dash-save-msg { margin-left: 10px; font-size: 13px; color: var(--green); opacity: 0; transition: opacity .2s ease; }
.dash-save-msg.visible { opacity: 1; }

/* Loading / empty states */
.dash-loading,
.dash-empty-state,
.dash-empty {
  padding: 18px 4px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* Activity feed */
.dash-activity { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.dash-activity li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
}
.dash-activity li:last-child { border-bottom: none; }
.dash-activity .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--blue);
  margin-top: 5px;
  flex-shrink: 0;
}
.dash-activity time { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Website snapshot rows (overview) */
.dash-snapshot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.dash-snapshot-row:last-child { border-bottom: none; }
.dash-snapshot-row strong { display: block; font-size: 13px; }
.dash-snapshot-row small { color: var(--muted); }

/* Tables */
.dash-table-wrap { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.dash-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.dash-table tbody tr:hover { background: var(--bg); }
.dash-table tbody tr:last-child td { border-bottom: none; }
.dash-muted-text { color: var(--muted); }

/* Toolbar / search inside a card */
.dash-toolbar { margin-bottom: 14px; }
.dash-search {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.dash-search svg { color: var(--muted); flex-shrink: 0; }
.dash-search input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  font-family: var(--font);
  width: 100%;
}

/* Badges / chips */
.health-badge, .ssl-badge, .status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.health-good, .ssl-valid, .status-paid, .status-closed { background: var(--green-bg); color: var(--green); }
.health-warning, .ssl-pending, .status-pending, .status-open { background: var(--yellow-bg); color: var(--yellow); }
.health-offline, .status-overdue, .status-unpaid { background: var(--red-bg); color: var(--red); }

/* Action grid (support page) */
.dash-action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.dash-action-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s ease, background .15s ease;
}
.dash-action-btn:hover { border-color: var(--blue); background: var(--blue-bg); }
.dash-action-btn .action-icon { font-size: 20px; }
.dash-action-btn small { color: var(--muted); font-size: 12px; }

/* Tickets */
.dash-ticket-list { display: flex; flex-direction: column; gap: 4px; }
.dash-ticket {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.dash-ticket:last-child { border-bottom: none; }
.dash-ticket-info strong { display: block; font-size: 13px; }
.dash-ticket-info small { color: var(--muted); }

/* FAQ accordion */
.dash-faq-item { border-bottom: 1px solid var(--border-light); }
.dash-faq-item:last-child { border-bottom: none; }
.dash-faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: none;
  border: none;
  text-align: left;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  padding: 14px 0;
  cursor: pointer;
}
.dash-faq-q .chev { color: var(--muted); transition: transform .2s ease; }
.dash-faq-item.open .dash-faq-q .chev { transform: rotate(180deg); }
.dash-faq-a {
  display: none;
  padding: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}
.dash-faq-item.open .dash-faq-a { display: block; }

/* Forms */
.dash-form { display: flex; flex-direction: column; gap: 16px; }
.dash-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.dash-field { display: flex; flex-direction: column; gap: 6px; }
.dash-field label { font-size: 12px; font-weight: 500; color: var(--muted); }
.dash-field input {
  font-family: var(--font);
  font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}
.dash-field input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.dash-field input:disabled { background: var(--bg); color: var(--muted); }
.dash-field .hint { font-size: 11px; color: var(--muted); }
.dash-form-actions { display: flex; align-items: center; }

/* Toggle switch */
.dash-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}
.dash-toggle-row:last-child { border-bottom: none; }
.dash-toggle-row strong { display: block; font-size: 13px; }
.dash-toggle-row span { font-size: 12px; color: var(--muted); }

.toggle-switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: background .2s ease;
}
.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px; height: 16px;
  left: 2px; top: 2px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s ease;
}
.toggle-switch input:checked + .toggle-slider { background: var(--blue); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }

/* Danger zone */
.dash-danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  background: var(--red-bg);
  border-radius: var(--radius-md);
}
.dash-danger-zone strong { display: block; color: var(--red); font-size: 13px; }
.dash-danger-zone p { margin: 4px 0 0; font-size: 12px; color: var(--muted); max-width: 420px; }

/* Error page (router 404 / fetch failure) */
.error-page { text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 22px; font-weight: 500; margin-bottom: 8px; }
.error-page p { color: var(--muted); margin-bottom: 20px; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  background: #323232;
  color: #fff;
  font-size: 13px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 100;
}
.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-error { background: var(--red); }

/* Responsive */
@media (max-width: 900px) {
  .dash-sidebar { display: none; }
  .dashApp { padding: 20px; }
  .dash-user-meta { display: none; }
  .search-box { max-width: 200px; }
}
