/*
 * Estilo Fluent Design (Windows 11 / WinUI 3).
 * Colores, tipografía y medidas basados en los recursos de tema de WinUI 3.
 */

:root {
  color-scheme: light;

  /* Fondo tipo Mica y superficies */
  --mica: #f3f3f3;
  --mica-tint-1: rgb(0 95 184 / 0.07);
  --mica-tint-2: rgb(140 80 200 / 0.05);
  --card: rgb(255 255 255 / 0.7);
  --card-hover: rgb(249 249 249 / 0.8);
  --card-stroke: rgb(0 0 0 / 0.0578);
  --divider: rgb(0 0 0 / 0.0803);
  --layer: #ffffff;
  --layer-alt: #f3f3f3;
  --flyout: rgb(252 252 252 / 0.85);
  --smoke: rgb(0 0 0 / 0.3);

  /* Texto */
  --text: rgb(0 0 0 / 0.896);
  --text-secondary: rgb(0 0 0 / 0.606);
  --text-tertiary: rgb(0 0 0 / 0.446);
  --text-disabled: rgb(0 0 0 / 0.361);

  /* Controles */
  --control: rgb(255 255 255 / 0.7);
  --control-hover: rgb(249 249 249 / 0.5);
  --control-pressed: rgb(249 249 249 / 0.3);
  --control-disabled: rgb(249 249 249 / 0.3);
  --control-stroke: rgb(0 0 0 / 0.0578);
  --control-stroke-bottom: rgb(0 0 0 / 0.1622);
  --textbox-bottom: rgb(0 0 0 / 0.4458);
  --textbox-focus: #ffffff;
  --subtle-hover: rgb(0 0 0 / 0.0373);
  --subtle-pressed: rgb(0 0 0 / 0.0241);
  --toggle-stroke: rgb(0 0 0 / 0.6063);
  --toggle-fill: rgb(0 0 0 / 0.0241);
  --focus-outer: rgb(0 0 0 / 0.896);

  /* Color de énfasis */
  --accent: #005fb8;
  --accent-hover: rgb(0 95 184 / 0.9);
  --accent-pressed: rgb(0 95 184 / 0.8);
  --on-accent: #ffffff;
  --link: #005fb8;

  /* Estados */
  --critical: #c42b1c;
  --critical-bg: #fde7e9;
  --urgent: #c43e1c;
  --caution: #9d5d00;
  --caution-bg: #fff4ce;
  --success: #0f7b0f;
  --success-bg: #dff6dd;

  --shadow-flyout: 0 8px 16px rgb(0 0 0 / 0.14);
  --shadow-dialog: 0 32px 64px rgb(0 0 0 / 0.19), 0 2px 21px rgb(0 0 0 / 0.15);

  --radius-control: 4px;
  --radius-overlay: 8px;
  --font: "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --mica: #202020;
    --mica-tint-1: rgb(96 205 255 / 0.05);
    --mica-tint-2: rgb(170 110 230 / 0.04);
    --card: rgb(255 255 255 / 0.0512);
    --card-hover: rgb(255 255 255 / 0.0698);
    --card-stroke: rgb(0 0 0 / 0.2);
    --divider: rgb(255 255 255 / 0.0837);
    --layer: #2b2b2b;
    --layer-alt: #202020;
    --flyout: rgb(44 44 44 / 0.96);
    --smoke: rgb(0 0 0 / 0.3);

    --text: #ffffff;
    --text-secondary: rgb(255 255 255 / 0.786);
    --text-tertiary: rgb(255 255 255 / 0.544);
    --text-disabled: rgb(255 255 255 / 0.363);

    --control: rgb(255 255 255 / 0.0605);
    --control-hover: rgb(255 255 255 / 0.0837);
    --control-pressed: rgb(255 255 255 / 0.0326);
    --control-disabled: rgb(255 255 255 / 0.0419);
    --control-stroke: rgb(255 255 255 / 0.0698);
    --control-stroke-bottom: rgb(255 255 255 / 0.0465);
    --textbox-bottom: rgb(255 255 255 / 0.5442);
    --textbox-focus: #1f1f1f;
    --subtle-hover: rgb(255 255 255 / 0.0605);
    --subtle-pressed: rgb(255 255 255 / 0.0419);
    --toggle-stroke: rgb(255 255 255 / 0.6047);
    --toggle-fill: rgb(0 0 0 / 0.1);
    --focus-outer: #ffffff;

    --accent: #60cdff;
    --accent-hover: rgb(96 205 255 / 0.9);
    --accent-pressed: rgb(96 205 255 / 0.8);
    --on-accent: #000000;
    --link: #99ebff;

    --critical: #ff99a4;
    --critical-bg: #442726;
    --urgent: #ffb38a;
    --caution: #fce100;
    --caution-bg: #433519;
    --success: #6ccb5f;
    --success-bg: #393d1b;

    --shadow-flyout: 0 8px 16px rgb(0 0 0 / 0.26);
    --shadow-dialog: 0 32px 64px rgb(0 0 0 / 0.37), 0 2px 21px rgb(0 0 0 / 0.37);
  }
}

