@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500;700;800&display=swap');

/* ── Custom fonts loaded via JS (font manager) ── */
/* @font-face for custom-panel, custom-monitor, custom-kiosk injected dynamically */

:root{
  --font-display:'Medicinal','Syne',sans-serif;
  --primary:#1A56DB;
  --primary-light:#3B75F5;
  --primary-soft:#7DA8FF;
  --accent:#60A5FA;
  --glow:rgba(26,86,219,.22);

  --bg:#0A0F1A;
  --surface:#101828;
  --surface2:#182033;
  --surface3:#1d2b3e;
  --border:#1E3458;

  --text:#EDF3FF;
  --text-muted:#6A8CB8;

  --success:#22c55e;
  --danger:#ef4444;
  --warning:#f59e0b;

  --radius:16px;
  --shadow-xl:0 30px 80px rgba(0,0,0,.42);
  --shadow-lg:0 18px 45px rgba(0,0,0,.26);
  --shadow-md:0 10px 24px rgba(0,0,0,.18);
}

*{box-sizing:border-box;margin:0;padding:0}

html,body{
  min-height:100%;
}

body{
  font-family:'DM Sans',sans-serif;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 12%, transparent), transparent 28%),
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 6%, transparent), transparent 22%),
    linear-gradient(180deg, var(--bg) 0%, color-mix(in srgb, var(--bg) 88%, #000 12%) 100%);
  color:var(--text);
  min-height:100vh;
}

/* ===== PANTALLAS ===== */

.screen{display:none;min-height:100vh}
.screen.active{display:flex}

#loginScreen{
  align-items:center;
  justify-content:center;
  padding:30px;
}

.login-card{
  width:100%;
  max-width:440px;
  background:
    radial-gradient(circle at top right, rgba(61,129,255,.12), transparent 28%),
    linear-gradient(180deg, rgba(17,28,49,.96) 0%, rgba(12,20,35,.98) 100%);
  border:1px solid color-mix(in srgb, var(--border) 84%, white 16%);
  border-radius:28px;
  padding:40px 34px;
  box-shadow:var(--shadow-xl);
  position:relative;
  overflow:hidden;
}

.login-card::before{
  content:'';
  position:absolute;
  top:0; left:0; right:0;
  height:2px;
  background:linear-gradient(90deg, transparent, var(--primary-light), var(--accent), transparent);
  opacity:.7;
}

.login-card::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  border-radius:28px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05);
}

.brand{
  text-align:center;
  margin-bottom:26px;
}

.brand h1{
  font-family:var(--font-display);
  font-size:32px;
  font-weight:normal;
  margin-bottom:8px;
  letter-spacing:2px;
  text-transform:uppercase;
}

.brand p{
  color:var(--text-muted);
  font-size:14px;
}

.error-msg{
  display:none;
  background:rgba(239,68,68,.12);
  border:1px solid rgba(239,68,68,.28);
  color:#fca5a5;
  padding:12px 14px;
  border-radius:14px;
  margin-bottom:14px;
  font-size:14px;
  white-space:pre-wrap;
  word-break:break-word;
}

/* ===== FORMULARIOS ===== */

.form-group{margin-bottom:16px}

.form-group label{
  display:block;
  font-size:12px;
  font-weight:800;
  color:var(--text-muted);
  margin-bottom:8px;
  text-transform:uppercase;
  letter-spacing:.8px;
}

.form-group input,
.form-group select,
.form-group textarea{
  width:100%;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface2) 90%, white 10%) 0%, var(--surface2) 100%);
  border:1px solid color-mix(in srgb, var(--border) 84%, white 16%);
  border-radius:16px;
  padding:13px 15px;
  color:var(--text);
  font-size:15px;
  outline:none;
  font-family:'DM Sans',sans-serif;
  transition:.18s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus{
  border-color:color-mix(in srgb, var(--primary) 70%, white 30%);
  box-shadow:0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}

/* opciones negras para desplegables */
select option{
  background:#0a0f1a !important;
  color:#EDF3FF !important;
}

[data-theme="light"] select option{
  background:#ffffff !important;
  color:#111111 !important;
}

/* ===== BOTONES ===== */

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:none;
  cursor:pointer;
  border-radius:16px;
  padding:12px 18px;
  font-family:'DM Sans',sans-serif;
  font-weight:800;
  transition:.18s ease;
  text-decoration:none;
}

.btn:hover{
  transform:translateY(-1px);
}

.btn:disabled{
  opacity:.72;
  cursor:not-allowed;
  transform:none;
}

