/* ENDISM client panel — works inside endism.tr (site.css) and standalone on the license server. */
#endism-panel, .ep-overlay, .ep-toasts {
  --ep-bg: #050912;
  --ep-card: rgba(255, 255, 255, .04);
  --ep-card-2: rgba(255, 255, 255, .065);
  --ep-line: rgba(255, 255, 255, .09);
  --ep-line-2: rgba(255, 255, 255, .16);
  --ep-text: #eef3fa;
  --ep-text-2: #c9d3e1;
  --ep-muted: #8f9db2;
  --ep-green: #1be27f;
  --ep-cyan: #38bdf8;
  --ep-amber: #fbbf24;
  --ep-rose: #fb7185;
  --ep-r: 22px;
  color: var(--ep-text);
  font-size: 15.5px;
  line-height: 1.6;
}
#endism-panel *, #endism-panel *::before, #endism-panel *::after,
.ep-overlay *, .ep-toasts * { box-sizing: border-box; }
.ep-ico { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; }
.ep-ico svg { width: 100%; height: 100%; }

/* Cards & layout */
.ep-card {
  position: relative; border: 1px solid var(--ep-line); border-radius: var(--ep-r);
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .018));
  padding: 26px; min-width: 0;
}
.ep-card h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.ep-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.ep-card-head p { margin: 4px 0 0; color: var(--ep-muted); font-size: 14px; }
.ep-dash { display: grid; gap: 22px; animation: ep-in .45s cubic-bezier(.2, .7, .1, 1); }
.ep-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.ep-span-2 { grid-column: span 2; }
.ep-span-3 { grid-column: span 3; }
@keyframes ep-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Buttons */
.ep-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 46px; padding: 0 20px; border-radius: 999px; border: 1px solid transparent;
  font: 600 15px/1 inherit; font-family: inherit; color: var(--ep-text); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .2s, background .2s, border-color .2s, box-shadow .2s, opacity .2s;
}
.ep-btn:hover:not(:disabled) { transform: translateY(-1px); }
.ep-btn:disabled { opacity: .45; cursor: not-allowed; }
.ep-btn-sm { height: 38px; padding: 0 14px; font-size: 14px; }
.ep-btn-block { width: 100%; }
.ep-btn-primary { background: linear-gradient(135deg, #3bf297, var(--ep-green) 45%, #00c853); color: #03140a; box-shadow: 0 10px 28px -12px rgba(27, 226, 127, .6), inset 0 1px 0 rgba(255, 255, 255, .35); }
.ep-btn-ghost { background: var(--ep-card); border-color: var(--ep-line-2); }
.ep-btn-ghost:hover:not(:disabled) { background: var(--ep-card-2); }
.ep-btn-danger { background: var(--ep-rose); color: #2a0610; }
.ep-btn-danger-ghost { background: rgba(251, 113, 133, .08); border-color: rgba(251, 113, 133, .3); color: #fecdd3; }
.ep-btn-danger-ghost:hover:not(:disabled) { background: rgba(251, 113, 133, .14); }
.ep-btn.is-loading { opacity: .85; cursor: progress; }
.ep-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(3, 20, 10, .3); border-top-color: #03140a; animation: ep-spin .7s linear infinite; }
@keyframes ep-spin { to { transform: rotate(360deg); } }
.ep-icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--ep-line); background: transparent;
  color: var(--ep-text-2); display: inline-grid; place-items: center; cursor: pointer; transition: background .2s, color .2s, border-color .2s;
}
.ep-icon-btn:hover:not(:disabled) { background: var(--ep-card-2); color: var(--ep-text); border-color: var(--ep-line-2); }
.ep-icon-danger:hover:not(:disabled) { color: var(--ep-rose); border-color: rgba(251, 113, 133, .4); background: rgba(251, 113, 133, .08); }
.ep-icon-btn:disabled { opacity: .35; cursor: not-allowed; }
#endism-panel :focus-visible, .ep-overlay :focus-visible { outline: 2px solid var(--ep-green); outline-offset: 2px; }

/* Login */
.ep-login { max-width: 470px; margin: 0 auto; padding: 38px 34px 30px; text-align: center; animation: ep-in .45s cubic-bezier(.2, .7, .1, 1); }
.ep-login::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px 180px at 50% 0%, rgba(27, 226, 127, .16), transparent 70%);
}
.ep-login-mark {
  width: 64px; height: 64px; margin: 0 auto 20px; border-radius: 20px; display: grid; place-items: center;
  color: var(--ep-green); background: rgba(27, 226, 127, .1); border: 1px solid rgba(27, 226, 127, .25);
  box-shadow: 0 0 40px -6px rgba(27, 226, 127, .45);
}
.ep-login-mark .ep-ico { width: 30px; height: 30px; }
.ep-login-title { margin: 0 0 10px; font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.ep-login-sub { margin: 0 0 26px; color: var(--ep-muted); font-size: 15px; }
.ep-login-form { display: grid; gap: 10px; text-align: start; }
.ep-field { display: grid; gap: 8px; }
.ep-field-label { font-size: 13.5px; font-weight: 600; color: var(--ep-text-2); }
.ep-input-wrap { position: relative; display: flex; align-items: center; }
.ep-input {
  width: 100%; height: 54px; border-radius: 16px; border: 1px solid var(--ep-line-2); background: rgba(3, 7, 15, .6);
  color: var(--ep-text); font: 500 16px/1 inherit; font-family: inherit; padding: 0 16px; transition: border-color .2s, box-shadow .2s;
}
.ep-input:focus { outline: none; border-color: rgba(27, 226, 127, .6); box-shadow: 0 0 0 4px rgba(27, 226, 127, .14); }
.ep-input-key { padding: 0 52px; letter-spacing: .14em; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 17px; text-align: left; direction: ltr; }
.ep-input-key::placeholder { letter-spacing: .14em; color: #4a5568; }
.ep-input-wrap { direction: ltr; }
.ep-input-icon { position: absolute; left: 17px; color: var(--ep-muted); pointer-events: none; }
.ep-input-btn {
  position: absolute; right: 8px; width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent;
  color: var(--ep-muted); cursor: pointer; display: grid; place-items: center;
}
.ep-input-btn:hover { color: var(--ep-text); background: var(--ep-card-2); }
.ep-help { margin: 0 0 6px; color: var(--ep-muted); font-size: 13px; }
.ep-alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px;
  background: rgba(251, 113, 133, .08); border: 1px solid rgba(251, 113, 133, .3); color: #fecdd3; font-size: 14px;
}
.ep-alert[hidden] { display: none; }
.ep-alert .ep-ico { margin-top: 2px; color: var(--ep-rose); }
.ep-login-form .ep-btn { margin-top: 8px; height: 52px; font-size: 16px; }
.ep-login-note { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 22px 0 0; color: var(--ep-muted); font-size: 13px; }
.ep-login-note .ep-ico { width: 15px; height: 15px; color: var(--ep-green); }

/* Header */
.ep-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ep-eyebrow { display: block; color: var(--ep-green); font-size: 12.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 8px; }
html[lang="fa"] .ep-eyebrow { letter-spacing: 0; text-transform: none; }
.ep-head-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ep-key { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: clamp(20px, 3vw, 28px); font-weight: 600; letter-spacing: .08em; color: var(--ep-text); }
.ep-head-actions { display: flex; gap: 10px; }
.ep-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid; }
.ep-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent); }
.ep-pill-active { color: var(--ep-green); border-color: rgba(27, 226, 127, .3); background: rgba(27, 226, 127, .08); }
.ep-pill-unused { color: var(--ep-amber); border-color: rgba(251, 191, 36, .3); background: rgba(251, 191, 36, .08); }
.ep-pill-expired, .ep-pill-deactivated { color: var(--ep-rose); border-color: rgba(251, 113, 133, .3); background: rgba(251, 113, 133, .08); }

