/* ============================================================
   FieldWO — TERREN
   Bojë mbi letër të ngrohtë. Pa gradiente, pa shkëlqime, pa neon.
   Thellësia vjen nga shtresimi i sipërfaqeve dhe kufij të hollë.
   Çdo çift ngjyrash është llogaritur me luminancën relative të WCAG 2.1;
   numrat te komentet janë raportet reale.
   ============================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    color-scheme: dark;

    /* ---------- Tipografia (stack sistemi — Inter s'u ngarkua kurrë) ---------- */
    --font-ui: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    --font-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";

    --fs-11: 0.6875rem;  --fs-12: 0.75rem;    --fs-13: 0.8125rem;
    --fs-15: 0.9375rem;  --fs-17: 1.0625rem;  --fs-20: 1.25rem;
    --fs-26: 1.625rem;

    --lh-tight: 1.25;  --lh-dense: 1.4;  --lh-ui: 1.45;
    --lh-msg: 1.55;    --lh-meta: 1.35;
    --track-caps: 0.08em;

    /* ---------- Hapësira (hap 4px) ---------- */
    --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
    --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

    /* ---------- Forma ---------- */
    --r1: 6px; --r2: 8px; --r3: 12px; --r4: 16px; --r-full: 999px;

    /* ---------- Struktura ---------- */
    --rail: 232px;  --list: 340px;  --head: 52px;
    --measure: 62ch;  --prose: 68ch;

    /* ---------- Lëvizja ---------- */
    --t-fast: 120ms;  --t: 180ms;
    --ease: cubic-bezier(0.2, 0.6, 0.35, 1);

    /* ---------- Sipërfaqet: grafit i ngrohtë ---------- */
    --bg:            #1A1917;
    --bg-sunken:     #121110;
    --surface:       #242220;
    --surface-2:     #2C2926;
    --surface-3:     #35312D;

    /* ---------- Kufijtë ---------- */
    --hair:          #2A2724;
    --border:        #332F2B;
    --border-strong: #4E4841;
    --field-border:  #8A8178;   /* 4.15:1 mbi surface — WCAG 1.4.11 */

    /* ---------- Teksti ---------- */
    --text:          #EDE9E3;   /* 14.53 mbi bg — AAA */
    --text-2:        #B6AFA6;   /*  8.09 mbi bg — AAA */
    --text-3:        #A8A198;   /*  6.87 mbi bg — AA kudo */
    --text-4:        #706A62;   /*  vetëm 'disabled' */

    /* ---------- Theksi: një i vetëm, blu i shuar ---------- */
    --accent:        #8AB4D8;   /* 8.03 mbi bg — AAA */
    --accent-hover:  #A6C7E4;
    --accent-quiet:  #1E2A34;
    --accent-line:   #3B5872;
    --accent-ink:    #0F1F2B;

    /* ---------- Semantika: e shurdhët me qëllim ---------- */
    --ok:     #7FA982;  --ok-quiet:     #1B2620;
    --warn:   #D2A257;  --warn-quiet:   #2B241A;
    --danger: #DC8C82;  --danger-quiet: #301F1E;

    /* ---------- Fokus, hije ---------- */
    --focus-ring: 0 0 0 3px rgba(138,180,216,.30);
    --sh-1: 0 1px 2px rgba(0,0,0,.42);
    --sh-2: 0 4px 12px rgba(0,0,0,.34);
    --shadow-pop: 0 12px 32px -10px rgba(0,0,0,.55), 0 2px 6px -2px rgba(0,0,0,.40);
    --select: rgba(138,180,216,.24);

    /* Aliase për kodin ekzistues — hiqen kur të riemërtohen klasat */
    --primary: var(--accent);
    --primary-light: var(--accent-hover);
    --secondary: var(--ok);
    --success: var(--ok);
    --white: var(--text);
    --text-soft: var(--text-2);
    --text-muted: var(--text-3);
    --text-dim: var(--text-4);
    --border-2: var(--border-strong);
    --border-brand: var(--accent-line);
    --grad: var(--accent);
    --r-sm: var(--r2); --r: var(--r3); --r-lg: var(--r4);
}