.btn-primary{
  background:linear-gradient(180deg, color-mix(in srgb, var(--primary) 78%, white 22%) 0%, var(--primary) 100%);
  color:#fff;
  width:100%;
  font-size:16px;
  box-shadow:0 16px 28px color-mix(in srgb, var(--primary) 26%, transparent);
  transition:transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

.btn-primary:hover{
  transform:translateY(-2px);
  filter:brightness(1.1);
  box-shadow:0 20px 32px color-mix(in srgb, var(--primary) 36%, transparent);
}

.btn-primary:active{ transform:translateY(0); filter:brightness(.95); }

.btn-primary:hover{
  background:linear-gradient(180deg, color-mix(in srgb, var(--primary-light) 78%, white 22%) 0%, var(--primary-light) 100%);
}

.btn-secondary{
  background:linear-gradient(180deg, rgba(29,44,73,.95) 0%, rgba(21,34,58,.98) 100%);
  color:var(--text);
  border:1px solid color-mix(in srgb, var(--border) 84%, white 16%);
  transition:transform .15s ease, border-color .15s ease, background .15s ease;
}

.btn-secondary:hover{
  transform:translateY(-1px);
  border-color:rgba(99,153,255,.5);
  background:linear-gradient(180deg, rgba(35,52,85,.98) 0%, rgba(27,42,68,.98) 100%);
}

.btn-secondary:active{ transform:translateY(0); }

.btn-secondary:hover{
  border-color:color-mix(in srgb, var(--primary) 42%, white 18%);
}

.btn-danger{
  background:linear-gradient(180deg, #ef5350 0%, #dc2626 100%);
  color:#fff;
  box-shadow:0 12px 24px rgba(220,38,38,.2);
  transition:transform .15s ease, filter .15s ease;
}

.btn-danger:hover{ transform:translateY(-2px); filter:brightness(1.08); }
.btn-danger:active{ transform:translateY(0); filter:brightness(.95); }

.btn-success{
  background:linear-gradient(180deg, #34d399 0%, #16a34a 100%);
  color:#fff;
}

.btn-warning{
  background:linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  color:#111827;
  box-shadow:0 12px 24px rgba(245,158,11,.18);
}

.btn-sm{
  padding:8px 12px;
  font-size:13px;
  min-height:38px;
}

.btn-ghost{
  background:transparent;
  color:var(--text-muted);
}

/* ===== APP ===== */

#appScreen{
  flex-direction:column;
}

.navbar{
  min-height:72px;
  background:
    linear-gradient(180deg, rgba(17,27,47,.96) 0%, rgba(13,22,38,.98) 100%);
  border-bottom:1px solid color-mix(in srgb, var(--border) 84%, white 16%);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 22px;
  gap:12px;
  flex-wrap:wrap;
  position:sticky;
  top:0;
  z-index:20;
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
  box-shadow:0 8px 24px rgba(0,0,0,.16);
}

.navbar-left{
  display:flex;
  align-items:center;
  gap:12px;
}

.nav-logo{
  height:42px;
  max-width:120px;
  object-fit:contain;
  border-radius:8px;
}

.navbar-title{
  font-family:var(--font-display);
  font-size:22px;
  font-weight:normal;
  letter-spacing:1.5px;
  text-transform:uppercase;
}

.navbar-right{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.user-badge{
  background:
    linear-gradient(180deg, rgba(28,43,70,.92) 0%, rgba(19,31,53,.96) 100%);
  border:1px solid color-mix(in srgb, var(--border) 84%, white 16%);
  border-radius:999px;
  padding:8px 14px;
  font-size:13px;
  color:var(--text);
  box-shadow:var(--shadow-md);
}

.main{
  padding:24px;
  max-width:1500px;
  width:100%;
  margin:0 auto;
}

/* ===== TABS ===== */

.tabs{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-bottom:20px;
  background:
    linear-gradient(180deg, rgba(24,38,64,.92) 0%, rgba(17,28,47,.96) 100%);
  border:1px solid color-mix(in srgb, var(--border) 84%, white 16%);
  padding:8px;
  border-radius:20px;
  box-shadow:var(--shadow-lg);
}

.tab{
  background:transparent;
  border:none;
  color:var(--text-muted);
  font-family:'DM Sans',sans-serif;
  font-weight:800;
  padding:11px 16px;
  border-radius:14px;
  cursor:pointer;
  transition:.18s ease;
}

.tab:hover{
  color:var(--text);
  background:rgba(255,255,255,.03);
}

.tab.active{
  background:
    linear-gradient(180deg, rgba(35,53,86,.96) 0%, rgba(25,39,65,.98) 100%);
  color:var(--text);
  box-shadow:0 10px 22px rgba(0,0,0,.18);
  position:relative;
}

.tab.active::after{
  content:'';
  position:absolute;
  bottom:4px;
  left:50%;
  transform:translateX(-50%);
  width:20px;
  height:3px;
  background:var(--primary-light);
  border-radius:2px;
}

.tab-panel{display:none;}
.tab-panel.active{
  display:block;
  animation:fadeInUp .22s ease both;
}

@keyframes fadeInUp{
  from{ opacity:0; transform:translateY(10px); }
  to{   opacity:1; transform:translateY(0); }
}

/* ===== CARDS ===== */

.card{
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 8%, transparent), transparent 24%),
    linear-gradient(180deg, rgba(17,27,47,.95) 0%, rgba(13,22,38,.98) 100%);
  border:1px solid color-mix(in srgb, var(--border) 84%, white 16%);
  border-radius:24px;
  padding:22px;
  margin-bottom:18px;
  box-shadow:var(--shadow-lg);
  position:relative;
  overflow:hidden;
}

.card::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  border-radius:24px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}

