/*
 * Padoxy Fluent 2 visual layer
 * Original project CSS: no Microsoft logos, product icons, fonts, or runtime.
 */

:root {
  --brand-hover: color-mix(in srgb, var(--brand) 86%, #000);
  --brand-dark: color-mix(in srgb, var(--brand) 62%, #00152b);
  --brand-soft: color-mix(in srgb, var(--brand) 9%, #fff);
  --bg: #f4f6fa;
  --surface: #ffffff;
  --sidebar: #10192c;
  --ink: #172033;
  --muted: #667085;
  --subtle: #98a2b3;
  --line: #e4e9f0;
  --line-strong: #cfd6e1;
  --green: #108c5d;
  --green-soft: #e8f7f0;
  --violet: #7554c9;
  --violet-soft: #f1edfc;
  --red: #c43e4c;
  --red-soft: #fcebee;
  --amber: #b96f0b;
  --amber-soft: #fff4df;
  --hover: #f5f7fb;
  --table-head: #f7f9fc;
  --input-bg: #fff;
  --topbar: #fff;
  --topbar-height: 64px;
  --sidebar-width: 244px;
  --content-max-width: 1480px;
  --fluent-radius-sm: 8px;
  --fluent-radius: 12px;
  --fluent-shadow-2: 0 1px 2px rgba(16, 24, 40, .04);
  --fluent-shadow-8: 0 8px 28px rgba(16, 24, 40, .08);
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

html { background: var(--bg); }
body {
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a, button, input, select, textarea {
  transition: color .16s ease, background-color .16s ease, border-color .16s ease,
    box-shadow .16s ease, transform .16s ease;
}

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 25%, transparent);
  outline-offset: 2px;
}

h1 { font-size: clamp(26px, 2.2vw, 32px); font-weight: 650; letter-spacing: -.035em; }
h2 { font-size: 17px; font-weight: 650; letter-spacing: -.015em; }

/* Application shell */
.topbar {
  grid-template-columns: var(--sidebar-width) minmax(300px, 620px) 1fr;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
  backdrop-filter: blur(18px);
}
.topbar-left {
  gap: 0;
  padding: 0 14px;
  color: #fff;
  background: #10192c;
}
.app-launcher {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  grid-template-columns: repeat(3, 4px);
  grid-auto-rows: 4px;
  gap: 3px;
  margin-right: 7px;
  border-radius: 11px;
  background: var(--brand);
  box-shadow: 0 7px 18px color-mix(in srgb, var(--brand) 24%, transparent);
}
.app-launcher i { width: 4px; height: 4px; }
.brand {
  min-width: 0;
  flex: 1;
  gap: 10px;
  padding: 0 6px;
  color: #fff;
}
.brand:hover { background: transparent; }
.brand-mark {
  width: 30px;
  height: 30px;
  color: #fff;
  background: color-mix(in srgb, var(--brand) 78%, #fff);
  border-radius: 9px;
  box-shadow: 0 5px 15px rgba(0,0,0,.15);
}
.brand-copy { min-width: 0; display: grid; line-height: 1.15; }
.brand-copy strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.brand-copy small {
  margin-top: 3px;
  color: #7f8ca4;
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.global-search {
  height: 40px;
  margin-inline: 18px;
  color: var(--muted);
  background: var(--hover);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.global-search:focus-within {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 9%, transparent);
}
.global-search svg { left: 13px; color: var(--muted); }
.global-search input { padding-left: 39px; }
.global-search input::placeholder { color: var(--subtle); }
.topbar-actions { padding-right: 18px; gap: 7px; }
.topbar-link {
  height: 40px;
  padding: 0 14px;
  color: #fff;
  background: var(--brand);
  border-radius: 10px;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 18%, transparent);
}
.topbar-link:hover {
  color: #fff;
  background: var(--brand-hover);
  text-decoration: none;
  transform: translateY(-1px);
}
.admin-name { color: var(--muted); opacity: 1; }
.avatar {
  width: 34px;
  height: 34px;
  margin: 0 2px;
  color: #fff;
  background: linear-gradient(145deg, var(--brand), var(--violet));
  border: 0;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--brand) 20%, transparent);
}
.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface);
}
.icon-button:hover { color: var(--ink); background: var(--hover); }
.topbar-actions form { height: 40px; }

