/* ═══════════════════ Encryption · Signal ═══════════════════
   Brings the encrypt/decrypt tool onto the Signal design system (signal.css).
   Presentation only: every id, name, endpoint and inline script in the
   templates is preserved — these rules restyle, they never drive behaviour.
   Scoped under .sg, loaded after signal.css. No clip-path. */

/* ── Hero ────────────────────────────────────────────────────────────── */
.sg .en-hero { position: relative; padding: clamp(2.8rem, 7vw, 4.8rem) 0 1.4rem; overflow: hidden; }
.sg .en-hero::before {
    content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background: radial-gradient(55% 45% at 50% 0%, rgba(52,211,153,.13), transparent 70%);
    mask: linear-gradient(180deg, #000, transparent 92%);
}
.sg .en-hero > .sg-shell { position: relative; z-index: 1; text-align: center; }
.sg .en-title { font-family: var(--display); font-weight: 800; letter-spacing: -.03em; line-height: .98;
    font-size: clamp(2.2rem, 5.2vw, 3.8rem); margin: 0 0 1rem; }
.sg .en-title b { color: var(--green); font-weight: 800; }
.sg .en-sub { color: var(--muted); max-width: 40rem; margin: 0 auto 1.3rem; line-height: 1.6; font-size: clamp(1rem, 1.6vw, 1.15rem); }
.sg .en-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: .9rem; color: var(--muted); font-size: .82rem; }
.sg .en-pills span { display: inline-flex; align-items: center; gap: .4rem; }
.sg .en-pills i { color: var(--green); }
.sg .en-credit { text-align: center; margin: 0 auto 1.6rem; color: var(--dim); font-size: .82rem;
    display: inline-flex; align-items: center; gap: .45rem; border: 1px solid var(--line); background: rgba(255,255,255,.02);
    padding: .5rem .9rem; border-radius: 999px; }
.sg .en-credit i { color: var(--green); }
.sg .en-credit b { color: var(--muted); font-weight: 600; }
.sg .en-credit-wrap { text-align: center; }

/* ── Tabs ────────────────────────────────────────────────────────────── */
.sg .en-tabs { display: flex; justify-content: center; margin-bottom: 1.6rem; }
.sg .en-tabs-inner { display: inline-flex; gap: .3rem; padding: .3rem; border: 1px solid var(--line-2);
    background: var(--panel); border-radius: 999px; }
.sg .en-tab { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1.2rem; border-radius: 999px;
    border: 0; background: none; color: var(--muted); font: 600 .9rem/1 var(--body); cursor: pointer; transition: color .2s, background .2s; }
.sg .en-tab i { font-size: .85rem; }
.sg .en-tab:hover { color: var(--ink); }
.sg .en-tab.is-active { background: rgba(52,211,153,.14); color: var(--green); }

/* ── Studio grid ─────────────────────────────────────────────────────── */
.sg .en-grid { display: grid; grid-template-columns: 1fr; gap: 1.2rem; }
@media (min-width: 900px) { .sg .en-grid { grid-template-columns: 1fr 1fr; } }

/* ── Panel ───────────────────────────────────────────────────────────── */
.sg .en-panel { border: 1px solid var(--line-2); background: var(--panel); border-radius: var(--r);
    padding: clamp(1.1rem, 2.5vw, 1.5rem); transition: border-color .25s; }
.sg .en-panel:hover { border-color: rgba(52,211,153,.35); }
.sg .en-panel-head { display: flex; align-items: center; gap: .7rem; font-family: var(--display); font-weight: 700;
    font-size: 1.1rem; color: var(--ink); margin: 0 0 1.1rem; }
.sg .en-panel-ic { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: .6rem;
    background: rgba(52,211,153,.14); flex-shrink: 0; }
.sg .en-panel-ic i { color: var(--green); }
.sg .en-panel.dec .en-panel-ic { background: rgba(45,212,191,.14); }
.sg .en-panel.dec .en-panel-ic i { color: var(--cyan); }