.card-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:18px;
  position:relative;
  z-index:1;
}

.card-title{
  font-family:var(--font-display);
  font-size:20px;
  font-weight:normal;
  letter-spacing:1px;
}

.card-subtitle{
  font-size:13px;
  color:var(--text-muted);
  margin-top:4px;
  line-height:1.6;
}

.grid-2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
}

.grid-4{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:14px;
}

/* ===== EMPTY STATES ===== */

.empty-state{
  text-align:center;
  color:var(--text-muted);
  padding:42px 18px;
  border-radius:22px;
  border:1px dashed rgba(255,255,255,.08);
  background:rgba(255,255,255,.02);
}

.empty-state .icon{
  font-size:48px;
  margin-bottom:12px;
}

/* ===== LISTS / ITEMS ===== */

.list{
  display:flex;
  flex-direction:column;
  gap:12px;
  position:relative;
  z-index:1;
}

.item{
  background:
    linear-gradient(180deg, rgba(26,39,63,.94) 0%, rgba(19,31,51,.98) 100%);
  border:1px solid color-mix(in srgb, var(--border) 84%, white 16%);
  border-radius:20px;
  padding:16px 18px;
  box-shadow:var(--shadow-md);
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.item:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow-lg);
  border-color:rgba(99,153,255,.3);
}

.item-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
}

.item-title{
  font-weight:800;
  font-size:17px;
  line-height:1.2;
}

.item-meta{
  font-size:13px;
  color:var(--text-muted);
  margin-top:8px;
  line-height:1.7;
}

/* ===== TIMER CHIPS ===== */

.timer-chip{
  font-family:var(--font-display);
  font-size:18px;
  font-weight:normal;
  padding:8px 16px;
  border-radius:999px;
  border:1px solid rgba(34,197,94,.24);
  background:rgba(34,197,94,.14);
  color:#86efac;
  white-space:nowrap;
  box-shadow:0 10px 22px rgba(0,0,0,.14);
}

.timer-chip.warn{
  background:rgba(245,158,11,.16);
  color:#fcd34d;
  border-color:rgba(245,158,11,.28);
}

.timer-chip.exp{
  background:rgba(239,68,68,.16);
  color:#fca5a5;
  border-color:rgba(239,68,68,.28);
}

/* ===== ACTIONS / FILTERS ===== */

.actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:12px;
}

.filters{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:14px;
  position:relative;
  z-index:1;
}

.filters input,
.filters select{
  background:
    linear-gradient(180deg, rgba(26,39,63,.92) 0%, rgba(18,29,49,.98) 100%);
  border:1px solid color-mix(in srgb, var(--border) 84%, white 16%);
  border-radius:14px;
  color:var(--text);
  padding:11px 13px;
  font-family:'DM Sans',sans-serif;
  outline:none;
  min-height:44px;
}

.filters input:focus,
.filters select:focus{
  border-color:color-mix(in srgb, var(--primary) 70%, white 30%);
  box-shadow:0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}

/* ===== TABLES ===== */

table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  font-size:14px;
  overflow:hidden;
  border-radius:18px;
}

thead tr{
  background:
    linear-gradient(180deg, rgba(28,42,69,.98) 0%, rgba(21,33,55,.98) 100%);
}

th{
  text-align:left;
  padding:12px 14px;
  color:var(--text-muted);
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.8px;
  border-bottom:1px solid rgba(255,255,255,.06);
  font-weight:800;
}