.sidebar {
  color: #c7d0e0;
  background: #10192c;
  border-right: 1px solid #202b42;
  scrollbar-color: #35415a transparent;
}
.sidebar nav { padding: 16px 12px; }
.nav-section {
  margin: 22px 13px 8px;
  color: #69778f;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
}
.sidebar nav > a {
  min-height: 44px;
  gap: 12px;
  margin: 3px 0;
  padding: 9px 13px;
  color: #c7d0e0;
  border: 0;
  border-radius: 10px;
}
.sidebar nav > a:hover {
  color: #fff;
  background: rgba(255,255,255,.055);
  transform: translateX(2px);
}
.sidebar nav > a.active {
  color: #fff;
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 30%, transparent), color-mix(in srgb, var(--brand) 12%, transparent));
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--brand) 70%, #fff);
}
.sidebar nav > a svg { width: 19px; height: 19px; }
.sidebar nav > a .external { color: #7d8ba3; }
.sidebar-foot {
  margin: 10px 12px 14px;
  padding: 13px;
  color: #e8edf6;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 11px;
}
.sidebar-foot:hover { background: rgba(255,255,255,.06); }
.sidebar-foot small { color: #7f8ca4; }
.status-dot {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 18%, transparent);
  animation: fluent-pulse 2.4s infinite;
}
.workspace {
  background:
    radial-gradient(circle at 85% -20%, color-mix(in srgb, var(--brand) 6%, transparent), transparent 34%),
    var(--bg);
}
main { padding: 32px 36px 64px; }

/* Page structure */
.page-head {
  align-items: flex-end;
  margin-bottom: 24px;
  animation: fluent-enter .42s both;
}
.page-head .muted { margin: 6px 0 0; }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.breadcrumb span {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--green-soft);
}
.page-primary-action { min-height: 40px; padding-inline: 17px; }
.system-health {
  min-height: 66px;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(300px, 1.3fr) auto;
  align-items: center;
  gap: 13px;
  padding: 11px 16px;
  margin-bottom: 18px;
  background: linear-gradient(90deg, var(--green-soft), var(--surface) 48%);
  border: 1px solid color-mix(in srgb, var(--green) 22%, var(--line));
  border-radius: var(--fluent-radius);
  animation: fluent-enter .42s .04s both;
}
.system-health-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--green) 22%, transparent);
}
.system-health > div:nth-child(2) { display: grid; gap: 1px; }
.system-health strong { font-size: 12px; }
.system-health small { font-size: 10px; }
.system-services { display: flex; align-items: center; justify-content: center; gap: 7px; }
.system-services span {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 10px;
}
.system-services i { width: 6px; height: 6px; background: var(--green); border-radius: 50%; }
.system-health > a { color: var(--green); font-size: 11px; font-weight: 650; white-space: nowrap; }
.system-health > a span { display: inline-block; margin-left: 5px; transition: transform .16s ease; }
.system-health > a:hover { text-decoration: none; }
.system-health > a:hover span { transform: translateX(3px); }

/* Cards, metrics, and panels */
.stats { gap: 16px; margin-bottom: 18px; }
.stats article {
  position: relative;
  min-height: 145px;
  padding: 19px;
  border-radius: var(--fluent-radius);
  box-shadow: var(--fluent-shadow-2);
  overflow: hidden;
  animation: fluent-enter .42s both;
}
.stats article:nth-child(1) { animation-delay: .07s; }
.stats article:nth-child(2) { animation-delay: .1s; }
.stats article:nth-child(3) { animation-delay: .13s; }
.stats article:nth-child(4) { animation-delay: .16s; }
.stats article:hover {
  border-color: color-mix(in srgb, var(--brand) 22%, var(--line));
  box-shadow: var(--fluent-shadow-8);
  transform: translateY(-2px);
}
.stat-icon { width: 38px; height: 38px; border-radius: 10px; }
.stat-icon svg { width: 19px; height: 19px; }
.stats article > div:last-child { flex: 1; }
.stats span { font-size: 12px; }
.stats strong { margin: 2px 0 0; font-size: 30px; letter-spacing: -.035em; }
.stats small { font-size: 10px; }
.stats a {
  position: absolute;
  right: 16px;
  bottom: 14px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--subtle);
  background: var(--hover);
  border-radius: 8px;
}
.stats a:hover { color: var(--brand); text-decoration: none; transform: translateX(2px); }
.panel {
  border-radius: var(--fluent-radius);
  box-shadow: var(--fluent-shadow-2);
  animation: fluent-enter .42s .18s both;
}
.panel-head { min-height: 68px; padding: 15px 19px; }
.dashboard-grid { grid-template-columns: minmax(390px, .9fr) minmax(460px, 1.1fr); gap: 18px; }
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
}
.quick-actions > a {
  min-height: 74px;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 11px;
  padding: 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.quick-actions > a:last-child { border-bottom: 1px solid var(--line); }
.quick-actions > a:hover {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--brand) 24%, var(--line));
  box-shadow: 0 6px 18px rgba(16,24,40,.06);
  transform: translateY(-1px);
}
.quick-actions > a b { color: var(--subtle); font-size: 12px; transition: transform .16s ease; }
.quick-actions > a:hover b { color: var(--brand); transform: translateX(2px); }
.quick-icon { width: 38px; height: 38px; border-radius: 10px; font-size: 18px; }
.quick-actions strong { font-size: 12px; }
.quick-actions small { font-size: 10px; }
.activity-list article {
  min-height: 61px;
  grid-template-columns: 30px 1fr auto;
  padding: 10px 19px;
  border-color: var(--line);
}
.activity-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  border-radius: 8px;
}
.activity-icon::after {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--brand);
  border-radius: 50%;
}