[v-cloak] { display: none; }

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--text);
  background-color: var(--mica);
  background-image:
    radial-gradient(ellipse 70% 60% at 0% 0%, var(--mica-tint-1), transparent),
    radial-gradient(ellipse 60% 60% at 100% 100%, var(--mica-tint-2), transparent);
  background-attachment: fixed;
  font: 14px/20px var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, p { margin: 0; }

/* Rampa tipográfica de Windows 11 */
.caption { font-size: 12px; line-height: 16px; color: var(--text-secondary); }
.body-secondary { color: var(--text-secondary); }
.subtitle { font: 600 20px/28px var(--font-display); }
.title { font: 600 28px/36px var(--font-display); }
.title-large { font: 600 28px/36px var(--font-display); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- Iconos (Fluent UI System Icons) --------------------------------------- */

.icon {
  display: inline-block;
  flex: none;
  width: 16px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.small-icon { width: 12px; height: 12px; }

.i-add { --icon: url(icons/add.svg); }
.i-sync { --icon: url(icons/arrow-sync.svg); }
.i-edit { --icon: url(icons/edit.svg); }
.i-delete { --icon: url(icons/delete.svg); }
.i-search { --icon: url(icons/search.svg); }
.i-shield { --icon: url(icons/shield-checkmark.svg); }
.i-shield-filled { --icon: url(icons/shield-checkmark-filled.svg); }
.i-person { --icon: url(icons/person.svg); }
.i-sign-out { --icon: url(icons/sign-out.svg); }
.i-key { --icon: url(icons/key.svg); }
.i-dismiss { --icon: url(icons/dismiss.svg); }
.i-dismiss-filled { --icon: url(icons/dismiss-circle-filled.svg); }
.i-checkmark-filled { --icon: url(icons/checkmark-circle-filled.svg); }
.i-error-filled { --icon: url(icons/error-circle-filled.svg); }
.i-warning-filled { --icon: url(icons/warning-filled.svg); }
.i-info-filled { --icon: url(icons/info-filled.svg); }
.i-open { --icon: url(icons/open.svg); }
.i-chevron-down { --icon: url(icons/chevron-down.svg); }
.i-filter { --icon: url(icons/filter.svg); }
.i-calendar { --icon: url(icons/calendar.svg); }
.i-chevron-up { --icon: url(icons/chevron-up.svg); }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Colores por estado (en iconos y textos con data-status) */
[data-status="expired"] .icon, .icon[data-status="expired"] { color: var(--critical); }
[data-status="critical"] .icon, .icon[data-status="critical"] { color: var(--urgent); }
[data-status="warning"] .icon, .icon[data-status="warning"] { color: var(--caution); }
[data-status="ok"] .icon, .icon[data-status="ok"] { color: var(--success); }
.icon[data-status="all"] { color: var(--accent); }
.text-caution { color: var(--caution); font-weight: 600; }
.caption[data-status="expired"] { color: var(--critical); }
.caption[data-status="critical"] { color: var(--urgent); }
.caption[data-status="warning"] { color: var(--caution); }

/* --- Barra de título -------------------------------------------------------- */

.titlebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 0 8px 0 16px;
  background: color-mix(in srgb, var(--mica) 80%, transparent);
  backdrop-filter: blur(20px);
}
.app-icon { color: var(--accent); }
.titlebar-text { font-size: 12px; line-height: 16px; }

.user-menu { position: relative; margin-left: auto; }
.user-btn { gap: 8px; padding: 0 8px 0 4px; }
.user-btn.pressed { background: var(--subtle-pressed); }
.avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 10px;
  font-weight: 600;
}