td{
  padding:14px;
  border-bottom:1px solid rgba(255,255,255,.05);
  background:rgba(255,255,255,.01);
}

tbody tr:hover td{
  background:rgba(255,255,255,.025);
}

/* ===== BADGES ===== */

.role-badge{
  display:inline-block;
  padding:4px 9px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  letter-spacing:.3px;
}

.role-superadmin{background:rgba(168,85,247,.18);color:#e9d5ff}
.role-admin{background:rgba(239,68,68,.15);color:#fecaca}
.role-gerente{background:rgba(124,58,237,.18);color:#c4b5fd}
.role-user{background:rgba(26,86,219,.18);color:#bfdbfe}

/* ===== STATS ===== */

.stat-box{
  background:
    linear-gradient(180deg, rgba(27,40,66,.96) 0%, rgba(20,31,52,.98) 100%);
  border:1px solid color-mix(in srgb, var(--border) 84%, white 16%);
  border-radius:22px;
  padding:20px 22px;
  box-shadow:var(--shadow-md);
  transition:transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  cursor:default;
}

.stat-box:hover{
  transform:translateY(-3px);
  box-shadow:var(--shadow-lg);
  border-color:rgba(99,153,255,.35);
}

.stat-value{
  font-family:var(--font-display);
  font-size:32px;
  font-weight:normal;
  line-height:1.05;
  letter-spacing:1px;
}

.stat-label{
  color:var(--text-muted);
  font-size:11px;
  margin-top:10px;
  text-transform:uppercase;
  letter-spacing:1.2px;
  font-weight:700;
  font-family:'DM Sans',sans-serif;
}

/* ===== BRANCH / COMPANY / PLAN CARDS ===== */

.branch-card,
.company-card,
.plan-card{
  background:
    linear-gradient(180deg, rgba(25,39,64,.96) 0%, rgba(18,29,49,.98) 100%);
  border:1px solid color-mix(in srgb, var(--border) 84%, white 16%);
  border-radius:20px;
  padding:18px;
  box-shadow:var(--shadow-md);
}

.branch-color-dot{
  width:14px;
  height:14px;
  border-radius:50%;
  display:inline-block;
  margin-right:8px;
  border:2px solid rgba(255,255,255,.18);
  vertical-align:middle;
}

.plan-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  margin:4px 6px 0 0;
  padding:7px 12px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  color:#dbeafe;
  background:rgba(26,86,219,.18);
  border:1px solid rgba(26,86,219,.28);
}

.plans-wrap{
  margin-top:18px;
  border-top:1px solid rgba(255,255,255,.08);
  padding-top:18px;
}

.plans-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-bottom:14px;
}

.plans-title{
  font-size:14px;
  font-weight:800;
  color:#9fc5ff;
}

.plan-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(240px, 280px));
  gap:12px;
  align-items:stretch;
}

.plan-card.compact{
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  min-height:180px;
  padding:14px;
  border-radius:20px;
  background:
    linear-gradient(180deg, rgba(28,42,69,.98) 0%, rgba(21,33,55,.98) 100%);
  box-shadow:var(--shadow-md);
}

.plan-card.compact .item-title{
  font-size:15px;
  line-height:1.25;
}

.plan-card.compact .item-meta{
  margin-top:8px;
  line-height:1.7;
}

.plan-card.compact .actions{
  margin-top:14px;
}

.plan-card.compact .actions .btn{
  flex:1 1 auto;
}

.plan-card-empty{
  padding:18px;
  border:1px dashed rgba(143,182,246,.25);
  border-radius:20px;
  background:rgba(255,255,255,.02);
  color:var(--text-muted);
}

/* ===== WAIVER PREVIEW ===== */

.waiver-preview{
  background:#fff;
  color:#111827;
  border-radius:18px;
  padding:24px;
  max-height:70vh;
  overflow:auto;
  line-height:1.7;
  box-shadow:var(--shadow-md);
}

/* ===== GENERIC MODALS ===== */

.modal-overlay{
  position:fixed;
  inset:0;
  background:
    radial-gradient(circle at top, rgba(59,130,246,.12), transparent 24%),
    rgba(4,8,20,.72);
  backdrop-filter:blur(14px) saturate(120%);
  -webkit-backdrop-filter:blur(14px) saturate(120%);
  display:none;
  align-items:center;
  justify-content:center;
  padding:20px;
  z-index:50;
}

.modal-overlay.open{
  display:flex;
  animation:premiumFadeIn .18s ease-out;
}