/* ---------- Tema e çelët: letër e ngrohtë, kurrë #fff si sfond faqeje ---------- */
:root[data-theme="light"] {
    color-scheme: light;
    --bg:            #F7F4EF;
    --bg-sunken:     #EDE9E1;
    --surface:       #FFFDF9;
    --surface-2:     #F1EDE5;
    --surface-3:     #E7E2D8;
    --hair:          #EAE5DB;
    --border:        #E2DCD2;
    --border-strong: #C6BDAF;
    --field-border:  #7E766A;
    --text:          #22201D;
    --text-2:        #55504A;
    --text-3:        #645D56;
    --text-4:        #918A80;
    --accent:        #2F5D7C;
    --accent-hover:  #24485F;
    --accent-quiet:  #DFEAF4;
    --accent-line:   #9FB9CE;
    --accent-ink:    #FFFFFF;
    --ok:     #3F6B4A;  --ok-quiet:     #E6EFE7;
    --warn:   #7A5514;  --warn-quiet:   #F4EAD6;
    --danger: #A4423C;  --danger-quiet: #F7E6E4;
    --focus-ring: 0 0 0 3px rgba(47,93,124,.24);
    --sh-1: 0 1px 2px rgba(58,48,34,.07);
    --sh-2: 0 4px 12px rgba(58,48,34,.09);
    --shadow-pop: 0 12px 32px -12px rgba(58,48,34,.24), 0 2px 5px -2px rgba(58,48,34,.14);
    --select: rgba(47,93,124,.18);
}

body {
    font-family: var(--font-ui);
    font-size: var(--fs-15);
    line-height: var(--lh-ui);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100svh;
}

a { color: var(--primary-light); }
svg { display: block; }

::selection { background: var(--select); color: var(--text); }
:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 2px; border-radius: 4px; }

/* ---------- Shell ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.85rem clamp(1rem, 4vw, 2rem);
    background: var(--bg);
    border-bottom: 1px solid var(--hair);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    color: var(--white);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.brand-mark {
    position: relative;
    width: 20px; height: 20px;
    flex-shrink: 0;
}
.brand-mark::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--grad);
    border-radius: 5px;
    transform: rotate(45deg);
    box-shadow: none;
}
.brand-mark::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 5px; height: 5px;
    background: var(--bg);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.topbar-spacer { flex: 1; }

.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.82rem;
    color: var(--text-soft);
}

.avatar {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--grad);
    color: #08080f;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 600;
    flex-shrink: 0;
}

.topnav { display: flex; gap: 0.25rem; flex-wrap: wrap; }

.topnav a {
    padding: 0.4rem 0.8rem;
    border-radius: var(--r2);
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--t);
}
.topnav a:hover { color: var(--white); background: var(--surface-2); }
.topnav a.on { color: var(--white); background: var(--surface-2); }

/* ---------- Layout ---------- */
.wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: clamp(1.2rem, 4vw, 2.4rem) clamp(1rem, 4vw, 2rem);
}

.wrap-narrow { max-width: 460px; }

.page-title {
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--white);
    margin-bottom: 0.4rem;
}

.page-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.8rem; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: clamp(1.3rem, 3vw, 2rem);
    box-shadow: 0 30px 70px -45px rgba(0, 0, 0, 0.9);
}

.card + .card { margin-top: 1rem; }

.card-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-weight: 600;
}

/* ---------- Forms ---------- */
.field { position: relative; margin-bottom: 1.6rem; }

.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 0.8rem 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-2);
    color: var(--white);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
    resize: none;
}

.field label {
    position: absolute;
    top: 0.8rem; left: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
    transition: var(--t);
}

.field input:focus ~ label,
.field input:not(:placeholder-shown) ~ label,
.field textarea:focus ~ label,
.field textarea:not(:placeholder-shown) ~ label {
    top: -0.7rem;
    font-size: 0.66rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--primary-light);
}

.field .line {
    position: absolute;
    bottom: 0; left: 0;
    width: 0; height: 1.5px;
    background: var(--grad);
    border-radius: 2px;
    transition: width 0.4s var(--ease);
}
.field input:focus ~ .line,
.field textarea:focus ~ .line { width: 100%; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.6rem;
    border-radius: var(--r2);
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: var(--t);
}

.btn-primary {
    background: var(--grad);
    color: #08080f;
    box-shadow: 0 20px 46px -24px rgba(124, 92, 255, 0.9);
}
.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; transform: none; }

.btn-ghost {
    background: var(--surface);
    color: var(--white);
    border-color: var(--border-2);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-brand); }

.btn-block { width: 100%; }
.btn-sm { padding: 0.55rem 1.1rem; font-size: 0.82rem; }