/* MenuFlyout */
.flyout {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  padding: 4px;
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius-overlay);
  background: var(--flyout);
  backdrop-filter: blur(30px) saturate(1.3);
  box-shadow: var(--shadow-flyout);
  animation: flyout-in 0.2s cubic-bezier(0, 0, 0, 1);
}
.flyout button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 32px;
  margin: 2px 0;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
}
.flyout button:hover { background: var(--subtle-hover); }
.flyout button:active { background: var(--subtle-pressed); color: var(--text-secondary); }
.flyout-separator { height: 1px; margin: 2px -4px; background: var(--divider); }
@keyframes flyout-in { from { opacity: 0; transform: translateY(-8px); } }

/* --- Página ----------------------------------------------------------------- */

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px 32px 40px;
}
.page-header { margin-bottom: 20px; }
.page-header p { margin-top: 2px; }

.center-page {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 48px);
  padding: 16px;
}

/* Card */
.card {
  position: relative;
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius-overlay);
  background: var(--card);
  background-clip: padding-box;
}

/* --- Botones ---------------------------------------------------------------- */

.btn,
.subtle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-control);
  font: inherit;
  white-space: nowrap;
  user-select: none;
}

.btn {
  border: 1px solid var(--control-stroke);
  border-bottom-color: var(--control-stroke-bottom);
  background: var(--control);
  background-clip: padding-box;
  color: var(--text);
}
.btn:hover { background-color: var(--control-hover); }
.btn:active { background-color: var(--control-pressed); color: var(--text-secondary); border-bottom-color: var(--control-stroke); }
.btn:disabled { background-color: var(--control-disabled); color: var(--text-disabled); }

.btn.accent {
  border-color: rgb(255 255 255 / 0.08);
  border-bottom-color: rgb(0 0 0 / 0.4);
  background: var(--accent);
  color: var(--on-accent);
}
.btn.accent:hover { background: var(--accent-hover); }
.btn.accent:active { background: var(--accent-pressed); color: color-mix(in srgb, var(--on-accent) 75%, transparent); }
.btn.accent:disabled { border-color: transparent; background: var(--text-disabled); color: var(--on-accent); }
.btn.block { width: 100%; margin-top: 8px; }