.modal{
  width:100%;
  max-width:900px;
  background:
    radial-gradient(circle at top right, rgba(61,129,255,.12), transparent 28%),
    linear-gradient(180deg, rgba(16,27,49,.98) 0%, rgba(10,18,34,.98) 100%);
  border:1px solid rgba(112,146,217,.18);
  border-radius:28px;
  padding:26px;
  position:relative;
  max-height:92vh;
  overflow:auto;
  box-shadow:
    0 35px 90px rgba(0,0,0,.48),
    0 10px 30px rgba(0,0,0,.28),
    inset 0 1px 0 rgba(255,255,255,.05);
  animation:premiumDialogIn .22s ease-out;
}

.modal::before{
  content:"";
  position:absolute;
  inset:0;
  border-radius:28px;
  pointer-events:none;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04);
}

.modal-close{
  position:absolute;
  top:16px;
  right:16px;
  width:42px;
  height:42px;
  border-radius:999px;
  border:1px solid rgba(140,177,244,.16);
  background:rgba(20,33,61,.88);
  color:#dbeafe;
  cursor:pointer;
  font-size:22px;
  line-height:1;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:.2s ease;
  z-index:2;
}

.modal-close:hover{
  transform:scale(1.04);
  background:rgba(28,45,80,.96);
  border-color:rgba(154,190,255,.32);
  box-shadow:0 10px 22px rgba(0,0,0,.24);
}

/* ===== LOADING / TOAST ===== */

#loadingOverlay{
  position:fixed;
  inset:0;
  background:var(--bg);
  z-index:100;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:16px;
}

.spinner{
  width:46px;
  height:46px;
  border:4px solid rgba(255,255,255,.08);
  border-top-color:var(--primary);
  border-radius:50%;
  animation:spin .8s linear infinite;
}

#toast{
  position:fixed;
  right:22px;
  bottom:22px;
  z-index:120;
  background:
    linear-gradient(180deg, rgba(22,34,58,.98) 0%, rgba(16,26,45,.98) 100%);
  border:1px solid color-mix(in srgb, var(--border) 84%, white 16%);
  color:var(--text);
  border-radius:16px;
  padding:13px 16px;
  min-width:240px;
  max-width:360px;
  box-shadow:var(--shadow-lg);
  opacity:0;
  transform:translateY(100px);
  transition:opacity .25s, transform .25s;
  pointer-events:none;
}

/* ===== PREMIUM POPUPS ===== */

#uiDialogModal .modal{
  max-width:580px;
  padding:30px 26px 24px;
  border-radius:28px;
  background:
    radial-gradient(circle at top right, rgba(90,134,255,.18), transparent 28%),
    radial-gradient(circle at top left, rgba(255,255,255,.04), transparent 24%),
    linear-gradient(180deg, rgba(14,25,48,.98) 0%, rgba(9,17,31,.98) 100%);
}

#uiDialogHeader{
  display:flex;
  align-items:flex-start;
  gap:16px;
  margin-bottom:14px;
  padding-right:48px;
  position:relative;
  z-index:1;
}

#uiDialogIcon{
  width:68px;
  min-width:68px;
  height:68px;
  border-radius:20px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.03);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.04),
    0 14px 30px rgba(0,0,0,.18);
}

#uiDialogIcon svg{
  width:31px;
  height:31px;
}

#uiDialogHeaderText{
  flex:1;
  min-width:0;
}

#uiDialogEyebrow{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:1.3px;
  font-weight:800;
  color:#8fb6f6;
  margin-bottom:8px;
}

#uiDialogTitle{
  font-size:24px;
  line-height:1.05;
  margin-bottom:0 !important;
  color:#f8fbff;
  letter-spacing:-.3px;
}

#uiDialogMessage{
  font-size:15px !important;
  line-height:1.8 !important;
  color:#d9e6ff !important;
  margin:8px 0 22px !important;
  position:relative;
  z-index:1;
}

#uiDialogMessage strong{
  color:#ffffff;
  font-weight:800;
}

#uiDialogModal #uiDialogInput{
  min-height:120px;
  border-radius:16px;
  background:rgba(13,25,46,.82);
  border:1px solid rgba(93,131,205,.22);
  color:#ecf4ff;
}

#uiDialogModal #uiDialogInput:focus{
  border-color:rgba(93,131,205,.55);
  box-shadow:0 0 0 3px rgba(63,114,255,.16);
}

#uiDialogModal #uiDialogActions{
  gap:12px !important;
  position:relative;
  z-index:1;
}