/* ── Form fields ─────────────────────────────────────────────────────── */
.sg .en-field { margin-bottom: 1rem; }
.sg .en-flabel { display: block; font: 600 .7rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
    color: var(--dim); margin: 0 0 .5rem; }
.sg .en-panel textarea, .sg .en-panel select,
.sg .en-panel input[type="text"], .sg .en-panel input[type="password"] {
    width: 100%; padding: .85rem 1rem; border-radius: calc(var(--r) - 8px);
    border: 1px solid var(--line-2); background: rgba(255,255,255,.03); color: var(--ink);
    font: 400 .95rem/1.5 var(--body); outline: none; transition: border-color .2s, box-shadow .2s;
    -webkit-appearance: none; appearance: none; }
.sg .en-panel textarea { min-height: 7rem; resize: vertical; font-family: var(--mono); font-size: .88rem; }
.sg .en-panel select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237c8a84' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 1rem center; padding-right: 2.6rem; }
.sg .en-panel textarea::placeholder, .sg .en-panel input::placeholder { color: var(--dim); }
.sg .en-panel textarea:focus, .sg .en-panel select:focus, .sg .en-panel input:focus {
    border-color: var(--green); box-shadow: 0 0 0 4px rgba(52,211,153,.14); }
/* the raw file inputs are hidden — the drop zone is the UI */
.sg #file-input, .sg #decrypt-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.sg .en-submit { width: 100%; justify-content: center; margin-top: .4rem; }
.sg .en-submit:disabled { opacity: .5; cursor: not-allowed; }

/* ── Drop zone ───────────────────────────────────────────────────────── */
.sg .en-drop { border: 1.5px dashed var(--line-2); border-radius: calc(var(--r) - 6px); padding: 2rem 1rem;
    text-align: center; cursor: pointer; transition: border-color .2s, background .2s; }
.sg .en-drop:hover, .sg .en-drop.is-drag { border-color: var(--green); background: rgba(52,211,153,.06); }
.sg .en-drop .big { font-size: 2.2rem; color: var(--green); margin-bottom: .6rem; }
.sg .en-drop .t { color: var(--ink); font-weight: 600; margin: 0; }
.sg .en-drop .s { color: var(--dim); font-size: .8rem; margin: .3rem 0 0; }
.sg .en-fileinfo { margin-top: 1rem; display: inline-flex; align-items: center; gap: .5rem; color: var(--green);
    background: rgba(52,211,153,.1); border: 1px solid rgba(52,211,153,.3); padding: .5rem .9rem; border-radius: 999px; font-size: .85rem; }
.sg .en-fileinfo .sz { color: var(--dim); }

/* ── Results ─────────────────────────────────────────────────────────── */
.sg .en-result { margin-top: 1.3rem; display: flex; flex-direction: column; gap: 1rem; }
.sg .en-outbox { border: 1px solid rgba(52,211,153,.3); background: rgba(52,211,153,.04); border-radius: calc(var(--r) - 6px); padding: 1rem; }
.sg .en-outbox.key { border-color: rgba(245,196,81,.35); background: rgba(245,196,81,.05); }
.sg .en-outbox-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.sg .en-outbox-top label { font: 600 .72rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--green); display: inline-flex; align-items: center; gap: .35rem; }
.sg .en-outbox.key .en-outbox-top label { color: var(--warm); }
.sg .en-copy { background: none; border: 0; color: var(--green); font-size: .78rem; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; }
.sg .en-copy:hover { color: var(--ink); }
.sg .en-copy.ok { color: var(--green); }
.sg .en-out { width: 100%; background: #04070c; border: 1px solid var(--line); border-radius: calc(var(--r) - 10px);
    padding: .75rem .9rem; color: var(--ink); font: 400 .82rem/1.5 var(--mono); resize: none; outline: none; word-break: break-all; }