/* Botón de acción destructiva (color crítico de Windows) */
.btn.danger-accent {
  border-color: rgb(255 255 255 / 0.08);
  border-bottom-color: rgb(0 0 0 / 0.4);
  background: #c42b1c;
  color: #ffffff;
}
.btn.danger-accent:hover { background: #b12719; }
.btn.danger-accent:active { background: #9f2317; color: rgb(255 255 255 / 0.8); }

.subtle-btn {
  border: 0;
  background: transparent;
  color: var(--text);
}
.subtle-btn:hover:not(:disabled) { background: var(--subtle-hover); }
.subtle-btn:active:not(:disabled) { background: var(--subtle-pressed); color: var(--text-secondary); }
.subtle-btn:disabled { color: var(--text-disabled); }
.icon-btn { width: 32px; padding: 0; }
.icon-btn.danger:hover:not(:disabled) { color: var(--critical); }

.hyperlink {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-size: 12px;
  line-height: 16px;
}
.hyperlink:hover { text-decoration: underline; }

/* Indicador de foco de teclado de Windows */
:is(.btn, .subtle-btn, .hyperlink, .stat, .flyout button, a):focus-visible {
  outline: 2px solid var(--focus-outer);
  outline-offset: 1px;
}

/* --- Campos de texto -------------------------------------------------------- */

.field { display: block; margin-bottom: 16px; }
.field-label { display: block; margin-bottom: 8px; }

.textbox,
.combobox select {
  width: 100%;
  min-height: 32px;
  padding: 5px 11px 6px;
  border: 1px solid var(--control-stroke);
  border-bottom-color: var(--textbox-bottom);
  border-radius: var(--radius-control);
  background: var(--control);
  background-clip: padding-box;
  color: var(--text);
  font: inherit;
}
textarea.textbox { resize: vertical; }
.textbox::placeholder { color: var(--text-secondary); }
.textbox:hover { background-color: var(--control-hover); }
.textbox:focus {
  outline: none;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--accent);
  background-color: var(--textbox-focus);
}

/* AutoSuggestBox */
.searchbox { position: relative; width: 280px; }
.searchbox .textbox { padding-right: 36px; }
.searchbox .icon { position: absolute; top: 8px; right: 12px; color: var(--text-secondary); pointer-events: none; }
.searchbox input::-webkit-search-cancel-button { display: none; }

/* ComboBox */
.combobox { position: relative; width: 200px; }
.combobox select {
  appearance: none;
  padding-right: 36px;
  border-bottom-color: var(--control-stroke-bottom);
}
.combobox select:hover { background-color: var(--control-hover); }
.combobox select:focus-visible { outline: 2px solid var(--focus-outer); outline-offset: 1px; }
.combobox option { background: var(--layer); color: var(--text); }
.combobox .icon { position: absolute; top: 10px; right: 12px; color: var(--text-secondary); pointer-events: none; }

/* ToggleSwitch */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  user-select: none;
}
.toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.toggle-track {
  position: relative;
  flex: none;
  width: 40px;
  height: 20px;
  border: 1px solid var(--toggle-stroke);
  border-radius: 10px;
  background: var(--toggle-fill);
  transition: background 0.1s;
}
.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-secondary);
  transition: left 0.15s cubic-bezier(0, 0, 0, 1), width 0.1s, height 0.1s, top 0.1s;
}
.toggle:hover .toggle-track { background: var(--subtle-hover); }
.toggle:hover .toggle-thumb { top: 2px; width: 14px; height: 14px; }
.toggle input:checked + .toggle-track { border-color: var(--accent); background: var(--accent); }
.toggle input:checked + .toggle-track .toggle-thumb { left: 23px; background: var(--on-accent); }
.toggle:hover input:checked + .toggle-track .toggle-thumb { left: 22px; }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--focus-outer); outline-offset: 2px; }

/* --- CalendarDatePicker ---------------------------------------------------- */

.dp-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  border-bottom-color: var(--control-stroke-bottom);
}
.dp-trigger .icon { color: var(--text-secondary); }
.dp-trigger:focus-visible { outline: 2px solid var(--focus-outer); outline-offset: 1px; }
.dp-trigger.open { background: var(--control-pressed); }
.dp-placeholder { color: var(--text-secondary); }

.dp-flyout {
  position: fixed;
  z-index: 50;
  width: 300px;
  overflow: hidden;
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius-overlay);
  background: var(--flyout);
  backdrop-filter: blur(30px) saturate(1.3);
  box-shadow: var(--shadow-flyout);
  color: var(--text);
  animation: flyout-in 0.2s cubic-bezier(0, 0, 0, 1);
}
.dp-flyout.above { animation-name: flyout-in-up; }
@keyframes flyout-in-up { from { opacity: 0; transform: translateY(8px); } }

.dp-header {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 6px 2px;
  border-bottom: 1px solid var(--divider);
}
.dp-title {
  flex: 1;
  height: 32px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text);
  font: 600 14px/20px var(--font);
  text-align: left;
}
.dp-title:first-letter { text-transform: uppercase; }
.dp-title:hover:not(:disabled) { background: var(--subtle-hover); }
.dp-title:disabled { color: var(--text); }