#uiDialogCancelBtn,
#uiDialogOkBtn{
  min-width:140px;
  min-height:50px;
  border-radius:18px !important;
  font-size:15px;
  font-weight:800;
  padding:13px 18px !important;
  transition:.22s ease;
}

#uiDialogCancelBtn{
  background:linear-gradient(180deg, rgba(27,42,72,.92) 0%, rgba(20,31,56,.96) 100%);
  border:1px solid rgba(123,159,227,.16);
  color:#eef5ff;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03);
}

#uiDialogCancelBtn:hover{
  background:linear-gradient(180deg, rgba(34,52,88,.96) 0%, rgba(24,38,67,.98) 100%);
  border-color:rgba(141,178,247,.3);
  transform:translateY(-1px);
}

#uiDialogOkBtn{
  background:linear-gradient(180deg, #4381ff 0%, #255fe7 100%);
  border:1px solid rgba(134,171,246,.18);
  color:#fff;
  box-shadow:
    0 14px 28px rgba(37,95,231,.28),
    inset 0 1px 0 rgba(255,255,255,.12);
}

#uiDialogOkBtn:hover{
  transform:translateY(-1px);
  box-shadow:
    0 18px 30px rgba(37,95,231,.34),
    inset 0 1px 0 rgba(255,255,255,.14);
}

#uiDialogModal.ui-dialog-danger #uiDialogEyebrow{color:#fca5a5}
#uiDialogModal.ui-dialog-warning #uiDialogEyebrow{color:#fcd34d}
#uiDialogModal.ui-dialog-success #uiDialogEyebrow{color:#86efac}
#uiDialogModal.ui-dialog-info #uiDialogEyebrow{color:#93c5fd}

#uiDialogModal.ui-dialog-danger #uiDialogIcon{
  background:linear-gradient(180deg, rgba(239,68,68,.13) 0%, rgba(127,29,29,.18) 100%);
  border-color:rgba(239,68,68,.18);
}
#uiDialogModal.ui-dialog-warning #uiDialogIcon{
  background:linear-gradient(180deg, rgba(245,158,11,.14) 0%, rgba(120,53,15,.18) 100%);
  border-color:rgba(245,158,11,.18);
}
#uiDialogModal.ui-dialog-success #uiDialogIcon{
  background:linear-gradient(180deg, rgba(34,197,94,.14) 0%, rgba(20,83,45,.18) 100%);
  border-color:rgba(34,197,94,.18);
}
#uiDialogModal.ui-dialog-info #uiDialogIcon{
  background:linear-gradient(180deg, rgba(59,130,246,.14) 0%, rgba(30,58,138,.18) 100%);
  border-color:rgba(59,130,246,.18);
}

#uiDialogCloseBtn{
  position:absolute;
  top:0;
  right:0;
  width:42px;
  height:42px;
  border-radius:999px;
  border:1px solid rgba(140,177,244,.16);
  background:rgba(20,33,61,.88);
  color:#dbeafe;
  cursor:pointer;
  font-size:22px;
  line-height:1;
  display:flex;
  align-items:center;
  justify-content:center;
  transition:.2s ease;
}

#uiDialogCloseBtn:hover{
  transform:scale(1.04);
  background:rgba(28,45,80,.96);
  border-color:rgba(154,190,255,.32);
  box-shadow:0 10px 22px rgba(0,0,0,.24);
}

/* ===== ANIMACIONES ===== */

@keyframes spin{
  to{transform:rotate(360deg)}
}

@keyframes premiumFadeIn{
  from{opacity:0}
  to{opacity:1}
}

@keyframes premiumDialogIn{
  from{opacity:0;transform:translateY(12px) scale(.98)}
  to{opacity:1;transform:translateY(0) scale(1)}
}

/* ===== RESPONSIVE ===== */

@media(max-width:1100px){
  .grid-4{
    grid-template-columns:repeat(2,1fr);
  }
}

@media(max-width:900px){
  .grid-2,
  .grid-4{
    grid-template-columns:1fr;
  }
}

@media(max-width:760px){
  .main{
    padding:14px;
  }

  .navbar{
    padding:12px 14px;
  }

  .navbar-title{
    font-size:20px;
  }

  .tabs{
    border-radius:18px;
    padding:6px;
  }

  .tab{
    width:100%;
    text-align:left;
  }

  .card,
  .modal{
    border-radius:22px;
  }

  .plan-grid{
    grid-template-columns:1fr;
  }

  .plan-card.compact{
    min-height:auto;
  }

  #uiDialogModal .modal{
    padding:22px 18px 18px;
    border-radius:24px;
  }

  #uiDialogHeader{
    gap:12px;
    padding-right:44px;
  }

  #uiDialogIcon{
    width:58px;
    min-width:58px;
    height:58px;
    border-radius:17px;
  }

  #uiDialogTitle{
    font-size:21px;
  }

  #uiDialogCancelBtn,
  #uiDialogOkBtn{
    width:100%;
  }

  #uiDialogModal #uiDialogActions{
    flex-direction:column-reverse;
    align-items:stretch !important;
  }
}