/* Shared controls and data views */
.button, button {
  min-height: 36px;
  padding: 7px 14px;
  border-radius: var(--fluent-radius-sm);
}
.button.primary, button.primary {
  box-shadow: 0 5px 14px color-mix(in srgb, var(--brand) 16%, transparent);
}
.button.primary:hover, button.primary:hover { transform: translateY(-1px); }
.button.secondary {
  border-color: var(--line-strong);
  box-shadow: 0 1px 2px rgba(16,24,40,.03);
}
.button.quiet:hover { background: var(--hover); }
.command-bar { min-height: 58px; padding: 10px 13px; }
input, select, textarea {
  min-height: 40px;
  border-radius: var(--fluent-radius-sm);
}
input:focus, select:focus, textarea:focus {
  border-color: color-mix(in srgb, var(--brand) 52%, var(--line-strong));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 9%, transparent);
}
.input-suffix, .address-builder { border-radius: var(--fluent-radius-sm); overflow: hidden; }
.table-wrap { scrollbar-color: var(--line-strong) transparent; }
th, td { padding: 12px 16px; }
th { font-size: 11px; letter-spacing: .025em; }
tbody tr:hover { background: color-mix(in srgb, var(--brand) 3.5%, var(--surface)); }
.resource-avatar, .resource-avatar.shared { border-radius: 9px; }
.badge { padding: 4px 8px; border-radius: 20px; }
.flash { border-radius: 10px; animation: fluent-enter .32s both; }
.form-card, .form-section, .mailbox-summary, .shared-explainer article,
.service-overview article, .settings-nav, .settings-section {
  border-radius: var(--fluent-radius);
  box-shadow: var(--fluent-shadow-2);
}
.settings-nav { padding: 9px; }
.settings-nav a { border: 0; border-radius: 8px; }
.settings-nav a.active {
  color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 3px 0 0 var(--brand);
}
.toggle-list, .service-card, .dns-results article { border-radius: 10px; overflow: hidden; }
.service-card {
  border-radius: var(--fluent-radius);
  box-shadow: var(--fluent-shadow-2);
}
.service-card:hover { transform: translateY(-2px); box-shadow: var(--fluent-shadow-8); }
.service-logo-frame { border-radius: 12px; }
.period-switch { border-radius: 9px; }
.period-switch a { border-radius: 6px; }
.metric-grid article { border-radius: var(--fluent-radius); box-shadow: var(--fluent-shadow-2); }
.flow-chart-panel, .mail-queue { border-radius: var(--fluent-radius); }

/* Dark mode remains a first-class theme. */
[data-theme="dark"] {
  --brand-soft: color-mix(in srgb, var(--brand) 16%, #111722);
  --bg: #090d15;
  --surface: #111722;
  --sidebar: #0b101a;
  --ink: #edf2f9;
  --muted: #a2aec0;
  --subtle: #6f7c90;
  --line: #222c3c;
  --line-strong: #3b485d;
  --green-soft: #0d2c22;
  --violet-soft: #241e39;
  --red-soft: #3a191e;
  --amber-soft: #332615;
  --hover: #171e2b;
  --table-head: #151c28;
  --input-bg: #101621;
  --topbar: #0b1018;
}
[data-theme="dark"] .topbar { background: rgba(9,13,21,.9); }
[data-theme="dark"] .workspace {
  background:
    radial-gradient(circle at 85% -20%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 35%),
    var(--bg);
}
[data-theme="dark"] .system-health {
  background: linear-gradient(90deg, rgba(13,44,34,.92), rgba(17,23,34,.9) 55%);
}
[data-theme="dark"] .sidebar nav > a.active {
  color: #fff;
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 25%, transparent), color-mix(in srgb, var(--brand) 9%, transparent));
}
[data-theme="dark"] .quick-actions > a:hover { background: var(--hover); }

@keyframes fluent-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes fluent-pulse {
  0%, 100% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 18%, transparent); }
  50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--green) 0%, transparent); }
}

@media (max-width: 1100px) {
  .system-services span:nth-last-child(-n+2) { display: none; }
  .system-health { grid-template-columns: auto 1fr auto auto; }
  .quick-actions { grid-template-columns: 1fr; }
}

@media (max-width: 1000px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  :root { --sidebar-width: 64px; }
  .topbar { grid-template-columns: var(--sidebar-width) minmax(190px, 1fr) auto; }
  .topbar-left { padding: 0 10px; }
  .app-launcher { width: 40px; margin: 0; }
  .topbar-left .brand { display: none; }
  .global-search { margin-inline: 10px; }
  .sidebar nav { padding-inline: 7px; }
  .sidebar nav > a { border-radius: 10px; }
  .sidebar nav > a.active { box-shadow: inset 2px 0 0 color-mix(in srgb, var(--brand) 70%, #fff); }
  .sidebar-foot { margin-inline: 8px; }
  main { padding: 24px 18px 52px; }
  .system-health { grid-template-columns: auto 1fr; }
  .system-services, .system-health > a { display: none; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .topbar { grid-template-columns: var(--sidebar-width) minmax(120px, 1fr) auto; }
  .topbar-actions .theme-toggle, .topbar-actions .avatar { display: none; }
  .page-head { align-items: flex-start; }
  .page-primary-action { width: 42px; padding: 0; font-size: 0; }
  .page-primary-action span { font-size: 18px; }
  .stats { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