.dp-body { padding: 4px 10px 8px; }
.dp-weekdays, .dp-days { display: grid; grid-template-columns: repeat(7, 40px); }
.dp-weekdays span {
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.dp-day, .dp-month {
  display: grid;
  place-items: center;
  margin: 2px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font: inherit;
}
.dp-day { width: 36px; height: 36px; }
.dp-day.outside { color: var(--text-tertiary); }
.dp-day:hover:not(:disabled), .dp-month:hover:not(:disabled) { background: var(--subtle-hover); }
.dp-day:active:not(:disabled), .dp-month:active:not(:disabled) { background: var(--subtle-pressed); }
.dp-day:disabled, .dp-month:disabled { color: var(--text-disabled); }
.dp-day.selected, .dp-month.selected { box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.dp-day.today, .dp-month.today { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.dp-day.today:hover:not(:disabled), .dp-month.today:hover:not(:disabled) { background: var(--accent-hover); }
.dp-day.today.selected, .dp-month.today.selected { box-shadow: inset 0 0 0 2px var(--accent), inset 0 0 0 3px var(--on-accent); }
.dp-day:focus-visible, .dp-month:focus-visible { outline: 2px solid var(--focus-outer); outline-offset: -1px; }

.dp-months { display: grid; grid-template-columns: repeat(4, 1fr); padding: 12px 10px; }
.dp-month { height: 64px; margin: 3px; text-transform: capitalize; }

.dp-footer {
  display: flex;
  justify-content: space-between;
  padding: 4px 6px 6px;
  border-top: 1px solid var(--divider);
}
.dp-footer .subtle-btn { color: var(--link); }
.dp-footer .subtle-btn:disabled { color: var(--text-disabled); }

/* --- CommandBar y resumen --------------------------------------------------- */

.btn.checked { background: var(--subtle-pressed); border-color: var(--control-stroke-bottom); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* Panel de filtros por fecha */
.filter-panel { margin: -8px 0 16px; padding: 16px; animation: flyout-in 0.2s cubic-bezier(0, 0, 0, 1); }
.filter-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.filter-fields .field { margin: 0; }
.filter-fields .combobox { width: 210px; }
.filter-fields .date-picker { width: 170px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.filter-panel > .caption { margin-top: 12px; }

/* Botones tipo "pill" (ToggleButton redondeado) */
.pill {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--control-stroke);
  border-bottom-color: var(--control-stroke-bottom);
  border-radius: 14px;
  background: var(--control);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}
.pill:hover { background: var(--control-hover); }
.pill.selected { border-color: transparent; background: var(--accent); color: var(--on-accent); }
.pill.selected:hover { background: var(--accent-hover); }
.pill:focus-visible { outline: 2px solid var(--focus-outer); outline-offset: 1px; }

.commandbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.commandbar-spacer { flex: 1; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  color: var(--text);
  font: inherit;
  text-align: left;
}
.stat:hover { background: var(--card-hover); }
.stat.selected::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 50%;
  width: 3px;
  height: 20px;
  margin-top: -10px;
  border-radius: 2px;
  background: var(--accent);
}
.stat-head { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); white-space: nowrap; }
.stat-value { display: flex; align-items: baseline; gap: 8px; font: 600 28px/36px var(--font-display); }
.stat-value .caption { font-family: var(--font); font-weight: 400; }

/* --- Lista de certificados -------------------------------------------------- */

.list { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 16px; }
th {
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--divider);
}
tbody tr { border-bottom: 1px solid var(--divider); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--subtle-hover); }

.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.domain { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 600; text-decoration: none; }
.domain .icon { opacity: 0; color: var(--text-secondary); }
.domain:hover { color: var(--link); }
.domain:hover .icon { opacity: 1; }
.client-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
}
.client-link:hover { color: var(--link); text-decoration: underline; }
.client-link:focus-visible { outline: 2px solid var(--focus-outer); outline-offset: 1px; }
.notes { max-width: 260px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.caption .icon { vertical-align: -1px; }

.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }

.row-actions { white-space: nowrap; text-align: right; padding-right: 8px; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 56px 16px;
  color: var(--text-secondary);
  text-align: center;
}
.empty-icon { width: 40px; height: 40px; color: var(--text-tertiary); }