/* ===== PLAN CARDS GRID ===== */

.plans-grid{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  margin-bottom:14px;
}

.plan-card-mini{
  background:rgba(255,255,255,.04);
  border:1px solid var(--border);
  border-radius:14px;
  padding:14px 16px;
  width:180px;
  min-width:160px;
  display:flex;
  flex-direction:column;
  gap:4px;
  transition:border-color .18s, background .18s;
}

.plan-card-mini:hover{
  border-color:rgba(99,153,255,.45);
  background:rgba(99,153,255,.06);
}

.plan-card-mini-name{
  font-family:var(--font-display);
  font-size:15px;
  font-weight:normal;
  letter-spacing:.5px;
  color:var(--text);
  margin-bottom:2px;
}

.plan-card-mini-dur{
  font-size:12px;
  color:var(--text-muted);
}

.plan-card-mini-price{
  font-size:18px;
  font-weight:800;
  color:#4ade80;
  margin:4px 0;
}

.plan-card-mini-status{
  font-size:11px;
  font-weight:600;
  border-radius:20px;
  padding:2px 8px;
  display:inline-block;
  width:fit-content;
}

.plan-card-mini-status.active{
  background:rgba(74,222,128,.12);
  color:#4ade80;
  border:1px solid rgba(74,222,128,.25);
}

.plan-card-mini-status.inactive{
  background:rgba(239,68,68,.12);
  color:#f87171;
  border:1px solid rgba(239,68,68,.25);
}

.plan-card-mini-actions{
  display:flex;
  flex-direction:row;
  gap:6px;
  margin-top:10px;
  flex-wrap:nowrap;
}

.plan-card-mini-add{
  border-style:dashed;
  border-color:rgba(99,153,255,.35);
  color:var(--text-muted);
  cursor:pointer;
  align-items:center;
  justify-content:center;
  text-align:center;
  min-height:110px;
  transition:border-color .18s, color .18s, background .18s;
}

.plan-card-mini-add:hover{
  border-color:var(--primary);
  color:var(--text);
  background:rgba(99,153,255,.08);
}

/* ===== DARK / LIGHT MODE ===== */
[data-theme="light"]{
  --primary:#1A56DB;
  --primary-light:#3B75F5;
  --primary-soft:#7DA8FF;
  --accent:#1d4ed8;
  --glow:rgba(26,86,219,.15);

  --bg:#f0f4f8;
  --surface:#ffffff;
  --surface2:#e8edf4;
  --surface3:#dde4ef;
  --border:#c5d0e0;

  --text:#0f172a;
  --text-muted:#475569;

  --success:#15803d;
  --danger:#b91c1c;
  --warning:#b45309;

  --shadow-xl:0 30px 80px rgba(0,0,0,.12);
  --shadow-lg:0 18px 45px rgba(0,0,0,.08);
  --shadow-md:0 10px 24px rgba(0,0,0,.06);
}

[data-theme="light"] body{
  background:var(--bg);
  color:var(--text);
}

[data-theme="light"] .navbar{
  background:rgba(255,255,255,.96);
  border-bottom:1px solid var(--border);
}

[data-theme="light"] .login-card{
  background:#ffffff;
  box-shadow:0 20px 60px rgba(0,0,0,.12);
}

[data-theme="light"] input,
[data-theme="light"] select,
[data-theme="light"] textarea{
  background:var(--surface2) !important;
  color:var(--text) !important;
  border-color:var(--border) !important;
}

[data-theme="light"] .card{
  background:var(--surface);
  border-color:var(--border);
}

[data-theme="light"] #toast{
  background:#ffffff;
  border-color:var(--border);
  color:var(--text);
}

/* Tabs: fondo oscuro → texto claro en ambos temas */
[data-theme="light"] .tabs{
  background:rgba(15,25,48,.88);
}
[data-theme="light"] .tab{
  color:rgba(237,243,255,.7);
}
[data-theme="light"] .tab.active{
  color:#fff;
  background:rgba(35,53,86,.98);
}
[data-theme="light"] .tab:hover{
  color:#fff;
}

