/* ===== II-TABLICA: kartochka-svodka v soobschenii + modalka tablicy ===== */
/* Perem. base.css: --accent, --text, --text-secondary, --border, --bubble-other, --bg. */

.aya-exp-host { display: block; margin: 2px 0; }

.aya-exp-card {
    box-sizing: border-box;
    max-width: min(340px, 84vw);
    background: var(--bubble-other, #fff);
    border: 1px solid var(--border, rgba(0,56,65,.1));
    border-radius: 16px;
    padding: 12px;
    color: var(--text, #1A1D21);
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.aya-exp-loading { color: var(--text-secondary, #65676B); font-size: 14px; text-align: center; padding: 16px 8px; }

.aya-exp-card-title { font-weight: 700; font-size: 15px; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.aya-exp-card-n { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--text-secondary, #65676B); }

.aya-exp-card-tot { display: flex; flex-wrap: wrap; gap: 8px 12px; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.aya-exp-inc { color: #1a9e5f; }
.aya-exp-exp { color: #e0553d; }
.aya-exp-bal { color: var(--text, #1A1D21); }
.aya-exp-bal.neg { color: #e0553d; }

.aya-exp-open-btn {
    appearance: none; border: none; border-radius: 10px; padding: 9px 12px; width: 100%;
    font-size: 13px; font-weight: 600; cursor: pointer;
    background: var(--accent, #ff8c42); color: #fff; line-height: 1;
}
.aya-exp-open-btn:active { transform: scale(.98); }

/* --- knopka «Таблица» v kompozere (kak list-btn-mobile) --- */
.expense-btn-mobile {
    flex: 0 0 auto; width: 38px; height: 38px; border: none; background: transparent;
    font-size: 20px; line-height: 1; cursor: pointer; padding: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; color: var(--text, #1A1D21);
}
.expense-btn-mobile:active { background: var(--border, rgba(0,0,0,.06)); }

/* --- modalka tablicy --- */
.aya-exp-modal-ov { position: fixed; inset: 0; z-index: 4200; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.aya-exp-modal {
    width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
    background: var(--bg, #fff); color: var(--text, #1A1D21);
    border-radius: 18px 18px 0 0; padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 24px rgba(0,0,0,.2);
}
.aya-exp-m-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.aya-exp-m-title { font-weight: 700; font-size: 17px; flex: 1 1 auto; }
.aya-exp-m-close {
    appearance: none; border: none; background: transparent; cursor: pointer;
    font-size: 18px; color: var(--text-secondary, #65676B); padding: 4px 6px; flex: 0 0 auto;
}

/* pereklyuchatel tablic */
.aya-exp-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.aya-exp-tab {
    flex: 0 0 auto; appearance: none; border: 1px solid var(--border, rgba(0,56,65,.14)); border-radius: 999px;
    padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
    background: var(--bubble-other, #fff); color: var(--text, #1A1D21); white-space: nowrap;
}
.aya-exp-tab.active { background: var(--accent, #ff8c42); color: #fff; border-color: var(--accent, #ff8c42); }
.aya-exp-tab-new { font-size: 16px; padding: 6px 12px; }

/* itogi */
.aya-exp-totals { display: flex; gap: 8px; margin-bottom: 12px; }
.aya-exp-tot-box {
    flex: 1 1 0; box-sizing: border-box; border-radius: 12px; padding: 10px; text-align: center;
    background: var(--bubble-other, #f4f5f6); border: 1px solid var(--border, rgba(0,56,65,.08));
}
.aya-exp-tot-box span { display: block; font-size: 11px; color: var(--text-secondary, #65676B); margin-bottom: 3px; }
.aya-exp-tot-box b { font-size: 15px; }
.aya-exp-tot-box.inc b { color: #1a9e5f; }
.aya-exp-tot-box.exp b { color: #e0553d; }
.aya-exp-tot-box.bal.neg b { color: #e0553d; }

/* razbivka po kategoriyam */
.aya-exp-break { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.aya-exp-chip {
    font-size: 12px; padding: 4px 9px; border-radius: 999px;
    background: var(--border, rgba(0,56,65,.06)); color: var(--text-secondary, #65676B);
}

/* tablica strok */
.aya-exp-rows { display: flex; flex-direction: column; }
.aya-exp-row {
    display: grid; grid-template-columns: 52px 1fr 1.3fr auto auto; gap: 6px; align-items: center;
    padding: 8px 2px; border-bottom: 1px solid var(--border, rgba(0,56,65,.07)); font-size: 13px;
}
.aya-exp-row-h { font-weight: 700; color: var(--text-secondary, #65676B); font-size: 11px; text-transform: uppercase; }
.aya-exp-row .c-date { color: var(--text-secondary, #65676B); font-size: 11px; }
.aya-exp-row .c-cat { font-weight: 600; }
.aya-exp-row .c-desc { color: var(--text-secondary, #65676B); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aya-exp-row .c-sum { font-weight: 700; text-align: right; white-space: nowrap; }
.aya-exp-row .c-sum.inc { color: #1a9e5f; }
.aya-exp-row .c-sum.exp { color: #e0553d; }
.aya-exp-row .c-act { display: flex; gap: 2px; }
.aya-exp-rbtn {
    appearance: none; border: none; background: transparent; cursor: pointer;
    font-size: 13px; color: var(--text-secondary, #65676B); padding: 2px 4px; opacity: .6;
}
.aya-exp-rbtn:active { opacity: 1; }
.aya-exp-empty { color: var(--text-secondary, #65676B); font-size: 13px; text-align: center; padding: 16px 8px; }

/* dejstviya modalki */
.aya-exp-m-actions { display: flex; gap: 8px; margin-top: 14px; }
.aya-exp-abtn {
    flex: 1 1 0; appearance: none; border: none; border-radius: 12px; padding: 11px;
    font-size: 14px; font-weight: 600; cursor: pointer; background: var(--accent, #ff8c42); color: #fff;
}
.aya-exp-abtn.secondary { background: var(--border, rgba(0,56,65,.1)); color: var(--text, #1A1D21); }
.aya-exp-abtn:active { transform: scale(.98); }

/* spisok chatov pri pereslke */
.aya-exp-fwd-list { display: flex; flex-direction: column; gap: 8px; }
.aya-exp-fwd-target {
    appearance: none; text-align: left; border: 1px solid var(--border, rgba(0,56,65,.1)); border-radius: 12px;
    padding: 12px 14px; font-size: 15px; font-weight: 600; cursor: pointer;
    background: var(--bubble-other, #fff); color: var(--text, #1A1D21);
}
.aya-exp-fwd-target:active { transform: scale(.99); }

/* spisok ZAKREPLYONNYH tablic (openPinned) */
.aya-exp-pin-list { display: flex; flex-direction: column; gap: 8px; }
.aya-exp-pin-target {
    display: flex; flex-direction: column; gap: 6px; text-align: left;
    appearance: none; border: 1px solid var(--border, rgba(0,56,65,.1)); border-radius: 12px;
    padding: 12px 14px; cursor: pointer;
    background: var(--bubble-other, #fff); color: var(--text, #1A1D21); width: 100%;
}
.aya-exp-pin-target:active { transform: scale(.99); }
.aya-exp-pin-name { font-size: 15px; font-weight: 600; }
.aya-exp-pin-tot { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; font-weight: 600; }
body.dark-theme .aya-exp-pin-target { background: #222b35; }

/* forma redaktirovaniya stroki */
.aya-exp-edit-ov { position: fixed; inset: 0; z-index: 4300; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.aya-exp-edit {
    width: 100%; max-width: 380px; background: var(--bg, #fff); color: var(--text, #1A1D21);
    border-radius: 16px; padding: 18px 16px; box-shadow: 0 8px 30px rgba(0,0,0,.3);
}
.aya-exp-edit-title { font-weight: 700; font-size: 16px; margin-bottom: 14px; text-align: center; }
.aya-exp-f { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 12px; color: var(--text-secondary, #65676B); }
.aya-exp-f input, .aya-exp-f select {
    box-sizing: border-box; border: 1px solid var(--border, rgba(0,56,65,.14)); border-radius: 10px;
    padding: 9px 10px; font-size: 15px; font-family: inherit; background: var(--bg, #fff); color: var(--text, #1A1D21);
}
.aya-exp-f input:focus, .aya-exp-f select:focus { outline: none; border-color: var(--accent, #ff8c42); }
.aya-exp-edit-btns { display: flex; gap: 8px; margin-top: 6px; }

/* --- tyomnaya tema --- */
body.dark-theme .aya-exp-modal { background: #161D27; }
body.dark-theme .aya-exp-edit { background: #161D27; }
body.dark-theme .aya-exp-tab { background: #222b35; }
body.dark-theme .aya-exp-tot-box { background: #1c2530; }
body.dark-theme .aya-exp-fwd-target { background: #222b35; }
body.dark-theme .aya-exp-f input, body.dark-theme .aya-exp-f select { background: #1c2530; }