/* License */
.ep-license { display: grid; grid-template-columns: auto 1fr; gap: 30px; align-items: center; }
.ep-ring { position: relative; width: 150px; height: 150px; }
.ep-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ep-ring-track { fill: none; stroke: rgba(255, 255, 255, .07); stroke-width: 10; }
.ep-ring-fill { fill: none; stroke: var(--ep-green); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2, .7, .1, 1); filter: drop-shadow(0 0 8px rgba(27, 226, 127, .5)); }
.ep-ring-expired .ep-ring-fill, .ep-ring-deactivated .ep-ring-fill { stroke: var(--ep-rose); filter: none; }
.ep-ring-unused .ep-ring-fill { stroke: var(--ep-amber); filter: none; }
.ep-ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ep-ring-center b { font-size: 38px; font-weight: 700; line-height: 1; letter-spacing: -.03em; }
.ep-ring-center span { color: var(--ep-muted); font-size: 12.5px; margin-top: 4px; }
.ep-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.ep-stat { display: grid; gap: 4px; min-width: 0; }
.ep-stat-label { color: var(--ep-muted); font-size: 13px; }
.ep-stat-value { font-size: 16.5px; font-weight: 600; overflow-wrap: anywhere; }
.ep-meter-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.ep-meter { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; }
.ep-meter span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ep-green), var(--ep-cyan)); transition: width .8s cubic-bezier(.2, .7, .1, 1); }