/* Tabla headers */
[data-theme="light"] thead tr{
  background:linear-gradient(180deg,rgba(28,42,69,.98) 0%,rgba(21,33,55,.98) 100%);
}
[data-theme="light"] th{
  color:rgba(237,243,255,.85);
}

/* Navbar title */
[data-theme="light"] .navbar-title{
  color:#0f172a;
}
[data-theme="light"] .user-badge{
  background:rgba(15,25,48,.9);
  color:#fff;
}

/* Role badges remain readable */
[data-theme="light"] .role-badge{
  filter: brightness(0.9);
}

/* Modal overlays */
[data-theme="light"] .modal{
  background:#ffffff;
  color:#0f172a;
}
[data-theme="light"] .modal-overlay{
  background:rgba(0,0,0,.5);
}

/* Card titles */
[data-theme="light"] .card-title{
  color:#0f172a;
}
[data-theme="light"] .card-subtitle{
  color:#475569;
}

/* Items */
[data-theme="light"] .item{
  background:#ffffff;
  border-color:var(--border);
}
[data-theme="light"] .item-title{
  color:#0f172a;
}
[data-theme="light"] .item-meta{
  color:#475569;
}

/* Table rows */
[data-theme="light"] td{
  color:#0f172a;
  border-color:var(--border);
}
[data-theme="light"] tr:hover td{
  background:rgba(26,86,219,.05);
}

/* Stat boxes */
[data-theme="light"] .stat-box{
  background:#ffffff;
  border-color:var(--border);
}
[data-theme="light"] .stat-value{
  color:#0f172a;
}
[data-theme="light"] .stat-label{
  color:#475569;
}

/* ===== TIMER EXPIRED PULSE (panel cajero) ===== */
@keyframes expiredPulse{
  0%,100%{ box-shadow:0 0 0 0 rgba(239,68,68,0); border-color:rgba(239,68,68,.4); }
  50%{ box-shadow:0 0 0 8px rgba(239,68,68,.2); border-color:rgba(239,68,68,.9); }
}
.timer-expired-pulse{
  animation: expiredPulse 1.4s ease-in-out infinite;
  border-left:4px solid #ef4444 !important;
}


/* ===== TIMERS PANEL — GRID 3 COLUMNAS ===== */

.timers-grid{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:14px;
}

@media(max-width:1100px){
  .timers-grid{ grid-template-columns: repeat(2, 1fr); }
}
@media(max-width:680px){
  .timers-grid{ grid-template-columns: 1fr; }
}

.timer-panel-card{
  background:
    linear-gradient(180deg, rgba(26,39,63,.94) 0%, rgba(19,31,51,.98) 100%);
  border:1px solid color-mix(in srgb, var(--border) 84%, white 16%);
  border-radius:18px;
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:10px;
  transition:border-color .18s, box-shadow .18s;
}

.timer-panel-card:hover{
  border-color:rgba(99,153,255,.4);
  box-shadow:0 6px 20px rgba(0,0,0,.2);
}

.tpc-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.tpc-name{
  font-family:var(--font-display);
  font-weight:normal;
  font-size:15px;
  letter-spacing:.5px;
  color:var(--text);
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.tpc-meta{
  display:flex;
  flex-direction:column;
  gap:3px;
  font-size:12px;
  color:var(--text-muted);
}

.tpc-meta span{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.tpc-actions{
  display:flex;
  gap:8px;
  margin-top:2px;
}

.tpc-actions .btn{
  flex:1;
}


/* ===== EXTRA TIME BUTTONS ===== */
.extra-time-btn{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  background:linear-gradient(180deg,rgba(26,39,63,.95) 0%,rgba(18,29,49,.98) 100%);
  border:1px solid var(--border);
  border-radius:16px;
  padding:16px 12px;
  cursor:pointer;
  transition:transform .15s, border-color .15s, background .15s;
  color:var(--text);
}
.extra-time-btn:hover{
  transform:translateY(-3px);
  border-color:rgba(99,153,255,.5);
  background:linear-gradient(180deg,rgba(35,52,86,.98) 0%,rgba(26,40,68,.98) 100%);
}
.et-label{
  font-family:var(--font-display);
  font-size:15px;
  font-weight:700;
  letter-spacing:.5px;
}
.et-price{
  font-size:20px;
  font-weight:800;
  color:#4ade80;
  font-family:var(--font-display);
}


/* ===== TIMER ADDED CELEBRATION ===== */
@keyframes celebPop{
  from{ opacity:0; transform:scale(.6); }
  to{   opacity:1; transform:scale(1); }
}