.sg .en-warn { color: var(--warm); font-size: .76rem; margin: .6rem 0 0; display: flex; align-items: flex-start; gap: .4rem; }
.sg .en-stats { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; color: var(--dim); font-size: .76rem; font-family: var(--mono); }
.sg .en-stats #encrypt-algo, .sg .en-stats #decrypt-algo { color: var(--green); }
.sg .en-dl { width: 100%; justify-content: center; }
.sg .en-ok-line { display: inline-flex; align-items: center; gap: .4rem; color: var(--green); font: 600 .82rem/1 var(--mono); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .8rem; }

/* ── Algorithms grid ─────────────────────────────────────────────────── */
.sg .en-algos { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.sg .en-algo { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); padding: 1.2rem; transition: border-color .25s, transform .25s; }
.sg .en-algo:hover { border-color: rgba(52,211,153,.4); transform: translateY(-2px); }
.sg .en-algo-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .8rem; }
.sg .en-algo-ic { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: .6rem; background: rgba(255,255,255,.05); flex-shrink: 0; }
.sg .en-algo-ic i { color: var(--dim); }
.sg .en-algo.rec .en-algo-ic { background: rgba(52,211,153,.14); }
.sg .en-algo.rec .en-algo-ic i { color: var(--green); }
.sg .en-algo h3 { font-family: var(--display); font-size: .98rem; margin: 0; color: var(--ink); }
.sg .en-algo-rec { display: inline-block; margin-top: .25rem; font: 600 .6rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
    color: var(--green); background: rgba(52,211,153,.14); padding: .25rem .5rem; border-radius: 999px; }
.sg .en-algo p { color: var(--muted); font-size: .84rem; line-height: 1.5; margin: 0 0 .8rem; }
.sg .en-algo-foot { display: flex; align-items: center; justify-content: space-between; font-size: .76rem; }
.sg .en-algo-foot .ks { color: var(--dim); font-family: var(--mono); }
.sg .en-algo-foot .auth { color: var(--green); display: inline-flex; align-items: center; gap: .3rem; }

/* ── Security notice ─────────────────────────────────────────────────── */
.sg .en-sec { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); padding: clamp(1.3rem, 3vw, 1.8rem); }
.sg .en-sec h3 { font-family: var(--display); font-size: 1.15rem; margin: 0 0 1.2rem; display: flex; align-items: center; gap: .5rem; }
.sg .en-sec h3 i { color: var(--green); }
.sg .en-sec-grid { display: grid; grid-template-columns: 1fr; gap: 1.2rem; }
@media (min-width: 720px) { .sg .en-sec-grid { grid-template-columns: repeat(3, 1fr); } }
.sg .en-sec-item { display: flex; gap: .8rem; align-items: flex-start; }
.sg .en-sec-item > i { color: var(--green); margin-top: .2rem; }
.sg .en-sec-item h4 { font-family: var(--display); font-size: .95rem; margin: 0 0 .25rem; color: var(--ink); }
.sg .en-sec-item p { color: var(--muted); font-size: .85rem; line-height: 1.5; margin: 0; }

/* ── Support banner ──────────────────────────────────────────────────── */
.sg .en-support { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
    border: 1px solid rgba(52,211,153,.3); border-radius: var(--r);
    background: linear-gradient(135deg, rgba(52,211,153,.08), rgba(52,211,153,.01)); padding: 1.3rem clamp(1.2rem,3vw,1.8rem); }
.sg .en-support .l { display: flex; align-items: center; gap: 1rem; }
.sg .en-support-ic { display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: .7rem; background: rgba(52,211,153,.14); flex-shrink: 0; }
.sg .en-support-ic i { color: var(--green); font-size: 1.1rem; }
.sg .en-support h3 { font-family: var(--display); font-size: 1.05rem; margin: 0; }
.sg .en-support p { color: var(--muted); font-size: .85rem; margin: .2rem 0 0; }