.alert {
    padding: 0.8rem 1rem;
    border-radius: var(--r-sm);
    font-size: 0.85rem;
    margin-bottom: 1.2rem;
    animation: pop 0.35s var(--ease);
}
.alert-error   { background: rgba(255, 107, 138, 0.1); color: var(--danger);  border: 1px solid rgba(255, 107, 138, 0.3); }
.alert-ok      { background: rgba(52, 211, 153, 0.1);  color: var(--success); border: 1px solid rgba(52, 211, 153, 0.3); }
.alert-info    { background: rgba(124, 92, 255, 0.1);  color: var(--primary-light); border: 1px solid var(--border-brand); }

@keyframes pop {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-foot {
    margin-top: 1.4rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.privacy-note {
    margin-top: 1.2rem;
    padding: 0.8rem 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.55;
}

/* ---------- Chat ---------- */
.chat-shell {
    display: flex;
    flex-direction: column;
    height: calc(100svh - 140px);
    min-height: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.chat-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    flex-shrink: 0;
}

.chat-head h2 { font-size: 0.95rem; font-weight: 600; color: var(--white); letter-spacing: -0.015em; }

.chat-head .sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.dot-live {
    width: 6px; height: 6px;
    background: var(--ok);
    border-radius: 50%;
    box-shadow: none;
    animation: blink 2s var(--ease) infinite;
}
@keyframes blink { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.6;transform:scale(1.3)} }

.chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border-2) transparent;
}
.chat-log::-webkit-scrollbar { width: 5px; }
.chat-log::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

.msg {
    max-width: min(78%, 560px);
    padding: 0.65rem 0.9rem;
    border-radius: 15px;
    font-size: 0.88rem;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    animation: msgin 0.35s var(--ease) both;
}
@keyframes msgin { from{opacity:0;transform:translateY(8px) scale(.97)} to{opacity:1;transform:none} }
.msg.mine {
    align-self: flex-end;
    background: rgba(124, 92, 255, 0.16);
    border: 1px solid rgba(124, 92, 255, 0.28);
    color: var(--text);
    border-bottom-right-radius: 5px;
}

.msg.theirs {
    align-self: flex-start;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-bottom-left-radius: 5px;
}

.msg .meta { opacity: 0.55; }

.msg .meta {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.65rem;
    opacity: 0.72;
    text-align: right;
}

.chat-empty {
    margin: auto;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    padding: 2rem 1rem;
}

.chat-compose {
    display: flex;
    align-items: flex-end;
    gap: 0.55rem;
    padding: 0.75rem 0.9rem;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
    flex-shrink: 0;
}

.chat-compose textarea {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 0.65rem 1rem;
    color: var(--white);
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    resize: none;
    max-height: 120px;
    min-height: 42px;
    transition: border-color 0.3s;
}
.chat-compose textarea:focus { border-color: var(--border-brand); }
.chat-compose textarea::placeholder { color: var(--text-dim); }

.send-btn {
    width: 36px; height: 36px;
    border-radius: var(--r2);
    border: none;
    background: var(--grad);
    color: #08080f;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--t);
}
.send-btn { box-shadow: none; }
.send-btn:hover { transform: scale(1.05); }
.send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.send-btn svg { width: 17px; height: 17px; }

/* ---------- Tables (admin) ---------- */
.tbl-wrap { overflow-x: auto; border-radius: var(--r-sm); }

table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }

th {
    text-align: left;
    padding: 0.7rem 0.8rem;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    font-weight: 600;
}

td {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid var(--hair);
    color: var(--text-soft);
    vertical-align: top;
}

tbody tr { transition: background 0.25s; }
tbody tr:hover { background: var(--surface-2); }

.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.78rem; }
.muted { color: var(--text-dim); }
.nowrap { white-space: nowrap; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: var(--r2);
    font-size: 0.68rem;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text-soft);
    border: 1px solid var(--border);
}
.badge-ok    { background: rgba(52, 211, 153, 0.12); color: var(--success); border-color: rgba(52,211,153,.3); }
.badge-warn  { background: rgba(255, 138, 92, 0.12); color: #ff8a5c; border-color: rgba(255,138,92,.3); }
.badge-err   { background: rgba(255, 107, 138, 0.12); color: var(--danger); border-color: rgba(255,107,138,.3); }
.badge-brand { background: rgba(124, 92, 255, 0.14); color: var(--primary-light); border-color: var(--border-brand); }

.thread-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.85rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    text-decoration: none;
    color: inherit;
    transition: var(--t);
    margin-bottom: 0.5rem;
}
.thread-row:hover { border-color: var(--border-brand); background: var(--surface); transform: translateX(3px); }