/* Devices */
.ep-devices { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ep-device {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 16px;
  border: 1px solid var(--ep-line); background: rgba(255, 255, 255, .025); transition: border-color .2s, background .2s;
}
.ep-device:hover { border-color: var(--ep-line-2); background: rgba(255, 255, 255, .04); }
.ep-device-ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none; color: var(--ep-cyan); background: rgba(56, 189, 248, .1); }
.ep-device-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.ep-device-name { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep-device-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--ep-muted); font-size: 12.5px; }
.ep-device-meta code { font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--ep-text-2); }
.ep-device-actions { display: flex; gap: 6px; flex: none; }
.ep-empty { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 28px 12px; color: var(--ep-muted); border: 1px dashed var(--ep-line-2); border-radius: 16px; }
.ep-empty .ep-ico { width: 30px; height: 30px; color: var(--ep-cyan); }
.ep-empty p { margin: 0; max-width: 360px; }
.ep-note { display: flex; gap: 9px; align-items: flex-start; margin: 16px 0 0; color: var(--ep-muted); font-size: 13.5px; }
.ep-note .ep-ico { width: 16px; height: 16px; margin-top: 2px; color: var(--ep-green); }
.ep-note-warn, .ep-note-warn .ep-ico { color: #fcd34d; }

/* Security & activity */
.ep-big-stat { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
.ep-big-stat b { font-size: 34px; font-weight: 700; line-height: 1; }
.ep-big-stat span { color: var(--ep-muted); font-size: 14px; }
.ep-activity { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; max-height: 340px; overflow: auto; padding-inline-end: 4px; }
.ep-activity li { display: grid; grid-template-columns: 10px 1fr; gap: 12px; }
.ep-activity li > div { display: grid; gap: 1px; min-width: 0; }
.ep-activity b { font-size: 14px; font-weight: 600; }
.ep-act-detail { color: var(--ep-text-2); font-size: 13px; overflow-wrap: anywhere; }
.ep-act-meta { color: var(--ep-muted); font-size: 12.5px; }
.ep-act-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; background: var(--ep-cyan); box-shadow: 0 0 0 4px rgba(56, 189, 248, .12); }
.ep-act-device_removed, .ep-act-devices_reset { background: var(--ep-rose); box-shadow: 0 0 0 4px rgba(251, 113, 133, .12); }
.ep-act-login { background: var(--ep-green); box-shadow: 0 0 0 4px rgba(27, 226, 127, .12); }
.ep-act-device_renamed { background: var(--ep-amber); box-shadow: 0 0 0 4px rgba(251, 191, 36, .12); }
.ep-muted { color: var(--ep-muted); margin: 0; }
.ep-help-card { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
  background: radial-gradient(500px 160px at 0% 0%, rgba(27, 226, 127, .12), transparent 70%), linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .018)); }