/* ── Error toast (showError) ─────────────────────────────────────────── */
.sg-en-toast { position: fixed; left: 50%; bottom: 1.3rem; transform: translateX(-50%); z-index: 90;
    display: inline-flex; align-items: center; gap: .5rem; padding: .85rem 1.2rem; border-radius: 999px;
    background: #2a1113; border: 1px solid rgba(248,113,113,.5); color: #fca5a5; font-size: .88rem;
    box-shadow: 0 20px 50px -20px rgba(0,0,0,.8); max-width: calc(100vw - 2rem); }
.sg-en-toast i { color: #f87171; }

/* ═══════════════════ Dashboard ═══════════════════ */
.sg .en-dash-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.6rem; }
.sg .en-dash-head h1 { font-family: var(--display); font-weight: 800; font-size: clamp(1.7rem, 3.5vw, 2.4rem); margin: 0; display: flex; align-items: center; gap: .6rem; }
.sg .en-dash-head h1 i { color: var(--green); }
.sg .en-dash-head p { color: var(--muted); margin: .4rem 0 0; font-size: .92rem; }
.sg .en-stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
@media (min-width: 820px) { .sg .en-stats-grid { grid-template-columns: repeat(4, 1fr); } }
.sg .en-stat { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); padding: 1.2rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.sg .en-stat-l { color: var(--dim); font-size: .78rem; margin: 0 0 .25rem; }
.sg .en-stat-v { font-family: var(--display); font-weight: 800; font-size: 1.8rem; color: var(--ink); line-height: 1; margin: 0; }
.sg .en-stat-ic { display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: .7rem; background: rgba(52,211,153,.12); flex-shrink: 0; }
.sg .en-stat-ic i { color: var(--green); }
.sg .en-cols { display: grid; grid-template-columns: 1fr; gap: 1.1rem; margin-bottom: 1.5rem; }
@media (min-width: 900px) { .sg .en-cols { grid-template-columns: 1fr 2fr; } }
.sg .en-dash-panel { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); padding: 1.3rem; }
.sg .en-dash-panel h3 { font-family: var(--display); font-size: 1.05rem; margin: 0 0 1.1rem; display: flex; align-items: center; gap: .5rem; }
.sg .en-dash-panel h3 i { color: var(--green); }
.sg .en-usagerow { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; }
.sg .en-usagerow:last-child { margin-bottom: 0; }
.sg .en-usagerow .k { color: var(--muted); font-size: .82rem; text-transform: uppercase; font-family: var(--mono); }
.sg .en-usagerow .v { display: flex; align-items: center; gap: .7rem; }
.sg .en-usagerow .meter { width: 5rem; height: .4rem; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden; }
.sg .en-usagerow .meter i { display: block; height: 100%; background: var(--green); }
.sg .en-usagerow .n { color: var(--ink); font-weight: 600; min-width: 1.5rem; text-align: right; }
.sg table.en-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.sg table.en-table th { text-align: left; color: var(--dim); font: 600 .7rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: .6rem .5rem; border-bottom: 1px solid var(--line-2); }
.sg table.en-table td { padding: .7rem .5rem; color: var(--ink); border-bottom: 1px solid var(--line); vertical-align: middle; }
.sg table.en-table tr:last-child td { border-bottom: 0; }
.sg .en-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .55rem; border-radius: 999px; font: 600 .68rem/1 var(--mono); }
.sg .en-chip.enc { background: rgba(45,212,191,.14); color: var(--cyan); }
.sg .en-chip.dec { background: rgba(52,211,153,.14); color: var(--green); }
.sg .en-dash-empty { text-align: center; padding: 2.5rem 1rem; }
.sg .en-dash-empty i { font-size: 2rem; color: var(--dim); display: block; margin-bottom: .8rem; }
.sg .en-dash-empty p { color: var(--muted); margin: 0 0 1.2rem; }