.thread-main { flex: 1; min-width: 0; }
.thread-name { font-size: 0.9rem; font-weight: 600; color: var(--white); }
.thread-last {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pill-count {
    min-width: 20px; height: 20px;
    padding: 0 6px;
    background: var(--accent);
    color: var(--accent-ink);
    border-radius: var(--r-full);
    font-size: 0.68rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.searchbar { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.searchbar input {
    flex: 1;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r2);
    padding: 0.6rem 1rem;
    color: var(--white);
    font-family: inherit;
    font-size: 0.86rem;
    outline: none;
}
.searchbar input:focus { border-color: var(--border-brand); }

.paging { display: flex; gap: 0.3rem; flex-wrap: wrap; margin-top: 1rem; justify-content: center; }
.paging a, .paging span {
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
    font-size: 0.8rem;
    text-decoration: none;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.paging a:hover { color: var(--white); border-color: var(--border-brand); }
.paging .current { background: var(--grad); color: #08080f; border-color: transparent; font-weight: 600; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.8rem; margin-bottom: 1.2rem; }
.stat-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 1rem;
}
.stat-box b { display: block; font-size: 1.5rem; font-weight: 600; color: var(--white); letter-spacing: -0.02em; }
.stat-box span { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }

@media (max-width: 620px) {
    .chat-shell { height: calc(100svh - 120px); border-radius: var(--r); }
    .msg { max-width: 88%; }
    .topnav a { padding: 0.35rem 0.6rem; font-size: 0.78rem; }
    .topbar-user span.name { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Statistika gjeografike ---------- */
.geo-row {
    display: grid;
    grid-template-columns: 32px minmax(120px, 1.4fr) 3fr 48px 44px;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--hair);
}
.geo-row:last-child { border-bottom: none; }

.geo-flag { font-size: 1.35rem; line-height: 1; text-align: center; }

.geo-name {
    font-size: 0.88rem;
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.geo-name small { font-weight: 400; font-size: 0.74rem; }

.geo-bar {
    height: 7px;
    background: var(--surface-3);
    border-radius: 4px;
    overflow: hidden;
}
.geo-bar > span {
    display: block;
    height: 100%;
    background: var(--grad);
    border-radius: 4px;
    box-shadow: none;
    animation: geo-grow 0.9s var(--ease) both;
}
@keyframes geo-grow { from { width: 0 !important; } }

.geo-num {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 0.82rem;
    color: var(--white);
    text-align: right;
    font-weight: 600;
}
.geo-pct { font-size: 0.76rem; color: var(--text-muted); text-align: right; }

/* Sparkline ditore */
.spark {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 130px;
    padding-top: 0.5rem;
}
.spark-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 5px;
}
.spark-bar {
    width: 100%;
    max-width: 34px;
    background: var(--grad);
    border-radius: 4px 4px 2px 2px;
    opacity: 0.85;
    transition: opacity 0.25s, transform 0.25s var(--ease);
    transform-origin: bottom;
    animation: spark-in 0.7s var(--ease) both;
}
.spark-col:hover .spark-bar { opacity: 1; transform: scaleX(1.12); }
@keyframes spark-in { from { transform: scaleY(0); opacity: 0; } }

.spark-lbl { font-size: 0.66rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }

@media (max-width: 620px) {
    .geo-row { grid-template-columns: 26px minmax(90px, 1fr) 2fr 38px; }
    .geo-pct { display: none; }
}


/* Flluskat e bisedës */
/* Butoni i temës */
.theme-btn {
    width: 32px; height: 32px;
    border-radius: var(--r2);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--t);
}
.theme-btn:hover {
    color: var(--white);
    border-color: var(--border-brand);
}

/* ---------- Rreshtat e diagnostikës ---------- */
.diag-row {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--hair);
}
.diag-row:last-child { border-bottom: none; }

.diag-mark {
    width: 24px; height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}
.diag-mark.ok  { background: rgba(52, 211, 153, 0.16); color: var(--success); }
.diag-mark.bad { background: rgba(255, 107, 138, 0.16); color: var(--danger); }

.diag-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.diag-main strong { font-size: 0.88rem; color: var(--white); font-weight: 600; }
.diag-main small { font-size: 0.78rem; color: var(--text-muted); word-break: break-word; }

.push-status {
    display: block;
    margin-top: 0.7rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.push-status.ok  { color: var(--success); }
.push-status.bad { color: var(--danger); }

/* Rresht i vogël nën formë — informues, jo pengues */
.fineprint {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.74rem;
    color: var(--text-dim);
}
.fineprint a { color: var(--text-muted); text-decoration: underline; text-underline-offset: 2px; }
.fineprint a:hover { color: var(--primary-light); }

.priv-list { list-style: none; display: flex; flex-direction: column; gap: 0.7rem; }
.priv-list li {
    position: relative;
    padding-left: 1.4rem;
    font-size: 0.9rem;
    color: var(--text-soft);
    line-height: 1.6;
}
.priv-list li::before {
    content: '';
    position: absolute;
    left: 0; top: 0.6em;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--grad);
}

/* Lidhje e qetë (p.sh. "kam harruar fjalëkalimin") */
.link-quiet {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: var(--t);
}
.link-quiet:hover { color: var(--primary-light); border-bottom-color: currentColor; }

/* Fuqia e fjalëkalimit */
.pw-meter {
    height: 4px;
    background: var(--surface-3);
    border-radius: 3px;
    overflow: hidden;
    margin-top: -0.6rem;
}
.pw-bar {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 3px;
    background: var(--danger);
    transition: width 0.35s var(--ease), background 0.35s;
}
.pw-bar[data-level="3"] { background: #d99a2b; }
.pw-bar[data-level="4"],
.pw-bar[data-level="5"] { background: var(--success); }

.pw-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

/* ---------- Numra që nuk kërcejnë ---------- */
td, th, .msg-meta, .stat-box b, .geo-num, .spark-lbl,
.pill-count, .thread-time, .paging, .mono, .kpi-value {
    font-variant-numeric: tabular-nums;
}

::selection { background: var(--select); color: var(--text); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: var(--r1);
}

/* Fushat: kufi që plotëson WCAG 1.4.11, pa vijë gradient që animohet */
.field input, .field textarea, .field select {
    border-bottom: 1px solid var(--field-border);
}
.field input:focus, .field textarea:focus {
    border-bottom-color: var(--accent);
    box-shadow: 0 1px 0 0 var(--accent);
}
.field .line { display: none; }

/* ============================================================
   Biseda — flluska të qeta, ndarës ditësh, emoji
   ============================================================ */
.body-chat .wrap-chat {
    max-width: 900px;
    padding: var(--s4) var(--s4) 0;
}

.chat-shell {
    display: flex;
    flex-direction: column;
    height: calc(100svh - var(--head) - var(--s5));
    min-height: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r4);
    overflow: hidden;
}

.chat-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: var(--s3);
    padding: var(--s3) var(--s4);
    background: var(--surface);
    border-bottom: 1px solid var(--hair);
}
.chat-head-meta { display: flex; flex-direction: column; gap: 1px; }
.chat-head h2 {
    font-size: var(--fs-15);
    font-weight: 600;
    letter-spacing: -0.011em;
    color: var(--text);
}
.chat-head .sub {
    font-size: var(--fs-12);
    color: var(--text-3);
    display: inline-flex;
    align-items: center;
    gap: var(--s1);
}
.avatar-team { background: var(--accent); color: var(--accent-ink); }

.chat-log {
    flex: 1;
    overflow-y: auto;
    padding: var(--s4);
    display: flex;
    flex-direction: column;
    gap: var(--s1);
    background: var(--bg-sunken);
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}
.chat-log::-webkit-scrollbar { width: 8px; }
.chat-log::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--r-full);
    border: 2px solid transparent;
    background-clip: content-box;
}