.footer { margin-top: 12px; text-align: right; }

/* ProgressBar indeterminada y ProgressRing */
.progress-bar {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  overflow: hidden;
  border-radius: var(--radius-overlay) var(--radius-overlay) 0 0;
}
.progress-bar::before {
  content: "";
  position: absolute;
  width: 40%;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  animation: progress 1.6s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes progress { from { left: -40%; } to { left: 100%; } }

.progress-ring {
  width: 32px;
  height: 32px;
  border: 3px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

/* --- InfoBar ---------------------------------------------------------------- */

.infobar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 16px;
  padding: 10px 14px;
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius-control);
  background: var(--layer-alt);
}
.infobar > .icon { margin-top: 2px; }
.infobar.error { background: var(--critical-bg); }
.infobar.error > .icon { color: var(--critical); }
.infobar.success { background: var(--success-bg); }
.infobar.success > .icon { color: var(--success); }

.infobar.floating {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 40;
  align-items: center;
  max-width: min(440px, calc(100% - 32px));
  margin: 0;
  padding: 6px 6px 6px 14px;
  border-radius: var(--radius-overlay);
  box-shadow: var(--shadow-flyout);
  animation: flyout-in 0.25s cubic-bezier(0, 0, 0, 1);
}
.infobar.floating > .icon { margin-top: 0; }
.infobar.floating > span:nth-child(2) { flex: 1; }

/* --- Acceso ----------------------------------------------------------------- */

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 32px 28px 28px;
  background: var(--layer);
  box-shadow: var(--shadow-flyout);
}
.auth-icon { width: 40px; height: 40px; margin-bottom: 16px; color: var(--accent); }
.auth-card .body-secondary { margin: 4px 0 24px; }

/* --- ContentDialog ---------------------------------------------------------- */

.smoke {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--smoke);
  animation: fade-in 0.15s linear;
}
.dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 548px;
  max-height: 100%;
  overflow: hidden;
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius-overlay);
  background: var(--layer);
  box-shadow: var(--shadow-dialog);
  animation: dialog-in 0.25s cubic-bezier(0, 0, 0, 1);
}
.dialog.narrow { max-width: 420px; }
.dialog-body { padding: 24px; overflow: auto; }
.dialog-body .subtitle { margin-bottom: 20px; }
.confirm-message { font-weight: 600; word-break: break-all; }
#dlg-confirm-msg .body-secondary { margin-top: 12px; }
.dialog-footer {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 8px;
  padding: 24px;
  border-top: 1px solid var(--divider);
  background: var(--layer-alt);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes dialog-in { from { opacity: 0; transform: scale(1.05); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* --- Pantallas estrechas ---------------------------------------------------- */

@media (max-width: 1080px) {
  .page { padding: 8px 16px 32px; }
  .commandbar-spacer { display: none; }
  .searchbox { flex: 1; min-width: 180px; width: auto; }

  /* La tabla pasa a tarjetas en rejilla */
  thead { display: none; }
  table, tbody { display: block; }
  tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 16px;
    padding: 12px 16px;
  }
  td, td:first-child { display: block; padding: 0; }
  td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 12px;
    line-height: 16px;
    color: var(--text-secondary);
  }
  td[data-label="Dominio"] { grid-column: 1 / -2; }
  td[data-label="Dominio"]::before { display: none; }
  .row-actions { grid-column: -2 / -1; grid-row: 1; padding: 0; margin: -4px -8px 0 0; }
  .num { text-align: left; }
  .notes { max-width: none; }
  .domain .icon { opacity: 1; }
}

@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  tbody tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .commandbar > .btn { flex: 1; }
  .searchbox, .combobox { width: 100%; flex: none; }
  .filter-fields .field { flex: 1 1 100%; }
  .filter-fields .combobox, .filter-fields .date-picker { width: 100%; }
  .filter-clear { width: 100%; }
  .grid-2 { grid-template-columns: 1fr; }
  .user-name { display: none; }
  .infobar.floating { right: 16px; bottom: 16px; left: 16px; max-width: none; }
}