.ep-help-card p { margin: 4px 0 0; color: var(--ep-muted); }

/* Skeleton */
.ep-skel { border-radius: var(--ep-r); background: linear-gradient(90deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .08), rgba(255, 255, 255, .04)); background-size: 200% 100%; animation: ep-shimmer 1.3s infinite; }
.ep-skel-bar { height: 70px; max-width: 420px; }
.ep-skel-card { height: 220px; }
@keyframes ep-shimmer { to { background-position: -200% 0; } }

/* Dialog */
.ep-overlay {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px;
  background: rgba(2, 5, 12, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: ep-fade .18s ease;
}
.ep-overlay.out { opacity: 0; transition: opacity .18s; }
@keyframes ep-fade { from { opacity: 0; } }
.ep-dialog {
  width: 100%; max-width: 440px; padding: 26px; border-radius: 22px; background: #0b1322; border: 1px solid var(--ep-line-2);
  box-shadow: 0 40px 80px -24px rgba(0, 0, 0, .9); color: var(--ep-text); display: grid; gap: 14px; animation: ep-pop .22s cubic-bezier(.2, .7, .1, 1);
}
@keyframes ep-pop { from { transform: scale(.96) translateY(8px); opacity: 0; } }
.ep-dialog h3 { margin: 0; font-size: 20px; }
.ep-dialog p { margin: 0; color: var(--ep-text-2); line-height: 1.65; }
.ep-dialog .ep-input { height: 48px; }
.ep-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; flex-wrap: wrap; }

/* Toasts */
.ep-toasts { position: fixed; z-index: 300; inset-inline: 0; bottom: 22px; display: grid; justify-items: center; gap: 10px; pointer-events: none; padding: 0 16px; }
.ep-toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 14px; max-width: 480px;
  background: #0f1b2e; border: 1px solid rgba(27, 226, 127, .3); color: #eef3fa; font-size: 14.5px;
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, .8); animation: ep-pop .25s cubic-bezier(.2, .7, .1, 1); transition: opacity .3s, transform .3s;
}
.ep-toast .ep-ico { color: var(--ep-green); }
.ep-toast.is-error { border-color: rgba(251, 113, 133, .4); }
.ep-toast.is-error .ep-ico { color: var(--ep-rose); }
.ep-toast.out { opacity: 0; transform: translateY(8px); }

/* Responsive */
@media (max-width: 960px) {
  .ep-grid { grid-template-columns: minmax(0, 1fr); }
  .ep-span-2, .ep-span-3 { grid-column: auto; }
}
@media (max-width: 620px) {
  .ep-card { padding: 20px; }
  .ep-login { padding: 30px 20px 24px; }
  .ep-login-title { font-size: 24px; }
  .ep-input-key, .ep-input-key::placeholder { letter-spacing: .06em; font-size: 16px; }
  .ep-input-key { padding: 0 46px; }
  .ep-license { grid-template-columns: 1fr; justify-items: center; gap: 22px; }
  .ep-license-info { width: 100%; }
  .ep-stats { grid-template-columns: 1fr 1fr; }
  .ep-device { flex-wrap: wrap; }
  .ep-device-main { flex-basis: calc(100% - 60px); }
  .ep-device-actions { width: 100%; justify-content: flex-end; }
  .ep-hide-sm { display: none; }
  .ep-head { align-items: flex-start; }
  .ep-dialog-actions .ep-btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  #endism-panel *, .ep-overlay, .ep-toast { animation: none !important; transition: none !important; }
}