/* Ndarësi i ditës */
.day-sep {
    display: flex;
    align-items: center;
    gap: var(--s3);
    margin: var(--s4) 0 var(--s2);
}
.day-sep::before, .day-sep::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--hair);
}
.day-sep span {
    font-size: var(--fs-11);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--track-caps);
    color: var(--text-3);
}

/* Flluskat */
.msg {
    max-width: min(var(--measure), 34rem);
    padding: var(--s2) var(--s3);
    border-radius: var(--r3);
    border: 1px solid transparent;
    animation: msg-in 0.22s var(--ease) both;
}
@keyframes msg-in { from { opacity: 0; transform: translateY(4px); } }

.msg.mine {
    align-self: flex-end;
    background: var(--accent-quiet);
    border-color: var(--accent-line);
    border-bottom-right-radius: var(--r1);
}
.msg.theirs {
    align-self: flex-start;
    background: var(--surface);
    border-color: var(--border);
    border-bottom-left-radius: var(--r1);
}

.msg-text {
    display: block;
    font-size: var(--fs-15);
    line-height: var(--lh-msg);
    color: var(--text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.msg-meta {
    display: block;
    margin-top: 3px;
    font-size: var(--fs-11);
    line-height: var(--lh-meta);
    color: var(--text-3);
    text-align: right;
}

/* Vetëm emoji → i madh, pa flluskë */
.msg.emoji-only { background: none; border-color: transparent; padding: 2px var(--s1); }
.msg.emoji-only .msg-text { font-size: 2.125rem; line-height: 1.15; font-family: var(--font-emoji); }

/* Gjendjet */
.msg.pending { opacity: 0.58; }
.msg.failed { background: var(--danger-quiet); border-color: var(--danger); }
.msg.failed .msg-meta { color: var(--danger); }
.msg.mine.lexuar .msg-meta::after { content: ' · Lexuar'; color: var(--text-3); }

/* Zona e shkrimit */
.chat-compose {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    gap: var(--s2);
    padding: var(--s3) var(--s4) calc(var(--s3) + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--hair);
}
.chat-compose textarea {
    flex: 1;
    min-height: 38px;
    max-height: 140px;
    padding: var(--s2) var(--s3);
    background: var(--bg-sunken);
    color: var(--text);
    border: 1px solid var(--field-border);
    border-radius: var(--r2);
    font: 400 var(--fs-15)/var(--lh-ui) var(--font-ui);
    resize: none;
    outline: none;
    transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.chat-compose textarea:focus { border-color: var(--accent); box-shadow: var(--focus-ring); }
.chat-compose textarea::placeholder { color: var(--text-3); }
@media (max-width: 620px) { .chat-compose textarea { font-size: 1rem; } }

.compose-btn {
    width: 36px; height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    background: none;
    border: 0;
    border-radius: var(--r2);
    color: var(--text-3);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.compose-btn svg { width: 20px; height: 20px; }
.compose-btn:hover { background: var(--surface-3); color: var(--text-2); }
.compose-btn.active { background: var(--accent-quiet); color: var(--accent); }

.send-btn {
    display: grid;
    place-items: center;
    border: 0;
    background: var(--accent);
    color: var(--accent-ink);
    cursor: pointer;
    flex: 0 0 36px;
    transition: background var(--t-fast) var(--ease);
}
.send-btn:hover:not(:disabled) { background: var(--accent-hover); }
.send-btn:disabled { background: var(--surface-3); color: var(--text-4); cursor: default; }

/* Paneli i emoji-ve */
.emoji-panel {
    position: absolute;
    bottom: calc(100% + var(--s2));
    left: var(--s4);
    width: min(336px, calc(100vw - 2 * var(--s4)));
    max-height: 300px;
    overflow-y: auto;
    padding: var(--s2);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r3);
    box-shadow: var(--shadow-pop);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity var(--t) var(--ease), transform var(--t) var(--ease), visibility var(--t);
    z-index: 30;
}
.emoji-panel.open { opacity: 1; visibility: visible; transform: none; }

.emoji-grup {
    position: sticky;
    top: 0;
    background: var(--surface);
    padding: var(--s2) var(--s2) var(--s1);
    font-size: var(--fs-11);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: var(--track-caps);
    color: var(--text-3);
}
.emoji-rrjet { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-btn {
    width: 36px; height: 36px;
    font-family: var(--font-emoji);
    font-size: 1.35rem;
    line-height: 1;
    background: none;
    border: 0;
    border-radius: var(--r1);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease);
}
.emoji-btn:hover { background: var(--surface-3); }

/* Gjendja bosh */
.chat-empty {
    margin: auto;
    max-width: 42ch;
    text-align: center;
    padding: var(--s6) var(--s4);
}
.chat-empty-icon { font-size: 2rem; display: block; margin-bottom: var(--s3); opacity: .8; }
.chat-empty strong { display: block; font-size: var(--fs-17); font-weight: 600; color: var(--text); }
.chat-empty p { margin-top: var(--s2); font-size: var(--fs-15); color: var(--text-2); }

@media (max-width: 620px) {
    .body-chat .wrap-chat { padding: 0; }
    .chat-shell { height: calc(100svh - var(--head)); border: 0; border-radius: 0; }
    .msg { max-width: 88%; }
}
