
:root{--sidebar-w:250px;--bg:#f4f7fb;--card:#fff;--line:#e3eaf3;--text:#14213a;--muted:#7c8da4;--blue:#1f6fe5}
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--text);font-family:Arial,Helvetica,sans-serif}.sidebar{width:var(--sidebar-w);position:fixed;inset:0 auto 0 0;background:linear-gradient(180deg,#142c45,#0d2034);color:#fff;padding:10px 18px 16px;display:flex;flex-direction:column}.main{margin-left:var(--sidebar-w);min-height:100vh}.brand{text-align:center;padding-bottom:10px;border-bottom:1px solid rgba(255,255,255,.13)}.coat img{width:125px;height:148px;object-fit:contain}.brand-title{font-size:20px;font-weight:800;white-space:nowrap}.brand-description{font-size:12.5px;line-height:1.45;color:#dce7f4}.sidebar nav{margin-top:16px}.menu-item{display:flex;gap:12px;padding:11px 13px;color:#dce7f4;text-decoration:none;border-radius:9px;margin-bottom:5px}.menu-item:hover{background:rgba(39,119,221,.28);color:#fff}.sidebar-version{margin-top:auto;color:#9fb0c4;font-size:11px}.topbar{height:74px;background:#fff;border-bottom:1px solid var(--line);padding:14px 22px;display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;z-index:5}.search-global{width:min(520px,55%)}.search-global input,.filter-card input,.filter-card select,.employee-form input,.employee-form select,.settings-form input,.settings-form textarea,.settings-form select{width:100%;border:1px solid #d7e0eb;background:#fff;border-radius:9px;padding:11px 12px}.topbar-user{display:flex;align-items:center;gap:12px}.topbar-name{font-weight:700}.topbar-role{font-size:12px;color:var(--muted)}.logout-btn{border:0;background:transparent;font-size:20px;color:#7b8ba0;cursor:pointer}.bell-link{position:relative;width:32px;height:32px;display:inline-flex;align-items:center;justify-content:center}.bell-icon{width:21px;height:21px;fill:none;stroke:#6f8197;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}.bell-count{position:absolute;top:0;right:0;background:#ef4444;color:#fff;border-radius:999px;font-size:9px;min-width:14px;height:14px;line-height:14px;text-align:center}.page{padding:14px 18px 20px}.toolbar{display:flex;gap:8px;align-items:center;margin-bottom:12px}.source-first select{height:38px;border:1px solid var(--line);border-radius:10px;padding:0 12px;background:#fff;font-weight:700}.status-pills{display:flex;gap:7px;flex-wrap:wrap}.filter-pill{border:1px solid var(--line);background:#fff;color:var(--text);padding:9px 11px;border-radius:10px;text-decoration:none;font-size:13px;font-weight:700}.filter-pill span{color:var(--muted);margin-left:5px}.filter-pill.active{background:var(--blue);color:#fff;border-color:var(--blue)}.filter-pill.active span{color:#fff}.filter-pill.red:not(.active){background:#fff3f4}.filter-pill.orange:not(.active){background:#fff7ed}.filter-pill.yellow:not(.active){background:#fffbea}.filter-pill.green:not(.active){background:#effaf4}.reference-workspace{display:grid;grid-template-columns:minmax(520px,1.15fr) minmax(560px,1fr);gap:12px}.appeals-list-card,.appeal-detail-card,.module-card{background:#fff;border:1px solid var(--line);border-radius:12px;overflow:hidden}.list-head,.appeal-row{display:grid;grid-template-columns:95px 105px 1.2fr 1.15fr 110px;gap:10px;align-items:center}.list-head{padding:10px 12px;background:#f8fafc;color:#6f8197;font-size:12px;font-weight:800}.appeal-row{padding:11px 12px;border-top:1px solid #edf1f6;text-decoration:none;color:var(--text);font-size:12.5px}.appeal-row.selected{background:#edf5ff}.appeals-scroll{max-height:calc(100vh - 165px);overflow:auto}.source-icon,.channel-logo{display:inline-flex;align-items:center;justify-content:center;border-radius:6px;color:#fff;font-size:8px;font-weight:900}.source-icon{width:18px;height:18px}.channel-logo{width:27px;height:27px}.source-vk,.channel-vk{background:#2787f5}.source-max,.channel-max{background:linear-gradient(145deg,#6856ff,#4379ff)}.muted-small,.detail-date-under,.empty-note{color:var(--muted);font-size:11px}.badge,.title-status{display:inline-flex;align-items:center;border-radius:999px;font-size:11px;font-weight:800}.badge{padding:6px 9px}.badge.new,.status-new{background:#ffe9ec;color:#df3f53}.badge.work,.status-work{background:#fff0df;color:#c96f00}.badge.answer,.status-answer{background:#fff4cf;color:#a87300}.badge.closed,.status-closed{background:#ddf5e8;color:#188755}.detail-top{padding:16px 18px 10px}.detail-title-row{display:flex;align-items:center;gap:12px}.detail-title{font-size:22px;font-weight:800}.title-status{padding:7px 11px;gap:6px}.title-status i,.select-dot{width:7px;height:7px;border-radius:50%;display:inline-block}.status-new i,.status-new .select-dot{background:#f33f59}.status-work i,.status-work .select-dot{background:#f18b24}.status-answer i,.status-answer .select-dot{background:#f6bd1e}.status-closed i,.status-closed .select-dot{background:#1aa66a}.detail-tabs{display:flex;gap:26px;padding:0 18px;border-bottom:1px solid var(--line)}.detail-tabs a{padding:10px 0 9px;text-decoration:none;color:#687a90;font-size:12.5px;font-weight:700;border-bottom:2px solid transparent}.detail-tabs a.active{color:var(--blue);border-bottom-color:var(--blue)}.detail-body-grid{display:grid;grid-template-columns:minmax(0,1fr) 190px;gap:14px;padding:16px 18px}.reference-info-row{display:grid;grid-template-columns:34px 118px 1fr;align-items:center;min-height:44px;border-bottom:1px solid #eef2f6}.reference-line-icon{color:#718399;font-size:20px;text-align:center}.reference-info-label{color:#718399;font-size:12.5px}.appeal-text-row{align-items:start;padding:9px 0}.section-title{margin:16px 0 8px;font-size:14px;font-weight:800}.attachment-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.attachment-card{border:1px solid var(--line);border-radius:9px;overflow:hidden;min-height:110px;background:#f8fafc;text-decoration:none;color:var(--text);display:flex;flex-direction:column;align-items:center;justify-content:center}.attachment-preview{width:100%;height:145px;object-fit:cover}.doc-icon{width:48px;height:54px;border-radius:8px;background:#ef4444;color:#fff;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:900}.doc-name{padding:7px;font-size:11px;text-align:center}.status-card-large{background:#f8fafc;border:1px solid var(--line);border-radius:12px;padding:14px}.actions-title{font-size:12px;font-weight:800;margin-bottom:9px}.actions-title.second{margin-top:16px}.status-select-wrap{display:flex;align-items:center;gap:8px;border-radius:9px;padding:0 9px;margin-bottom:8px}.status-select-wrap.status-new{background:#fff1f3}.status-select-wrap.status-work{background:#fff5e8}.status-select-wrap.status-answer{background:#fff8df}.status-select-wrap.status-closed{background:#edf9f2}.status-select{width:100%;border:0;background:transparent;padding:11px 0;font-weight:700;outline:none}.btn{border:0;border-radius:8px;padding:10px 12px;font-weight:700;cursor:pointer}.btn-blue{background:var(--blue);color:#fff}.btn-soft{background:#eef2f7;color:var(--text)}.full{width:100%}.action-link{display:block;width:100%;border:0;border-radius:8px;text-decoration:none;text-align:center;padding:10px 8px;font-size:12px;font-weight:800;margin-bottom:7px}.action-link.blue{background:#eaf3ff;color:#1764c7}.action-link.yellow{background:#fff3cd;color:#996a00}.quick-comment,.chat-compose,.employee-form{display:flex;gap:8px}.quick-comment textarea,.chat-compose textarea,.action-form textarea,.settings-form textarea{width:100%;min-height:78px;border:1px solid #dbe3ed;border-radius:9px;padding:10px}.comment-item,.chat-bubble{border:1px solid var(--line);background:#f8fafc;border-radius:9px;padding:10px;margin-top:8px;font-size:12.5px}.chat-line.outgoing{display:flex;justify-content:flex-end}.chat-line.outgoing .chat-bubble{background:#eaf3ff}.chat-meta,.comment-meta{color:var(--muted);font-size:10.5px;margin-bottom:4px}.chat-state{font-size:11px;margin-bottom:8px}.chat-state.open{color:#d97706}.module-page{max-width:1400px}.module-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}.module-head h1{margin:0;font-size:24px}.module-head p{margin:5px 0 0;color:var(--muted)}.module-head select{padding:9px;border:1px solid var(--line);border-radius:9px}.stat-cards{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;margin-bottom:12px}.stat-cards div{background:#fff;border:1px solid var(--line);border-radius:12px;padding:14px}.stat-cards span{display:block;color:var(--muted);font-size:12px}.stat-cards b{display:block;font-size:26px;margin-top:6px}.stats-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.module-card{padding:16px;margin-bottom:12px}.bar-row{display:grid;grid-template-columns:150px 1fr 40px;gap:10px;align-items:center;margin:9px 0;font-size:12px}.bar{height:9px;background:#eef2f6;border-radius:99px;overflow:hidden}.bar i{display:block;height:100%;background:var(--blue)}.filter-card{display:grid;grid-template-columns:repeat(4,1fr) auto;gap:10px;align-items:end;background:#fff;border:1px solid var(--line);border-radius:12px;padding:12px;margin-bottom:12px}.filter-card label,.settings-form label{font-size:12px;color:var(--muted)}table{width:100%;border-collapse:collapse}th,td{text-align:left;padding:10px;border-bottom:1px solid #edf1f6;font-size:12px}th{color:#6f8197;background:#f8fafc}.settings-form{display:grid;grid-template-columns:1fr 1fr;gap:12px}.settings-form h3{grid-column:1/-1}.settings-form .check,.settings-form button{grid-column:1/-1}.secret-code{display:block;padding:12px;background:#f5f7fa;border-radius:8px;letter-spacing:2px;margin:8px 0}.ok-text{color:#16814f}.notification-item{display:block;padding:12px;text-decoration:none;color:var(--text);border-bottom:1px solid #edf1f6}.notification-item.unread{background:#f2f7ff}.notification-item span{display:block;color:var(--muted);font-size:11px;margin-top:3px}.login-body{min-height:100vh;display:flex;align-items:center;justify-content:center;background:#eef3f8}.login-card{width:390px;background:#fff;border:1px solid var(--line);border-radius:16px;padding:26px;box-shadow:0 16px 50px rgba(13,32,52,.12)}.login-title{font-size:24px;font-weight:800}.login-subtitle{color:var(--muted);margin:5px 0 20px}.login-card label{display:block;font-size:12px;color:var(--muted);margin:10px 0}.login-card label span{font-weight:400}.login-card input{width:100%;border:1px solid #d7e0eb;border-radius:9px;padding:11px;margin-top:5px}.login-error{background:#fff0f2;border:1px solid #f1b8bf;padding:10px;border-radius:8px;color:#b42334}
@media(max-width:1200px){.reference-workspace,.stats-grid{grid-template-columns:1fr}.stat-cards{grid-template-columns:repeat(3,1fr)}}

/* PRIEMNAYA49 V3.0.1 */
.detail-top{
    padding:16px 18px 12px;
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap:16px;
}
.detail-heading{min-width:0}
.detail-title{font-size:22px;font-weight:800;line-height:1.08}
.detail-date-under{margin-top:4px;font-size:11px;color:var(--muted)}

.header-status-form{
    display:grid;
    grid-template-columns:auto auto;
    grid-template-areas:
      "label label"
      "select save";
    align-items:center;
    gap:6px 8px;
    min-width:295px;
}
.header-status-label{
    grid-area:label;
    font-size:11px;
    font-weight:800;
    color:#52667f;
}
.header-status-form .status-select-wrap{
    grid-area:select;
    min-width:170px;
    margin:0;
}
.header-save{
    grid-area:save;
    min-width:108px;
    height:38px;
}
.status-select-wrap{
    transition:background .15s ease,border-color .15s ease;
    border:1px solid transparent;
}
.status-select-wrap.status-new{background:#fff1f3;border-color:#ffdbe1}
.status-select-wrap.status-work{background:#fff4e6;border-color:#ffe0bd}
.status-select-wrap.status-answer{background:#fff7d8;border-color:#ffe8a3}
.status-select-wrap.status-closed{background:#edf9f2;border-color:#caefd9}
.status-new .select-dot{background:#f33f59}
.status-work .select-dot{background:#f18b24}
.status-answer .select-dot{background:#f6bd1e}
.status-closed .select-dot{background:#1aa66a}

.detail-body-grid.single{
    display:block;
    padding:16px 18px 18px;
}
.detail-body-grid.single .detail-content{
    max-width:none;
}

/* Return the citizen data block to the compact reference scale */
.reference-info-row{
    grid-template-columns:26px 112px minmax(0,1fr);
    min-height:39px;
    column-gap:5px;
}
.reference-line-icon{
    font-size:16px;
    line-height:1;
}
.reference-info-label{
    font-size:11.5px;
    line-height:1.25;
}
.reference-info-row > div:last-child{
    font-size:12.5px;
    line-height:1.35;
}
.channel-logo{
    width:24px;
    height:24px;
    border-radius:7px;
    font-size:8px;
    margin-right:5px;
}
.appeal-text-row{padding:7px 0}
.section-title{font-size:13px;margin:14px 0 7px}

/* No actions/sidebar block in the appeal card */
.detail-actions,.status-card-large{display:none!important}

@media(max-width:980px){
  .detail-top{align-items:flex-start;flex-direction:column}
  .header-status-form{width:100%;min-width:0;grid-template-columns:1fr auto}
}


/* PRIEMNAYA49 V3.0.2 */
.detail-source-icon{
    width:18px!important;
    height:18px!important;
    min-width:18px;
    min-height:18px;
    border-radius:5px;
    font-size:7px;
    margin-right:5px;
    vertical-align:middle;
}

.header-status-form{
    min-width:270px;
    grid-template-columns:170px 92px;
    gap:6px;
}

.header-status-form .status-select-wrap{
    height:34px;
    min-height:34px;
    border-radius:8px;
    padding:0 8px;
}

.header-status-form .status-select{
    height:32px;
    padding:0;
    font-size:12px;
}

.header-status-form .header-save{
    min-width:92px;
    width:92px;
    height:34px;
    min-height:34px;
    padding:0 10px;
    border-radius:8px;
    font-size:12px;
}

@media(max-width:980px){
    .header-status-form{
        width:100%;
        min-width:0;
        grid-template-columns:minmax(0,1fr) 92px;
    }
}


/* PRIEMNAYA49 V3.0.3 — compact title + history */
.detail-title{
    font-size:17px!important;
    line-height:1.15!important;
    white-space:nowrap;
    letter-spacing:-.1px;
}
.history-panel{max-width:900px}
.history-head{display:flex;justify-content:space-between;align-items:center;gap:14px;margin-bottom:13px}
.history-title{font-size:16px;font-weight:800}.history-subtitle{font-size:11.5px;color:var(--muted);margin-top:3px}
.chat-state-pill{display:inline-flex;align-items:center;gap:6px;padding:6px 9px;border-radius:999px;font-size:11px;font-weight:700}
.chat-state-pill i{width:7px;height:7px;border-radius:50%}.chat-state-pill.open{background:#edf9f2;color:#188755}.chat-state-pill.open i{background:#1aa66a}.chat-state-pill.closed{background:#f1f4f7;color:#708096}.chat-state-pill.closed i{background:#9ba9ba}
.history-thread{display:flex;flex-direction:column;gap:8px;margin-bottom:12px}.history-bubble{max-width:76%;border:1px solid var(--line);border-radius:10px;padding:10px 11px;background:#f8fafc}.chat-line.outgoing{display:flex;justify-content:flex-end}.chat-line.outgoing .history-bubble{background:#eaf3ff;border-color:#cfe2ff}
.history-meta{display:flex;gap:7px;align-items:center;font-size:10.5px;margin-bottom:4px}.history-meta span{color:var(--muted)}.history-text{font-size:12.5px;line-height:1.45;white-space:pre-wrap}
.history-empty{border:1px dashed #d8e1ec;border-radius:10px;background:#fbfcfe;padding:16px;text-align:center;color:var(--muted);font-size:11.5px}.history-empty b{display:block;color:var(--text);font-size:13px;margin-bottom:3px}.history-empty span{display:block}
.history-actions{display:grid;grid-template-columns:1fr 1fr;gap:9px}.history-action-card{border:1px solid var(--line);border-radius:10px;background:#fff;overflow:hidden}.history-action-card summary{list-style:none;display:grid;grid-template-columns:30px 1fr 16px;gap:8px;align-items:center;padding:11px;cursor:pointer}.history-action-card summary::-webkit-details-marker{display:none}.history-action-card summary:hover{background:#f8fafc}.history-action-card summary b{display:block;font-size:12.5px}.history-action-card summary small{display:block;color:var(--muted);font-size:10.5px;margin-top:2px}
.history-action-icon{width:28px;height:28px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-weight:900}.history-action-icon.blue{background:#eaf3ff;color:#1764c7}.history-action-icon.yellow{background:#fff4cf;color:#9a6a00}
.history-action-form,.history-compose-card{border-top:1px solid var(--line);padding:10px;background:#fbfcfe}.history-compose-card{border:1px solid var(--line);border-radius:10px}.history-action-form textarea,.history-compose-card textarea{width:100%;min-height:78px;border:1px solid #d8e1ec;border-radius:8px;padding:9px 10px;font:inherit;font-size:12px;resize:vertical;outline:none}
.history-form-bottom{display:flex;justify-content:space-between;align-items:center;gap:9px;margin-top:7px}.file-picker{cursor:pointer;font-size:11px}.file-picker input{position:absolute;opacity:0;width:1px;height:1px}.file-picker span{display:inline-flex;align-items:center;padding:6px 8px;border:1px solid #d7e0eb;background:#fff;border-radius:7px;color:#52677f}.history-send{height:32px;padding:0 11px;font-size:11px;border-radius:7px}
.history-close{text-align:right;margin-top:6px}.history-close button{border:0;background:transparent;color:#748398;font-size:10.5px;cursor:pointer}.history-close button:hover{color:#c2414b}
.history-file-grid{display:flex;flex-wrap:wrap;gap:6px;margin-top:7px}.history-file{width:88px;min-height:64px;border:1px solid var(--line);border-radius:7px;overflow:hidden;background:#fff;text-decoration:none;color:var(--text);display:flex;align-items:center;justify-content:center;flex-direction:column}.history-file img{width:88px;height:68px;object-fit:cover}.history-doc-icon{background:#ef4444;color:#fff;border-radius:5px;padding:6px;font-size:8px;font-weight:900}.history-file-name{font-size:9px;max-width:82px;padding:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.history-extra{margin:10px 0 12px}.history-small-title{font-size:11.5px;font-weight:800}
@media(max-width:900px){.history-actions{grid-template-columns:1fr}.history-head{align-items:flex-start;flex-direction:column}.history-bubble{max-width:92%}.detail-title{font-size:16px!important;white-space:normal}}


/* PRIEMNAYA49 V3.0.4 — compact status header */
.header-status-form{
    min-width:203px!important;
    grid-template-columns:128px 69px!important;
    gap:5px!important;
}
.header-status-label{
    font-size:10px!important;
}
.header-status-form .status-select-wrap{
    height:26px!important;
    min-height:26px!important;
    border-radius:7px!important;
    padding:0 6px!important;
}
.header-status-form .status-select{
    height:24px!important;
    font-size:10px!important;
}
.header-status-form .select-dot{
    width:6px!important;
    height:6px!important;
}
.header-status-form .header-save{
    width:69px!important;
    min-width:69px!important;
    height:26px!important;
    min-height:26px!important;
    padding:0 6px!important;
    border-radius:7px!important;
    font-size:10px!important;
}
@media(max-width:980px){
    .header-status-form{
        width:auto!important;
        min-width:203px!important;
        grid-template-columns:128px 69px!important;
    }
}


/* PRIEMNAYA49 V3.0.6 — file selection feedback + separated status controls */

/* Status field and Save must be visually separate controls */
.header-status-form{
    grid-template-columns:128px 72px!important;
    column-gap:10px!important;
    row-gap:5px!important;
}
.header-status-form .status-select-wrap{
    margin:0!important;
    border-radius:8px!important;
}
.header-status-form .header-save{
    width:72px!important;
    min-width:72px!important;
    border-radius:8px!important;
    margin:0!important;
}

/* File picker now shows what is actually attached */
.file-picker{
    display:flex!important;
    align-items:center;
    gap:7px;
    min-width:0;
    cursor:pointer;
}
.file-picker input{
    position:absolute!important;
    opacity:0!important;
    width:1px!important;
    height:1px!important;
    pointer-events:none;
}
.file-picker-button{
    display:inline-flex!important;
    align-items:center;
    flex:0 0 auto;
    padding:6px 8px!important;
    border:1px solid #d7e0eb!important;
    background:#fff!important;
    border-radius:7px!important;
    color:#52677f!important;
    font-size:11px!important;
}
.file-picker-name{
    display:block;
    max-width:220px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:10.5px;
    color:#8a98aa;
}
.file-picker.has-file .file-picker-button{
    border-color:#a9cdfd!important;
    background:#eef6ff!important;
    color:#1764c7!important;
}
.file-picker.has-file .file-picker-name{
    color:#1764c7;
    font-weight:700;
}

.history-form-bottom{
    align-items:center;
}
@media(max-width:760px){
    .history-form-bottom{
        align-items:stretch;
        flex-direction:column;
    }
    .file-picker{
        width:100%;
    }
    .file-picker-name{
        max-width:55vw;
    }
}


/* PRIEMNAYA49 V3.0.7 — journal filter alignment */
.filter-card.journal-filter{
    display:grid;
    grid-template-columns:230px 230px minmax(220px,1fr) minmax(220px,1fr) 110px;
    gap:12px;
    align-items:end;
}
.date-filter-item{
    display:grid;
    grid-template-columns:28px 1fr;
    gap:8px;
    align-items:center;
}
.inline-filter-label{
    font-size:12px;
    font-weight:700;
    color:var(--muted);
    text-align:right;
}
.date-filter-item input,
.journal-select-field select{
    height:38px;
    min-height:38px;
    border:1px solid #d7e0eb;
    border-radius:9px;
    padding:0 11px;
    background:#fff;
    width:100%;
    font:inherit;
    font-size:12px;
}
.journal-select-field{
    display:flex;
    flex-direction:column;
    gap:5px;
}
.journal-select-field > span{
    font-size:12px;
    color:var(--muted);
}
.journal-filter-btn{
    height:38px;
    min-height:38px;
    padding:0 14px;
    align-self:end;
}
@media(max-width:1100px){
    .filter-card.journal-filter{
        grid-template-columns:1fr 1fr;
    }
    .journal-filter-btn{
        width:100%;
    }
}


/* PRIEMNAYA49 V3.0.8 — separate status field and Save button */
.header-status-form{
    display:grid!important;
    grid-template-columns:150px 82px!important;
    grid-template-areas:
      "label label"
      "select save"!important;
    column-gap:14px!important;
    row-gap:5px!important;
    min-width:246px!important;
    width:auto!important;
}

.header-status-form .header-status-label{
    grid-area:label!important;
}

.header-status-form .status-select-wrap{
    grid-area:select!important;
    width:150px!important;
    min-width:150px!important;
    max-width:150px!important;
    height:30px!important;
    min-height:30px!important;
    margin:0!important;
    padding:0 8px!important;
    border-radius:8px!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
}

.header-status-form .status-select{
    width:100%!important;
    height:28px!important;
    min-height:28px!important;
    padding:0!important;
    margin:0!important;
    border:0!important;
    background:transparent!important;
    font-size:11px!important;
}

.header-status-form .header-save{
    grid-area:save!important;
    width:82px!important;
    min-width:82px!important;
    max-width:82px!important;
    height:30px!important;
    min-height:30px!important;
    margin:0!important;
    padding:0 9px!important;
    border-radius:8px!important;
    font-size:11px!important;
    box-sizing:border-box!important;
}

/* Guarantee a visible gap even if an older cached rule tries to stretch controls */
.header-status-form .status-select-wrap + .header-save{
    margin-left:0!important;
}

@media(max-width:980px){
    .header-status-form{
        grid-template-columns:150px 82px!important;
        min-width:246px!important;
        width:auto!important;
    }
}


/* PRIEMNAYA49 V3.1.0 — deadline control + calendar + colored stats */
.calendar-alert-link{position:relative;width:32px;height:32px;display:inline-flex;align-items:center;justify-content:center;text-decoration:none}.calendar-alert-icon{width:20px;height:20px;fill:none;stroke:#6f8197;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.calendar-alert-count{position:absolute;top:0;right:0;background:#f59e0b;color:#fff;border-radius:999px;font-size:9px;min-width:14px;height:14px;line-height:14px;text-align:center;font-weight:800}
.stat-cards.colored>div{position:relative;overflow:hidden}.stat-cards.colored>div:before{content:"";position:absolute;left:0;top:0;bottom:0;width:5px}.stat-total{background:#eef5ff!important}.stat-total:before{background:#2875e6}.stat-new{background:#fff1f3!important}.stat-new:before{background:#ef4760}.stat-work{background:#fff6e9!important}.stat-work:before{background:#f18b24}.stat-answer{background:#fff8df!important}.stat-answer:before{background:#f6bd1e}.stat-closed{background:#edf9f2!important}.stat-closed:before{background:#1aa66a}
.control-tab{max-width:980px}.control-head{margin-bottom:10px}.control-add-card{border:1px solid var(--line);border-radius:10px;background:#fff;margin-bottom:10px;overflow:hidden}.control-add-card summary{cursor:pointer;padding:10px 12px;font-size:12px;font-weight:800;color:#1764c7;list-style:none}.control-add-card summary::-webkit-details-marker{display:none}.control-form{border-top:1px solid var(--line);background:#fbfcfe;padding:11px;display:grid;grid-template-columns:1.4fr .8fr .8fr .8fr;gap:9px}.control-form label{font-size:10.5px;color:var(--muted);display:flex;flex-direction:column;gap:4px}.control-form input,.control-form textarea{border:1px solid #d7e0eb;border-radius:8px;padding:8px 9px;font:inherit;font-size:11px;background:#fff}.control-note{grid-column:1/-2}.control-note textarea{min-height:52px;resize:vertical}.control-save{align-self:end;height:34px;font-size:11px}.control-list{display:flex;flex-direction:column;gap:8px}.control-item{display:grid;grid-template-columns:12px minmax(0,1fr) 150px auto;gap:10px;align-items:center;border:1px solid var(--line);border-radius:10px;background:#fff;padding:11px}.control-status-dot{width:8px;height:8px;border-radius:50%;background:#9ba9ba}.urgency-green .control-status-dot,.day-controls.urgency-green i{background:#1aa66a}.urgency-yellow .control-status-dot,.day-controls.urgency-yellow i{background:#f6bd1e}.urgency-orange .control-status-dot,.day-controls.urgency-orange i{background:#f18b24}.urgency-red .control-status-dot,.day-controls.urgency-red i{background:#ef4760}.urgency-received .control-status-dot{background:#94a3b8}.control-agency{font-size:12.5px;font-weight:800}.control-meta,.control-note-text{font-size:10.5px;color:var(--muted);margin-top:3px}.control-due span{display:block;font-size:9.5px;color:var(--muted)}.control-due b{display:block;font-size:12px;margin:2px 0}.control-due em{font-size:9.5px;font-style:normal;color:#b45309}.urgency-red .control-due em{color:#c6283c}.received-label{color:#188755!important}.is-received{opacity:.72;background:#f8fafc}.control-received-form{display:flex;gap:5px;align-items:center}.control-received-form input{width:118px;border:1px solid #d7e0eb;border-radius:7px;padding:7px;font-size:10px}.control-received-form .btn{font-size:10px;padding:8px}
.calendar-layout{display:grid;grid-template-columns:minmax(650px,1.5fr) minmax(330px,.75fr);gap:12px}.calendar-card,.calendar-day-panel{background:#fff;border:1px solid var(--line);border-radius:12px;padding:14px}.calendar-nav{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.calendar-nav b{font-size:17px}.calendar-nav a{width:32px;height:32px;border-radius:8px;background:#f1f5f9;display:flex;align-items:center;justify-content:center;text-decoration:none;color:var(--text);font-size:22px}.calendar-weekdays,.calendar-grid{display:grid;grid-template-columns:repeat(7,1fr)}.calendar-weekdays span{text-align:center;color:var(--muted);font-size:10.5px;font-weight:700;padding:7px}.calendar-day{min-height:92px;border-top:1px solid #edf1f6;border-left:1px solid #edf1f6;padding:8px;text-decoration:none;color:var(--text);position:relative;background:#fff}.calendar-day:nth-child(7n){border-right:1px solid #edf1f6}.calendar-day:nth-last-child(-n+7){border-bottom:1px solid #edf1f6}.calendar-day.outside{background:#f9fbfd;color:#b6c0cd}.calendar-day.today .day-number{background:#2875e6;color:#fff}.calendar-day.selected{box-shadow:inset 0 0 0 2px #2875e6}.day-number{width:25px;height:25px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:800}.day-controls{display:flex;align-items:center;gap:5px;margin-top:12px;padding:5px 6px;border-radius:7px;background:#f6f8fb;font-size:9.5px;font-weight:700}.day-controls i{width:6px;height:6px;border-radius:50%;background:#94a3b8}.calendar-panel-title{font-size:16px;font-weight:800;margin-bottom:10px}.calendar-control-row{display:grid;grid-template-columns:10px minmax(0,1fr) auto;gap:8px;align-items:center;text-decoration:none;color:var(--text);border:1px solid var(--line);border-radius:9px;padding:10px;margin-bottom:7px}.calendar-control-row b{display:block;font-size:11px}.calendar-control-row strong{display:block;font-size:11.5px;margin-top:2px}.calendar-control-row small{display:block;color:var(--muted);font-size:9.5px;margin-top:2px}.calendar-control-state{font-size:9.5px;font-weight:800;color:#7c8da4;text-align:right}.calendar-control-row.urgency-red .calendar-control-state{color:#c6283c}.calendar-control-row.urgency-orange .calendar-control-state{color:#c96f00}.calendar-control-row.urgency-yellow .calendar-control-state{color:#9a6a00}.calendar-control-row.urgency-green .calendar-control-state{color:#188755}
@media(max-width:1150px){.calendar-layout{grid-template-columns:1fr}.control-form{grid-template-columns:1fr 1fr}.control-note{grid-column:1/-1}.control-item{grid-template-columns:12px 1fr}.control-due,.control-received-form{grid-column:2}}


/* PRIEMNAYA49 V3.1.1 — control polish + deadline column */
.list-head,.appeal-row{
    grid-template-columns:95px 105px 1.15fr 1.05fr 105px 126px!important;
}
.list-control-cell{display:flex;flex-direction:column;align-items:flex-start;gap:3px}
.deadline-chip{display:inline-flex;align-items:center;gap:5px;padding:5px 7px;border-radius:999px;font-size:10px;font-weight:800;white-space:nowrap}
.deadline-chip i{width:6px;height:6px;border-radius:50%}
.deadline-chip.urgency-green{background:#eaf8f0;color:#188755}.deadline-chip.urgency-green i{background:#1aa66a}
.deadline-chip.urgency-yellow{background:#fff8dc;color:#956900}.deadline-chip.urgency-yellow i{background:#f6bd1e}
.deadline-chip.urgency-orange{background:#fff0df;color:#b86500}.deadline-chip.urgency-orange i{background:#f18b24}
.deadline-chip.urgency-red{background:#ffe9ec;color:#c82d45}.deadline-chip.urgency-red i{background:#ef4760}
.list-control-cell small{font-size:9px;color:var(--muted)}
.deadline-empty{color:#b6c0cd}

/* Statistics cards: exact status language */
.stat-cards.colored .stat-total{background:#edf5ff!important;border-color:#cfe2ff!important}
.stat-cards.colored .stat-total span,.stat-cards.colored .stat-total b{color:#1764c7!important}
.stat-cards.colored .stat-new{background:#fff0f2!important;border-color:#ffd9df!important}
.stat-cards.colored .stat-new span,.stat-cards.colored .stat-new b{color:#df3f53!important}
.stat-cards.colored .stat-work{background:#fff3e5!important;border-color:#ffe0bd!important}
.stat-cards.colored .stat-work span,.stat-cards.colored .stat-work b{color:#c96f00!important}
.stat-cards.colored .stat-answer{background:#fff8dc!important;border-color:#ffe8a3!important}
.stat-cards.colored .stat-answer span,.stat-cards.colored .stat-answer b{color:#9a6a00!important}
.stat-cards.colored .stat-closed{background:#edf9f2!important;border-color:#caefd9!important}
.stat-cards.colored .stat-closed span,.stat-cards.colored .stat-closed b{color:#188755!important}

/* Polished control tab */
.control-tab-polished{max-width:980px;font-size:12px}
.control-toolbar{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:12px}
.control-title{font-size:16px;font-weight:800;line-height:1.2}
.control-subtitle{font-size:11px;color:var(--muted);margin-top:3px}
.control-add-button{height:34px;padding:0 12px;font-size:11px;display:inline-flex;align-items:center;gap:5px;border-radius:8px;box-shadow:0 3px 10px rgba(31,111,229,.16)}
.control-add-icon{font-size:15px;line-height:1}

.control-add-box{display:none;border:1px solid #dbe6f2;border-radius:12px;background:#f9fbfe;margin-bottom:12px;overflow:hidden}
.control-add-box.open{display:block}
.control-add-head{display:flex;align-items:center;gap:9px;padding:11px 13px;border-bottom:1px solid #e5edf5;background:#fff}
.control-head-icon{width:30px;height:30px;border-radius:8px;background:#eaf3ff;color:#1764c7;display:flex;align-items:center;justify-content:center;font-size:15px}
.control-add-head b{display:block;font-size:12.5px}
.control-add-head small{display:block;color:var(--muted);font-size:10px;margin-top:2px}

.control-form-polished{display:grid;grid-template-columns:1.55fr .75fr .75fr .8fr;gap:10px;padding:12px}
.control-field{display:flex;flex-direction:column;gap:5px;min-width:0}
.control-field>span{font-size:10.5px;color:#60748d;font-weight:700}
.control-field input,.control-field textarea{width:100%;border:1px solid #d7e0eb;border-radius:8px;background:#fff;padding:8px 9px;font:inherit;font-size:11px;color:var(--text);outline:none}
.control-field input{height:34px}
.control-field input:focus,.control-field textarea:focus{border-color:#8db9f7;box-shadow:0 0 0 2px rgba(31,111,229,.08)}
.control-note-field{grid-column:1/-1}
.control-note-field textarea{min-height:58px;resize:vertical}
.control-submit-row{grid-column:1/-1;display:flex;justify-content:flex-end}
.control-submit{height:34px;padding:0 14px;font-size:11px;border-radius:8px}

.control-list-polished{display:flex;flex-direction:column;gap:9px}
.control-card-polished{position:relative;display:flex;border:1px solid var(--line);border-radius:12px;background:#fff;overflow:hidden}
.control-card-accent{width:4px;flex:0 0 4px;background:#94a3b8}
.control-card-polished.urgency-green .control-card-accent{background:#1aa66a}
.control-card-polished.urgency-yellow .control-card-accent{background:#f6bd1e}
.control-card-polished.urgency-orange .control-card-accent{background:#f18b24}
.control-card-polished.urgency-red .control-card-accent{background:#ef4760}
.control-card-polished.is-received .control-card-accent{background:#94a3b8}
.control-card-content{padding:12px 13px;width:100%}
.control-card-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px}
.control-agency-block{display:flex;gap:9px;min-width:0}
.control-card-icon{width:30px;height:30px;border-radius:8px;background:#f1f5f9;display:flex;align-items:center;justify-content:center;flex:0 0 30px}
.control-agency-name{font-size:13px;font-weight:800;line-height:1.3}
.control-card-meta{display:flex;flex-wrap:wrap;gap:8px;margin-top:4px;color:var(--muted);font-size:10px}
.control-deadline-block{text-align:right;min-width:150px}
.control-deadline-label{display:block;color:var(--muted);font-size:9.5px}
.control-deadline-block b{display:block;font-size:13px;margin-top:2px}
.control-state{display:inline-block;margin-top:5px;padding:4px 7px;border-radius:999px;font-size:9.5px;font-style:normal;font-weight:800}
.control-state.green{background:#eaf8f0;color:#188755}.control-state.yellow{background:#fff8dc;color:#956900}.control-state.orange{background:#fff0df;color:#b86500}.control-state.red{background:#ffe9ec;color:#c82d45}.control-state.received{background:#eef2f6;color:#617286}
.control-note-box{display:flex;gap:7px;margin-top:10px;padding:8px 9px;border-radius:8px;background:#f8fafc;color:#40536b;font-size:10.5px}
.control-note-box small{display:block;color:var(--muted);font-size:9px;margin-bottom:2px}
.control-card-footer{margin-top:10px;padding-top:9px;border-top:1px solid #edf1f6;display:flex;justify-content:flex-end}
.control-received-polished{display:flex;align-items:flex-end;gap:7px}
.control-received-polished label{display:flex;flex-direction:column;gap:3px;color:var(--muted);font-size:9.5px}
.control-received-polished input{height:31px;border:1px solid #d7e0eb;border-radius:7px;padding:0 8px;font-size:10px}
.control-received-polished .btn{height:31px;padding:0 10px;font-size:10px}

.control-empty-polished{border:1px dashed #d8e1ec;border-radius:12px;padding:22px;text-align:center;background:#fbfcfe;display:flex;flex-direction:column;align-items:center;gap:5px}
.control-empty-icon{width:38px;height:38px;border-radius:10px;background:#eef4fb;display:flex;align-items:center;justify-content:center;font-size:18px}
.control-empty-polished b{font-size:13px}.control-empty-polished>span:not(.control-empty-icon){color:var(--muted);font-size:10.5px}.control-empty-polished .btn{margin-top:5px;font-size:10.5px;height:32px}

/* Calendar: classic month grid, clear cells */
.calendar-card{box-shadow:0 2px 10px rgba(20,33,58,.03)}
.calendar-nav{padding-bottom:10px;border-bottom:1px solid #edf1f6}
.calendar-weekdays{display:grid!important;grid-template-columns:repeat(7,1fr)!important;background:#f8fafc;border:1px solid #edf1f6;border-bottom:0;border-radius:8px 8px 0 0}
.calendar-grid{display:grid!important;grid-template-columns:repeat(7,minmax(0,1fr))!important;border-right:1px solid #edf1f6;border-bottom:1px solid #edf1f6}
.calendar-day{min-height:98px!important;border-left:1px solid #edf1f6!important;border-top:1px solid #edf1f6!important;padding:8px!important}
.calendar-day:nth-child(7n){border-right:0!important}
.calendar-day:nth-last-child(-n+7){border-bottom:0!important}
.calendar-day:hover{background:#f6faff}
.calendar-day.selected{box-shadow:inset 0 0 0 2px #2875e6!important;background:#f7fbff}
.day-controls{margin-top:11px!important}

@media(max-width:1200px){
  .list-head,.appeal-row{grid-template-columns:82px 95px 1.1fr 1fr 100px 115px!important}
  .control-form-polished{grid-template-columns:1fr 1fr}
  .control-field-wide,.control-note-field{grid-column:1/-1}
}
@media(max-width:780px){
  .control-toolbar,.control-card-header{flex-direction:column}
  .control-deadline-block{text-align:left}
  .control-received-polished{width:100%;flex-direction:column;align-items:stretch}
}


/* ===== PRIEMNAYA49 V3.1.2 ===== */

/* New control tab – deliberately isolated from old control styles */
.appeal-detail-card .control-v312{max-width:920px;font-size:12px!important}
.appeal-detail-card .control-v312-head{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:12px}
.appeal-detail-card .control-v312-title{font-size:16px!important;line-height:1.2;font-weight:800!important;color:var(--text)}
.appeal-detail-card .control-v312-subtitle{font-size:11px!important;line-height:1.35;color:var(--muted);margin-top:3px}

.appeal-detail-card .control-v312-add{position:relative}
.appeal-detail-card .control-v312-add>summary{list-style:none!important;cursor:pointer!important;display:inline-flex!important;align-items:center!important;gap:5px!important;height:34px!important;padding:0 13px!important;border-radius:8px!important;background:#1f6fe5!important;color:#fff!important;font-size:11px!important;line-height:34px!important;font-weight:800!important;box-shadow:0 4px 12px rgba(31,111,229,.18)}
.appeal-detail-card .control-v312-add>summary::-webkit-details-marker{display:none!important}
.appeal-detail-card .control-v312-add>summary span{font-size:15px!important}
.appeal-detail-card .control-v312-add[open]>summary{background:#195fc4!important}

.appeal-detail-card .control-v312-form-card{position:absolute;right:0;top:42px;width:720px;max-width:82vw;z-index:20;background:#fff;border:1px solid #dbe5f0;border-radius:12px;box-shadow:0 14px 38px rgba(20,33,58,.15);overflow:hidden}
.appeal-detail-card .control-v312-form-title{display:flex;align-items:center;gap:9px;padding:11px 13px;border-bottom:1px solid #e8edf4;background:#f9fbfd}
.appeal-detail-card .control-v312-form-title>span{width:29px;height:29px;border-radius:8px;background:#eaf3ff;color:#1764c7;display:flex;align-items:center;justify-content:center;font-size:14px}
.appeal-detail-card .control-v312-form-title b{display:block;font-size:12px!important;line-height:1.2}
.appeal-detail-card .control-v312-form-title small{display:block;font-size:9.5px!important;color:var(--muted);margin-top:2px}

.appeal-detail-card .control-v312-form{display:grid!important;grid-template-columns:1.5fr .85fr .8fr .9fr!important;gap:10px!important;padding:12px!important}
.appeal-detail-card .control-v312-form .field{display:flex!important;flex-direction:column!important;gap:4px!important;min-width:0!important;margin:0!important}
.appeal-detail-card .control-v312-form .field>span{font-size:9.5px!important;line-height:1.2!important;font-weight:700!important;color:#687a90!important}
.appeal-detail-card .control-v312-form input,.appeal-detail-card .control-v312-form textarea{width:100%!important;border:1px solid #d7e0eb!important;border-radius:8px!important;background:#fff!important;color:var(--text)!important;font:inherit!important;font-size:10.5px!important;line-height:1.3!important;padding:7px 9px!important;margin:0!important;box-shadow:none!important}
.appeal-detail-card .control-v312-form input{height:33px!important}
.appeal-detail-card .control-v312-form textarea{min-height:54px!important;resize:vertical!important}
.appeal-detail-card .control-v312-form .note{grid-column:1/-1!important}
.appeal-detail-card .control-v312-form .submit-row{grid-column:1/-1!important;display:flex!important;justify-content:flex-end!important;padding-top:1px!important}
.appeal-detail-card .control-v312-form .submit-row .btn{height:33px!important;padding:0 13px!important;font-size:10.5px!important;border-radius:8px!important}

.appeal-detail-card .control-v312-list{display:flex!important;flex-direction:column!important;gap:9px!important}
.appeal-detail-card .control-v312-card{display:flex!important;border:1px solid #dfe7f0!important;border-radius:11px!important;background:#fff!important;overflow:hidden!important;font-size:11px!important}
.appeal-detail-card .control-v312-card .accent{width:4px!important;flex:0 0 4px!important;background:#9aa9b9!important}
.appeal-detail-card .control-v312-card.urgency-green .accent{background:#1aa66a!important}
.appeal-detail-card .control-v312-card.urgency-yellow .accent{background:#f6bd1e!important}
.appeal-detail-card .control-v312-card.urgency-orange .accent{background:#f18b24!important}
.appeal-detail-card .control-v312-card.urgency-red .accent{background:#ef4760!important}
.appeal-detail-card .control-v312-card-body{width:100%!important;padding:11px 12px!important}
.appeal-detail-card .control-v312-mainrow{display:flex!important;align-items:flex-start!important;justify-content:space-between!important;gap:14px!important}
.appeal-detail-card .control-v312-card .agency-block{display:flex!important;align-items:flex-start!important;gap:8px!important;min-width:0!important}
.appeal-detail-card .control-v312-card .agency-icon{width:29px!important;height:29px!important;flex:0 0 29px!important;display:flex!important;align-items:center!important;justify-content:center!important;border-radius:8px!important;background:#f1f5f9!important;font-size:13px!important}
.appeal-detail-card .control-v312-card .agency-name{display:block!important;font-size:12px!important;line-height:1.3!important;font-weight:800!important;color:var(--text)!important;margin:0!important}
.appeal-detail-card .control-v312-card .meta{display:flex!important;flex-wrap:wrap!important;gap:8px!important;margin-top:4px!important;font-size:9.5px!important;line-height:1.3!important;color:var(--muted)!important}
.appeal-detail-card .control-v312-card .deadline{text-align:right!important;min-width:150px!important}
.appeal-detail-card .control-v312-card .deadline small{display:block!important;font-size:9px!important;line-height:1.2!important;color:var(--muted)!important}
.appeal-detail-card .control-v312-card .deadline>b{display:block!important;font-size:12.5px!important;line-height:1.25!important;margin-top:2px!important;color:var(--text)!important}
.appeal-detail-card .control-v312-card .state{display:inline-block!important;margin-top:5px!important;padding:4px 7px!important;border-radius:999px!important;font-size:9px!important;line-height:1.2!important;font-weight:800!important}
.appeal-detail-card .control-v312-card .state.green{background:#eaf8f0!important;color:#188755!important}
.appeal-detail-card .control-v312-card .state.yellow{background:#fff8dc!important;color:#956900!important}
.appeal-detail-card .control-v312-card .state.orange{background:#fff0df!important;color:#b86500!important}
.appeal-detail-card .control-v312-card .state.red{background:#ffe9ec!important;color:#c82d45!important}
.appeal-detail-card .control-v312-card .state.received{background:#eef2f6!important;color:#617286!important}
.appeal-detail-card .control-v312-note{display:flex!important;gap:7px!important;margin-top:9px!important;padding:8px 9px!important;border-radius:8px!important;background:#f8fafc!important;color:#40536b!important}
.appeal-detail-card .control-v312-note small{display:block!important;font-size:8.5px!important;color:var(--muted)!important;margin-bottom:2px!important}
.appeal-detail-card .control-v312-note p{margin:0!important;font-size:10px!important;line-height:1.35!important;font-weight:400!important}
.appeal-detail-card .control-v312-footer{display:flex!important;justify-content:flex-end!important;margin-top:9px!important;padding-top:9px!important;border-top:1px solid #edf1f6!important}
.appeal-detail-card .control-v312-footer form{display:flex!important;align-items:flex-end!important;gap:7px!important}
.appeal-detail-card .control-v312-footer label{display:flex!important;flex-direction:column!important;gap:3px!important;font-size:8.8px!important;color:var(--muted)!important}
.appeal-detail-card .control-v312-footer input{height:30px!important;border:1px solid #d7e0eb!important;border-radius:7px!important;padding:0 7px!important;font-size:9.5px!important}
.appeal-detail-card .control-v312-footer .btn{height:30px!important;padding:0 9px!important;font-size:9.5px!important;border-radius:7px!important}
.appeal-detail-card .control-v312-empty{border:1px dashed #d7e1ec!important;border-radius:11px!important;background:#fbfcfe!important;padding:20px!important;text-align:center!important;display:flex!important;flex-direction:column!important;align-items:center!important;gap:4px!important}
.appeal-detail-card .control-v312-empty>span{font-size:18px!important}
.appeal-detail-card .control-v312-empty b{font-size:12px!important}
.appeal-detail-card .control-v312-empty small{font-size:9.5px!important;color:var(--muted)!important}

/* Year calendar – 12 months like the supplied reference */
.control-calendar-page-v312{padding-top:18px!important}
.year-calendar-top{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}
.year-calendar-top h1{margin:0!important;font-size:22px!important;line-height:1.15!important}
.year-calendar-top p{margin:4px 0 0!important;color:var(--muted)!important;font-size:11.5px!important}
.year-calendar-nav{display:flex;align-items:center;gap:7px}
.year-calendar-nav>a{width:30px;height:30px;border-radius:50%;background:#eef2f6;color:#53667d;display:flex;align-items:center;justify-content:center;text-decoration:none;font-size:20px}
.year-calendar-nav strong{font-size:20px;margin:0 4px}
.year-calendar-nav .today-link{width:auto!important;border-radius:16px!important;padding:0 11px!important;font-size:10px!important;font-weight:800!important}

.year-calendar-layout{display:grid;grid-template-columns:minmax(0,1fr) 300px;gap:12px}
.year-calendar-card,.year-selected-panel{background:#fff;border:1px solid var(--line);border-radius:12px}
.year-calendar-card{padding:16px}
.year-months-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:22px 28px}
.mini-month-title{font-size:14px;font-weight:800;color:#1f6fe5;margin-bottom:8px}
.mini-weekdays,.mini-days{display:grid;grid-template-columns:repeat(7,1fr);gap:3px}
.mini-weekdays span{text-align:center;font-size:8.5px;font-weight:700;color:#8a98aa;padding-bottom:3px}
.mini-day{position:relative;min-width:0;height:24px;border-radius:6px;display:flex;align-items:center;justify-content:center;text-decoration:none;color:#42536a;font-size:9.5px;font-weight:700}
.mini-day.outside{color:#c5ccd5}
.mini-day:hover{background:#f0f6ff}
.mini-day.today{background:#1f6fe5!important;color:#fff!important}
.mini-day.selected{box-shadow:inset 0 0 0 2px #1f6fe5}
.mini-day.has-control{background:#f7f9fc}
.mini-day.has-control:after{content:"";position:absolute;bottom:2px;width:4px;height:4px;border-radius:50%;background:#94a3b8}
.mini-day.urgency-green:after{background:#1aa66a}.mini-day.urgency-yellow:after{background:#f6bd1e}.mini-day.urgency-orange:after{background:#f18b24}.mini-day.urgency-red:after{background:#ef4760}
.mini-day i{position:absolute;top:-4px;right:-3px;min-width:13px;height:13px;border-radius:999px;background:#ef4760;color:#fff;font-size:7px;font-style:normal;display:flex;align-items:center;justify-content:center;padding:0 3px}
.year-selected-panel{padding:13px}
.selected-date-head{padding-bottom:10px;border-bottom:1px solid #edf1f6;margin-bottom:9px}
.selected-date-head span{display:block;font-size:9px;color:var(--muted)}
.selected-date-head strong{display:block;font-size:15px;margin-top:2px}
.selected-control-card{display:grid;grid-template-columns:7px minmax(0,1fr) auto;gap:8px;align-items:center;text-decoration:none;color:var(--text);border:1px solid var(--line);border-radius:9px;padding:9px;margin-bottom:7px}
.selected-control-card>i{width:7px;height:7px;border-radius:50%;background:#94a3b8}
.selected-control-card.urgency-green>i{background:#1aa66a}.selected-control-card.urgency-yellow>i{background:#f6bd1e}.selected-control-card.urgency-orange>i{background:#f18b24}.selected-control-card.urgency-red>i{background:#ef4760}
.selected-control-main b{display:block;font-size:9.5px;color:#60748d}
.selected-control-main strong{display:block;font-size:11px;margin-top:2px}
.selected-control-main small{display:block;font-size:8.5px;color:var(--muted);margin-top:2px}
.selected-control-state{font-size:8.5px;font-weight:800;text-align:right;color:#687a90}
.selected-control-card.urgency-red .selected-control-state{color:#c82d45}
.selected-control-card.urgency-orange .selected-control-state{color:#b86500}
.selected-control-card.urgency-yellow .selected-control-state{color:#956900}
.selected-control-card.urgency-green .selected-control-state{color:#188755}
.selected-empty{padding:28px 10px;text-align:center;display:flex;flex-direction:column;align-items:center;gap:4px;color:var(--muted)}
.selected-empty>span{font-size:22px}.selected-empty b{font-size:11px;color:var(--text)}.selected-empty small{font-size:9px}

@media(max-width:1350px){.year-months-grid{grid-template-columns:repeat(3,1fr)}}
@media(max-width:1100px){.year-calendar-layout{grid-template-columns:1fr}.year-months-grid{grid-template-columns:repeat(3,1fr)}}
@media(max-width:800px){
  .year-months-grid{grid-template-columns:repeat(2,1fr)}
  .appeal-detail-card .control-v312-form-card{position:fixed;left:5vw;right:5vw;top:110px;width:auto;max-width:none}
  .appeal-detail-card .control-v312-form{grid-template-columns:1fr 1fr!important}
  .appeal-detail-card .control-v312-form .agency,.appeal-detail-card .control-v312-form .note{grid-column:1/-1!important}
}


/* ===== PRIEMNAYA49 V3.1.3 ===== */

/* Appeals list: stable six-column layout */
.reference-workspace{
    grid-template-columns:minmax(650px,1.12fr) minmax(520px,.88fr)!important;
}
.list-head,.appeal-row{
    grid-template-columns:110px 110px minmax(145px,1.25fr) minmax(130px,1fr) 110px 125px!important;
    gap:12px!important;
    align-items:center!important;
}
.list-head{
    font-size:11.5px!important;
}
.appeal-row{
    font-size:12px!important;
}
.appeal-row>div{
    min-width:0!important;
}
.appeal-row>div:nth-child(3) b,
.appeal-row>div:nth-child(4){
    overflow-wrap:anywhere!important;
}
.list-control-cell{
    align-items:flex-start!important;
    min-width:0!important;
}
.deadline-chip{
    max-width:100%!important;
    box-sizing:border-box!important;
}
@media(max-width:1280px){
    .reference-workspace{
        grid-template-columns:minmax(590px,1fr) minmax(500px,.9fr)!important;
    }
    .list-head,.appeal-row{
        grid-template-columns:95px 100px minmax(130px,1.15fr) minmax(115px,.95fr) 100px 115px!important;
        gap:9px!important;
    }
}

/* Control section */
.appeal-detail-card .control-v313{
    max-width:100%!important;
    font-size:12px!important;
}
.appeal-detail-card .control-v313-head{
    display:flex!important;
    flex-direction:column!important;
    align-items:stretch!important;
    gap:12px!important;
    margin-bottom:12px!important;
}
.appeal-detail-card .control-v313-head>div:first-child{
    display:flex!important;
    flex-direction:column!important;
}
.appeal-detail-card .control-v313-title{
    font-size:16px!important;
    line-height:1.2!important;
    font-weight:800!important;
}
.appeal-detail-card .control-v313-subtitle{
    font-size:11px!important;
    line-height:1.35!important;
    color:var(--muted)!important;
    margin-top:3px!important;
}

/* Details stretches full width; summary button stays right */
.appeal-detail-card .control-v313-add{
    width:100%!important;
    position:static!important;
}
.appeal-detail-card .control-v313-add>summary{
    list-style:none!important;
    cursor:pointer!important;
    display:flex!important;
    width:max-content!important;
    margin-left:auto!important;
    align-items:center!important;
    gap:5px!important;
    height:34px!important;
    padding:0 13px!important;
    border-radius:8px!important;
    background:#1f6fe5!important;
    color:#fff!important;
    font-size:11px!important;
    line-height:34px!important;
    font-weight:800!important;
    box-shadow:0 4px 12px rgba(31,111,229,.16)!important;
}
.appeal-detail-card .control-v313-add>summary::-webkit-details-marker{
    display:none!important;
}
.appeal-detail-card .control-v313-add>summary span{
    font-size:15px!important;
}
.appeal-detail-card .control-v313-add[open]>summary{
    background:#195fc4!important;
}

/* Form is in normal flow, inside the appeal card */
.appeal-detail-card .control-v313-form-card{
    position:static!important;
    width:100%!important;
    max-width:100%!important;
    box-sizing:border-box!important;
    margin-top:10px!important;
    background:#fff!important;
    border:1px solid #dbe5f0!important;
    border-radius:12px!important;
    box-shadow:none!important;
    overflow:hidden!important;
}
.appeal-detail-card .control-v313-form-title{
    display:flex!important;
    align-items:center!important;
    gap:9px!important;
    padding:10px 12px!important;
    border-bottom:1px solid #e8edf4!important;
    background:#f9fbfd!important;
}
.appeal-detail-card .control-v313-form-title>span{
    width:29px!important;
    height:29px!important;
    border-radius:8px!important;
    background:#eaf3ff!important;
    color:#1764c7!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    font-size:14px!important;
}
.appeal-detail-card .control-v313-form-title b{
    display:block!important;
    font-size:12px!important;
}
.appeal-detail-card .control-v313-form-title small{
    display:block!important;
    margin-top:2px!important;
    color:var(--muted)!important;
    font-size:9.5px!important;
}
.appeal-detail-card .control-v313-form{
    display:grid!important;
    grid-template-columns:minmax(0,1.55fr) minmax(0,.8fr) minmax(0,.8fr) minmax(0,.9fr)!important;
    gap:10px!important;
    width:100%!important;
    max-width:100%!important;
    box-sizing:border-box!important;
    padding:12px!important;
}
.appeal-detail-card .control-v313-form .field{
    display:flex!important;
    flex-direction:column!important;
    gap:4px!important;
    min-width:0!important;
    margin:0!important;
}
.appeal-detail-card .control-v313-form .field>span{
    font-size:9.5px!important;
    line-height:1.2!important;
    font-weight:700!important;
    color:#687a90!important;
}
.appeal-detail-card .control-v313-form input,
.appeal-detail-card .control-v313-form textarea{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
    border:1px solid #d7e0eb!important;
    border-radius:8px!important;
    background:#fff!important;
    color:var(--text)!important;
    font:inherit!important;
    font-size:10.5px!important;
    line-height:1.3!important;
    padding:7px 9px!important;
    margin:0!important;
    box-shadow:none!important;
}
.appeal-detail-card .control-v313-form input{
    height:33px!important;
}
.appeal-detail-card .control-v313-form textarea{
    min-height:54px!important;
    resize:vertical!important;
}
.appeal-detail-card .control-v313-form .field-note{
    grid-column:1/-1!important;
}
.appeal-detail-card .control-v313-form .submit-row{
    grid-column:1/-1!important;
    display:flex!important;
    justify-content:flex-end!important;
}
.appeal-detail-card .control-v313-form .submit-row .btn{
    height:33px!important;
    padding:0 13px!important;
    font-size:10.5px!important;
    border-radius:8px!important;
}

/* Preserve the liked control-card styling */
.appeal-detail-card .control-v313-list{
    display:flex!important;
    flex-direction:column!important;
    gap:9px!important;
}
.appeal-detail-card .control-v313-card{
    display:flex!important;
    border:1px solid #dfe7f0!important;
    border-radius:11px!important;
    background:#fff!important;
    overflow:hidden!important;
    font-size:11px!important;
}
.appeal-detail-card .control-v313-card .accent{
    width:4px!important;
    flex:0 0 4px!important;
    background:#9aa9b9!important;
}
.appeal-detail-card .control-v313-card.urgency-green .accent{background:#1aa66a!important}
.appeal-detail-card .control-v313-card.urgency-yellow .accent{background:#f6bd1e!important}
.appeal-detail-card .control-v313-card.urgency-orange .accent{background:#f18b24!important}
.appeal-detail-card .control-v313-card.urgency-red .accent{background:#ef4760!important}
.appeal-detail-card .control-v313-card-body{
    width:100%!important;
    padding:11px 12px!important;
}
.appeal-detail-card .control-v313-mainrow{
    display:flex!important;
    align-items:flex-start!important;
    justify-content:space-between!important;
    gap:14px!important;
}
.appeal-detail-card .control-v313-card .agency-block{
    display:flex!important;
    align-items:flex-start!important;
    gap:8px!important;
    min-width:0!important;
}
.appeal-detail-card .control-v313-card .agency-icon{
    width:29px!important;
    height:29px!important;
    flex:0 0 29px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    border-radius:8px!important;
    background:#f1f5f9!important;
    font-size:13px!important;
}
.appeal-detail-card .control-v313-card .agency-name{
    display:block!important;
    font-size:12px!important;
    line-height:1.3!important;
    font-weight:800!important;
}
.appeal-detail-card .control-v313-card .meta{
    display:flex!important;
    flex-wrap:wrap!important;
    gap:8px!important;
    margin-top:4px!important;
    color:var(--muted)!important;
    font-size:9.5px!important;
}
.appeal-detail-card .control-v313-card .deadline{
    text-align:right!important;
    min-width:150px!important;
}
.appeal-detail-card .control-v313-card .deadline small{
    display:block!important;
    font-size:9px!important;
    color:var(--muted)!important;
}
.appeal-detail-card .control-v313-card .deadline>b{
    display:block!important;
    font-size:12.5px!important;
    margin-top:2px!important;
}
.appeal-detail-card .control-v313-card .state{
    display:inline-block!important;
    margin-top:5px!important;
    padding:4px 7px!important;
    border-radius:999px!important;
    font-size:9px!important;
    font-weight:800!important;
}
.appeal-detail-card .control-v313-card .state.green{background:#eaf8f0!important;color:#188755!important}
.appeal-detail-card .control-v313-card .state.yellow{background:#fff8dc!important;color:#956900!important}
.appeal-detail-card .control-v313-card .state.orange{background:#fff0df!important;color:#b86500!important}
.appeal-detail-card .control-v313-card .state.red{background:#ffe9ec!important;color:#c82d45!important}
.appeal-detail-card .control-v313-card .state.received{background:#eef2f6!important;color:#617286!important}
.appeal-detail-card .control-v313-note{
    display:flex!important;
    gap:7px!important;
    margin-top:9px!important;
    padding:8px 9px!important;
    border-radius:8px!important;
    background:#f8fafc!important;
}
.appeal-detail-card .control-v313-note small{
    display:block!important;
    font-size:8.5px!important;
    color:var(--muted)!important;
}
.appeal-detail-card .control-v313-note p{
    margin:2px 0 0!important;
    font-size:10px!important;
    line-height:1.35!important;
}
.appeal-detail-card .control-v313-footer{
    display:flex!important;
    justify-content:flex-end!important;
    margin-top:9px!important;
    padding-top:9px!important;
    border-top:1px solid #edf1f6!important;
}
.appeal-detail-card .control-v313-footer form{
    display:flex!important;
    align-items:flex-end!important;
    gap:7px!important;
}
.appeal-detail-card .control-v313-footer label{
    display:flex!important;
    flex-direction:column!important;
    gap:3px!important;
    font-size:8.8px!important;
    color:var(--muted)!important;
}
.appeal-detail-card .control-v313-footer input{
    height:30px!important;
    border:1px solid #d7e0eb!important;
    border-radius:7px!important;
    padding:0 7px!important;
    font-size:9.5px!important;
}
.appeal-detail-card .control-v313-footer .btn{
    height:30px!important;
    padding:0 9px!important;
    font-size:9.5px!important;
}
.appeal-detail-card .control-v313-empty{
    border:1px dashed #d7e1ec!important;
    border-radius:11px!important;
    background:#fbfcfe!important;
    padding:20px!important;
    text-align:center!important;
}

@media(max-width:1180px){
    .appeal-detail-card .control-v313-form{
        grid-template-columns:1fr 1fr!important;
    }
    .appeal-detail-card .control-v313-form .field-agency,
    .appeal-detail-card .control-v313-form .field-note{
        grid-column:1/-1!important;
    }
}
@media(max-width:760px){
    .appeal-detail-card .control-v313-form{
        grid-template-columns:1fr!important;
    }
    .appeal-detail-card .control-v313-form .field-agency,
    .appeal-detail-card .control-v313-form .field-note{
        grid-column:auto!important;
    }
    .appeal-detail-card .control-v313-mainrow{
        flex-direction:column!important;
    }
    .appeal-detail-card .control-v313-card .deadline{
        text-align:left!important;
    }
}


/* ===== PRIEMNAYA49 V3.1.4 – hard reset control form layout ===== */
.appeal-detail-card .control-v314,
.appeal-detail-card .control-v314 *{
    box-sizing:border-box!important;
}
.appeal-detail-card .control-v314{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    overflow:visible!important;
}
.appeal-detail-card .control-v314-head{
    width:100%!important;
    display:flex!important;
    align-items:center!important;
    justify-content:space-between!important;
    gap:14px!important;
    margin:0 0 12px!important;
}
.appeal-detail-card .control-v314-title{
    font-size:16px!important;
    line-height:1.2!important;
    font-weight:800!important;
}
.appeal-detail-card .control-v314-subtitle{
    margin-top:3px!important;
    font-size:11px!important;
    line-height:1.35!important;
    color:var(--muted)!important;
}
.appeal-detail-card .control-v314-toggle{
    flex:0 0 auto!important;
    height:34px!important;
    padding:0 13px!important;
    border-radius:8px!important;
    font-size:11px!important;
    display:inline-flex!important;
    align-items:center!important;
    gap:5px!important;
}
.appeal-detail-card .control-v314-toggle span{font-size:15px!important}
.appeal-detail-card .control-v314-toggle.is-open{background:#195fc4!important}

/* FORM — normal flow, never absolute/fixed */
.appeal-detail-card .control-v314-form-wrap{
    position:static!important;
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0 0 12px!important;
    border:1px solid #dbe5f0!important;
    border-radius:12px!important;
    background:#fff!important;
    overflow:hidden!important;
    box-shadow:none!important;
}
.appeal-detail-card .control-v314-form-wrap[hidden]{
    display:none!important;
}
.appeal-detail-card .control-v314-form-head{
    display:flex!important;
    align-items:center!important;
    gap:9px!important;
    width:100%!important;
    padding:10px 12px!important;
    border-bottom:1px solid #e8edf4!important;
    background:#f9fbfd!important;
}
.appeal-detail-card .control-v314-form-head>span{
    width:29px!important;height:29px!important;flex:0 0 29px!important;
    display:flex!important;align-items:center!important;justify-content:center!important;
    border-radius:8px!important;background:#eaf3ff!important;
}
.appeal-detail-card .control-v314-form-head b{
    display:block!important;font-size:12px!important;line-height:1.2!important;
}
.appeal-detail-card .control-v314-form-head small{
    display:block!important;margin-top:2px!important;font-size:9.5px!important;color:var(--muted)!important;
}
.appeal-detail-card .control-v314-form{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    padding:12px!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    gap:10px 12px!important;
}
.appeal-detail-card .control-v314-field{
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
    margin:0!important;
    display:flex!important;
    flex-direction:column!important;
    gap:4px!important;
}
.appeal-detail-card .control-v314-field.full{
    grid-column:1/-1!important;
}
.appeal-detail-card .control-v314-field>span{
    font-size:9.5px!important;
    line-height:1.2!important;
    font-weight:700!important;
    color:#687a90!important;
}
.appeal-detail-card .control-v314-field input,
.appeal-detail-card .control-v314-field textarea{
    display:block!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    margin:0!important;
    border:1px solid #d7e0eb!important;
    border-radius:8px!important;
    background:#fff!important;
    padding:7px 9px!important;
    font:inherit!important;
    font-size:10.5px!important;
    line-height:1.3!important;
    box-shadow:none!important;
}
.appeal-detail-card .control-v314-field input{height:33px!important}
.appeal-detail-card .control-v314-field textarea{min-height:54px!important;resize:vertical!important}
.appeal-detail-card .control-v314-submit{
    grid-column:1/-1!important;
    display:flex!important;
    justify-content:flex-end!important;
}
.appeal-detail-card .control-v314-submit .btn{
    height:33px!important;padding:0 13px!important;font-size:10.5px!important;border-radius:8px!important;
}

/* Keep the approved control card style */
.appeal-detail-card .control-v314-list{display:flex!important;flex-direction:column!important;gap:9px!important}
.appeal-detail-card .control-v314-card{display:flex!important;width:100%!important;border:1px solid #dfe7f0!important;border-radius:11px!important;background:#fff!important;overflow:hidden!important}
.appeal-detail-card .control-v314-card .accent{width:4px!important;flex:0 0 4px!important;background:#9aa9b9!important}
.appeal-detail-card .control-v314-card.urgency-green .accent{background:#1aa66a!important}
.appeal-detail-card .control-v314-card.urgency-yellow .accent{background:#f6bd1e!important}
.appeal-detail-card .control-v314-card.urgency-orange .accent{background:#f18b24!important}
.appeal-detail-card .control-v314-card.urgency-red .accent{background:#ef4760!important}
.appeal-detail-card .control-v314-card .body{width:100%!important;padding:11px 12px!important}
.appeal-detail-card .control-v314-card .top{display:flex!important;justify-content:space-between!important;align-items:flex-start!important;gap:14px!important}
.appeal-detail-card .control-v314-card .agency{display:flex!important;align-items:flex-start!important;gap:8px!important;min-width:0!important}
.appeal-detail-card .control-v314-card .icon{width:29px!important;height:29px!important;flex:0 0 29px!important;display:flex!important;align-items:center!important;justify-content:center!important;border-radius:8px!important;background:#f1f5f9!important;font-size:13px!important}
.appeal-detail-card .control-v314-card .agency b{display:block!important;font-size:12px!important;line-height:1.3!important}
.appeal-detail-card .control-v314-card .meta{display:flex!important;gap:8px!important;flex-wrap:wrap!important;margin-top:4px!important;font-size:9.5px!important;color:var(--muted)!important}
.appeal-detail-card .control-v314-card .deadline{text-align:right!important;min-width:150px!important}
.appeal-detail-card .control-v314-card .deadline small{display:block!important;font-size:9px!important;color:var(--muted)!important}
.appeal-detail-card .control-v314-card .deadline>b{display:block!important;font-size:12.5px!important;margin-top:2px!important}
.appeal-detail-card .control-v314-card .state{display:inline-block!important;margin-top:5px!important;padding:4px 7px!important;border-radius:999px!important;font-size:9px!important;font-weight:800!important}
.appeal-detail-card .control-v314-card .state.green{background:#eaf8f0!important;color:#188755!important}
.appeal-detail-card .control-v314-card .state.yellow{background:#fff8dc!important;color:#956900!important}
.appeal-detail-card .control-v314-card .state.orange{background:#fff0df!important;color:#b86500!important}
.appeal-detail-card .control-v314-card .state.red{background:#ffe9ec!important;color:#c82d45!important}
.appeal-detail-card .control-v314-card .state.received{background:#eef2f6!important;color:#617286!important}
.appeal-detail-card .control-v314-card .note{display:flex!important;gap:7px!important;margin-top:9px!important;padding:8px 9px!important;border-radius:8px!important;background:#f8fafc!important}
.appeal-detail-card .control-v314-card .note small{display:block!important;font-size:8.5px!important;color:var(--muted)!important}
.appeal-detail-card .control-v314-card .note p{margin:2px 0 0!important;font-size:10px!important;line-height:1.35!important}
.appeal-detail-card .control-v314-card .footer{display:flex!important;justify-content:flex-end!important;margin-top:9px!important;padding-top:9px!important;border-top:1px solid #edf1f6!important}
.appeal-detail-card .control-v314-card .footer form{display:flex!important;align-items:flex-end!important;gap:7px!important}
.appeal-detail-card .control-v314-card .footer label{display:flex!important;flex-direction:column!important;gap:3px!important;font-size:8.8px!important;color:var(--muted)!important}
.appeal-detail-card .control-v314-card .footer input{height:30px!important;border:1px solid #d7e0eb!important;border-radius:7px!important;padding:0 7px!important;font-size:9.5px!important}
.appeal-detail-card .control-v314-card .footer .btn{height:30px!important;padding:0 9px!important;font-size:9.5px!important}
.appeal-detail-card .control-v314-empty{border:1px dashed #d7e1ec!important;border-radius:11px!important;background:#fbfcfe!important;padding:20px!important;text-align:center!important}

@media(max-width:760px){
    .appeal-detail-card .control-v314-head{align-items:flex-start!important;flex-direction:column!important}
    .appeal-detail-card .control-v314-form{grid-template-columns:1fr!important}
    .appeal-detail-card .control-v314-field.full{grid-column:auto!important}
    .appeal-detail-card .control-v314-card .top{flex-direction:column!important}
    .appeal-detail-card .control-v314-card .deadline{text-align:left!important}
}

/* Appeal list six columns: keep them aligned and readable */
.appeals-list-card{min-width:0!important}
.list-head,.appeal-row{
    grid-template-columns:100px 100px minmax(140px,1.2fr) minmax(120px,1fr) 110px 120px!important;
    gap:10px!important;
}
.list-head>div,.appeal-row>div{min-width:0!important}
.list-head>div:nth-child(4),.appeal-row>div:nth-child(4){padding-left:2px!important}
.list-head>div:nth-child(5),.appeal-row>div:nth-child(5){padding-left:2px!important}
.list-head>div:nth-child(6),.appeal-row>div:nth-child(6){padding-left:2px!important}


/* ===== PRIEMNAYA49 V3.1.5 ===== */

/* Restore old responsive behavior:
   when the window becomes narrower, the detail card goes BELOW the list. */
@media(max-width:1450px){
    .reference-workspace{
        grid-template-columns:1fr!important;
        gap:12px!important;
    }
    .appeals-list-card,
    .appeal-detail-card{
        width:100%!important;
        max-width:100%!important;
        min-width:0!important;
    }
    .appeals-scroll{
        max-height:none!important;
    }
    .list-head,.appeal-row{
        grid-template-columns:105px 105px minmax(150px,1.25fr) minmax(140px,1fr) 115px 130px!important;
        gap:10px!important;
    }
}

@media(max-width:900px){
    .list-head,.appeal-row{
        grid-template-columns:90px 95px minmax(125px,1.2fr) minmax(110px,1fr) 100px 115px!important;
        gap:8px!important;
        font-size:11px!important;
    }
}

/* Active countdown: red. Received answer: green. */
.appeal-detail-card .control-v314-card .state.green,
.appeal-detail-card .control-v314-card .state.yellow,
.appeal-detail-card .control-v314-card .state.orange,
.appeal-detail-card .control-v314-card .state.red{
    background:#ffe9ec!important;
    color:#c82d45!important;
}
.appeal-detail-card .control-v314-card .state.received{
    background:#eaf8f0!important;
    color:#188755!important;
}
.appeal-detail-card .control-v314-card.received .accent{
    background:#1aa66a!important;
}

/* Selected date panel: unanswered red, received green. */
.selected-control-card .selected-control-state{
    color:#c82d45!important;
}
.selected-control-card.urgency-received{
    border-color:#d7eadf!important;
    background:#fbfffc!important;
}
.selected-control-card.urgency-received>i{
    background:#1aa66a!important;
}
.selected-control-card.urgency-received .selected-control-state{
    color:#188755!important;
}

/* Calendar badge counts only unanswered controls. */
.mini-day.has-control i{
    background:#ef4760!important;
    color:#fff!important;
}


/* ===== PRIEMNAYA49 V3.1.6 – denser appeals table + deadline colors ===== */

/* More compact column widths so Control deadline fits without clipping */
.list-head,.appeal-row{
    grid-template-columns:
        82px
        96px
        minmax(128px,1.15fr)
        minmax(108px,.95fr)
        100px
        118px!important;
    gap:7px!important;
    padding-left:10px!important;
    padding-right:10px!important;
}

.list-head{
    font-size:11px!important;
}

.appeal-row{
    font-size:11.5px!important;
}

.appeal-row>div:first-child b{
    font-size:11.5px!important;
}

.muted-small{
    font-size:10px!important;
    line-height:1.2!important;
}

.badge{
    padding:5px 8px!important;
    font-size:10px!important;
}

.source-icon{
    width:17px!important;
    height:17px!important;
    font-size:7.5px!important;
}

/* Deadline column */
.list-control-cell{
    gap:2px!important;
    white-space:nowrap!important;
}

.deadline-chip{
    padding:5px 7px!important;
    font-size:9.5px!important;
    line-height:1!important;
}

/* User requested active deadline to be red, received to be green */
.deadline-chip.urgency-green,
.deadline-chip.urgency-yellow,
.deadline-chip.urgency-orange,
.deadline-chip.urgency-red{
    background:#ffe9ec!important;
    color:#c82d45!important;
}

.deadline-chip.urgency-green i,
.deadline-chip.urgency-yellow i,
.deadline-chip.urgency-orange i,
.deadline-chip.urgency-red i{
    background:#ef4760!important;
}

.list-control-cell small{
    font-size:8.5px!important;
    line-height:1.15!important;
    color:#c82d45!important;
}

/* If a future row is explicitly marked received, keep it green */
.deadline-chip.urgency-received{
    background:#eaf8f0!important;
    color:#188755!important;
}
.deadline-chip.urgency-received i{
    background:#1aa66a!important;
}

/* At stacked layout widths, use full row width efficiently */
@media(max-width:1450px){
    .list-head,.appeal-row{
        grid-template-columns:
            82px
            96px
            minmax(135px,1.2fr)
            minmax(115px,1fr)
            100px
            120px!important;
        gap:7px!important;
    }
}

@media(max-width:980px){
    .list-head,.appeal-row{
        grid-template-columns:
            76px
            88px
            minmax(120px,1.15fr)
            minmax(100px,.95fr)
            92px
            112px!important;
        gap:6px!important;
    }
}


/* ===== PRIEMNAYA49 V3.1.7 ===== */

/* Appeals table: tighter first columns, more room for deadline column */
.list-head,.appeal-row{
    grid-template-columns:
        70px
        88px
        minmax(132px,1.18fr)
        minmax(108px,.95fr)
        96px
        142px!important;
    gap:6px!important;
    padding-left:10px!important;
    padding-right:14px!important;
}
.list-head>div:last-child,
.appeal-row>div:last-child{
    padding-right:6px!important;
}
.list-control-cell{
    min-width:0!important;
    overflow:visible!important;
}
.deadline-chip{
    max-width:100%!important;
    white-space:nowrap!important;
}

/* Empty list */
.empty-list{
    min-height:120px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    padding:24px!important;
    color:#7c8da4!important;
    font-size:12px!important;
    font-weight:700!important;
    text-align:center!important;
    background:#fff!important;
}

/* Calendar date badge: no urgency colors; always one red counter for active controls only */
.mini-day.has-control:after{
    background:#1aa66a!important;
}
.mini-day.has-control i{
    background:#ef4760!important;
    color:#fff!important;
}
.mini-day.urgency-green:after,
.mini-day.urgency-yellow:after,
.mini-day.urgency-orange:after,
.mini-day.urgency-red:after{
    background:#1aa66a!important;
}

/* Top calendar alert dropdown */
.deadline-alert-menu{
    position:relative!important;
    display:flex!important;
    align-items:center!important;
}
.deadline-alert-button{
    border:0!important;
    background:transparent!important;
    cursor:pointer!important;
    padding:0!important;
}
.deadline-alert-dropdown{
    position:absolute!important;
    top:42px!important;
    right:-10px!important;
    width:340px!important;
    max-width:calc(100vw - 30px)!important;
    z-index:1000!important;
    background:#fff!important;
    border:1px solid #dbe4ee!important;
    border-radius:12px!important;
    box-shadow:0 14px 38px rgba(20,33,58,.16)!important;
    overflow:hidden!important;
}
.deadline-alert-dropdown[hidden]{
    display:none!important;
}
.deadline-alert-head{
    padding:11px 12px!important;
    border-bottom:1px solid #edf1f6!important;
    background:#f9fbfd!important;
}
.deadline-alert-head b{
    display:block!important;
    font-size:12px!important;
    line-height:1.2!important;
}
.deadline-alert-head span{
    display:block!important;
    margin-top:2px!important;
    color:var(--muted)!important;
    font-size:9.5px!important;
}
.deadline-alert-list{
    max-height:340px!important;
    overflow:auto!important;
    padding:6px!important;
}
.deadline-alert-item{
    display:grid!important;
    grid-template-columns:8px 1fr!important;
    gap:8px!important;
    align-items:start!important;
    padding:9px!important;
    border-radius:8px!important;
    text-decoration:none!important;
    color:var(--text)!important;
}
.deadline-alert-item:hover{
    background:#f6f9fd!important;
}
.deadline-alert-dot{
    width:7px!important;
    height:7px!important;
    margin-top:4px!important;
    border-radius:50%!important;
    background:#ef4760!important;
}
.deadline-alert-item b{
    display:block!important;
    font-size:9.5px!important;
    color:#657991!important;
}
.deadline-alert-item strong{
    display:block!important;
    margin-top:1px!important;
    font-size:11px!important;
    line-height:1.25!important;
}
.deadline-alert-item small{
    display:block!important;
    margin-top:3px!important;
    font-size:9px!important;
    color:#c82d45!important;
}
.deadline-alert-empty{
    padding:20px 12px!important;
    text-align:center!important;
    color:var(--muted)!important;
    font-size:10px!important;
}
.deadline-alert-footer{
    display:block!important;
    padding:10px 12px!important;
    border-top:1px solid #edf1f6!important;
    text-align:center!important;
    text-decoration:none!important;
    color:#1764c7!important;
    font-size:10px!important;
    font-weight:800!important;
}

/* keep responsive card stacking */
@media(max-width:1450px){
    .reference-workspace{
        grid-template-columns:1fr!important;
    }
    .list-head,.appeal-row{
        grid-template-columns:
            70px
            88px
            minmax(140px,1.2fr)
            minmax(115px,1fr)
            96px
            145px!important;
        gap:6px!important;
    }
}


/* ===== PRIEMNAYA49 V3.1.8 ===== */

/* Deadline: keep days exactly under the date badge */
.list-control-cell{
    align-items:center!important;
    justify-content:center!important;
}
.list-control-cell small{
    display:block!important;
    width:100%!important;
    text-align:center!important;
    margin:0!important;
    padding:0!important;
}
.deadline-chip{
    margin:0 auto!important;
}

/* File picker: no stray "Ф" / no placeholder block before a file is selected */
.file-picker-name[hidden]{
    display:none!important;
}
.file-picker{
    min-width:0!important;
}
.file-picker-name{
    display:block!important;
    max-width:100%!important;
    margin-top:5px!important;
    padding:5px 7px!important;
    border-radius:7px!important;
    background:#f4f7fb!important;
    color:#60748d!important;
    font-size:9.5px!important;
    line-height:1.25!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
}
.history-form-bottom{
    align-items:flex-end!important;
    gap:8px!important;
}
.history-form-bottom .file-picker{
    flex:1 1 auto!important;
}
.history-form-bottom .history-send{
    flex:0 0 auto!important;
}


/* ===== PRIEMNAYA49 V3.1.9 – equal history action cards ===== */

.history-actions{
    align-items:stretch!important;
}

.history-action-card{
    display:flex!important;
    flex-direction:column!important;
    height:100%!important;
}

/* Both headers have exactly the same height,
   so the horizontal divider starts on one line. */
.history-action-card>summary{
    min-height:74px!important;
    height:74px!important;
    box-sizing:border-box!important;
    padding:11px!important;
}

/* Both opened forms occupy the same vertical space. */
.history-action-card[open] .history-action-form{
    flex:1 1 auto!important;
    display:flex!important;
    flex-direction:column!important;
    box-sizing:border-box!important;
    padding:10px!important;
}

.history-action-card[open] .history-action-form textarea{
    height:118px!important;
    min-height:118px!important;
    max-height:118px!important;
    box-sizing:border-box!important;
    resize:none!important;
}

.history-action-card[open] .history-form-bottom{
    margin-top:auto!important;
    min-height:39px!important;
}

/* Keep both cards visually identical left/right. */
.history-action-card>summary>span:nth-child(2){
    min-width:0!important;
}
.history-action-card>summary b{
    line-height:1.2!important;
}
.history-action-card>summary small{
    line-height:1.2!important;
    min-height:25px!important;
}

/* File controls should not create a tiny extra box when nothing is chosen. */
.file-picker-name[hidden]{
    display:none!important;
}


/* ===== PRIEMNAYA49 V3.1.10 – history footer layout fix ===== */

/* The empty area between file chooser and send button must NOT be clickable. */
.history-action-card .history-form-bottom,
.history-compose-card .history-form-bottom{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    column-gap:10px!important;
    align-items:end!important;
    justify-content:normal!important;
    width:100%!important;
}

/* File picker only occupies its visible content, not the whole free space. */
.history-action-card .history-form-bottom .file-picker,
.history-compose-card .history-form-bottom .file-picker{
    display:inline-flex!important;
    align-items:center!important;
    gap:7px!important;
    width:max-content!important;
    max-width:100%!important;
    min-width:0!important;
    flex:none!important;
    justify-self:start!important;
    position:relative!important;
}

/* Only the visible picker control itself is clickable. */
.history-action-card .file-picker-button,
.history-compose-card .file-picker-button{
    flex:0 0 auto!important;
    white-space:nowrap!important;
}

/* Selected filename stays beside the picker when there is enough room. */
.history-action-card .file-picker-name:not([hidden]),
.history-compose-card .file-picker-name:not([hidden]){
    display:block!important;
    max-width:150px!important;
    margin:0!important;
    flex:0 1 150px!important;
}

/* Send buttons stay inside the card and never overlap the picker. */
.history-action-card .history-send,
.history-compose-card .history-send{
    position:static!important;
    width:auto!important;
    min-width:0!important;
    max-width:100%!important;
    justify-self:end!important;
    flex:none!important;
    white-space:normal!important;
    line-height:1.15!important;
}

/* When the detail panel is narrow at the right side, make controls compact
   instead of letting them collide. */
@media(min-width:1451px){
    .history-action-card .history-form-bottom{
        grid-template-columns:minmax(0,1fr) auto!important;
        column-gap:7px!important;
    }

    .history-action-card .file-picker-button{
        padding-left:7px!important;
        padding-right:7px!important;
        font-size:10px!important;
    }

    .history-action-card .history-send{
        padding-left:9px!important;
        padding-right:9px!important;
        font-size:10px!important;
    }

    .history-action-card .file-picker-name:not([hidden]){
        max-width:95px!important;
        flex-basis:95px!important;
    }
}

/* If any single action card itself becomes too narrow, stack just its footer.
   The two main cards remain aligned. */
@media(max-width:1050px){
    .history-action-card .history-form-bottom,
    .history-compose-card .history-form-bottom{
        grid-template-columns:1fr!important;
        row-gap:7px!important;
    }

    .history-action-card .history-send,
    .history-compose-card .history-send{
        justify-self:stretch!important;
        width:100%!important;
    }
}


/* ===== PRIEMNAYA49 V3.1.11 – single file control ===== */

/* Bottom row: visible file button on the left, send button on the right. */
.history-action-card .history-form-bottom,
.history-compose-card .history-form-bottom{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    gap:10px!important;
    align-items:end!important;
    width:100%!important;
}

/* Label must only be as wide as its actual visible contents. */
.history-action-card .file-picker,
.history-compose-card .file-picker{
    display:flex!important;
    flex-wrap:wrap!important;
    align-items:center!important;
    gap:7px!important;
    width:max-content!important;
    max-width:100%!important;
    min-width:0!important;
    position:relative!important;
    justify-self:start!important;
}

/* Native input is completely hidden; no browser 'Файл не выбран' control can leak out. */
.history-action-card .file-picker input[type="file"],
.history-compose-card .file-picker input[type="file"]{
    position:absolute!important;
    width:1px!important;
    height:1px!important;
    opacity:0!important;
    pointer-events:none!important;
    overflow:hidden!important;
    clip:rect(0 0 0 0)!important;
    clip-path:inset(50%)!important;
    white-space:nowrap!important;
}

/* This is the only file-selection button. */
.history-action-card .file-picker-button,
.history-compose-card .file-picker-button{
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:auto!important;
    min-width:0!important;
    height:32px!important;
    padding:0 10px!important;
    border:1px solid #d7e0eb!important;
    border-radius:7px!important;
    background:#fff!important;
    color:#52677f!important;
    font-size:10.5px!important;
    font-weight:700!important;
    line-height:1!important;
    white-space:nowrap!important;
    cursor:pointer!important;
}

/* After selection this is INFORMATION, not another button. */
.history-action-card .file-picker-name,
.history-compose-card .file-picker-name{
    display:flex!important;
    flex-direction:column!important;
    align-items:flex-start!important;
    gap:1px!important;
    max-width:190px!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    border-radius:0!important;
    background:transparent!important;
    color:#60748d!important;
    white-space:normal!important;
    overflow:hidden!important;
    cursor:default!important;
}
.history-action-card .file-picker-name[hidden],
.history-compose-card .file-picker-name[hidden]{
    display:none!important;
}
.history-action-card .file-picker-name b,
.history-compose-card .file-picker-name b{
    font-size:9px!important;
    line-height:1.15!important;
    color:#188755!important;
}
.history-action-card .file-picker-name span,
.history-compose-card .file-picker-name span{
    display:block!important;
    max-width:190px!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
    font-size:9px!important;
    line-height:1.2!important;
    color:#60748d!important;
}

/* Selected state only changes the one visible picker button. */
.history-action-card .file-picker.has-file .file-picker-button,
.history-compose-card .file-picker.has-file .file-picker-button{
    border-color:#b8d9c6!important;
    background:#f4fbf7!important;
    color:#188755!important;
}

/* Send button remains completely separate. */
.history-action-card .history-send,
.history-compose-card .history-send{
    position:static!important;
    justify-self:end!important;
    width:auto!important;
    min-width:0!important;
    max-width:100%!important;
    height:32px!important;
    padding:0 11px!important;
    white-space:normal!important;
    line-height:1.1!important;
}

/* Narrow right-side detail card: keep controls from overlapping. */
@media(min-width:1451px){
    .history-action-card .file-picker-button{
        padding:0 8px!important;
        font-size:10px!important;
    }
    .history-action-card .history-send{
        padding:0 9px!important;
        font-size:10px!important;
    }
    .history-action-card .file-picker-name,
    .history-action-card .file-picker-name span{
        max-width:105px!important;
    }
}

/* When the detail card is stacked below and wide, keep the clean horizontal layout. */
@media(max-width:1050px){
    .history-action-card .history-form-bottom,
    .history-compose-card .history-form-bottom{
        grid-template-columns:minmax(0,1fr) auto!important;
        gap:10px!important;
    }
    .history-action-card .history-send,
    .history-compose-card .history-send{
        width:auto!important;
        justify-self:end!important;
    }
}


/* ===== PRIEMNAYA49 V3.1.12 – clean attached-file card ===== */

/* Footer: left attachment area + right send button */
.history-action-card .history-form-bottom,
.history-compose-card .history-form-bottom{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    gap:10px!important;
    align-items:end!important;
    width:100%!important;
}

/* Wrapper only occupies visible content */
.file-control{
    width:max-content!important;
    max-width:100%!important;
    min-width:0!important;
    justify-self:start!important;
}

/* Picker before a file is selected */
.file-picker{
    display:inline-flex!important;
    width:auto!important;
    max-width:100%!important;
    position:relative!important;
    margin:0!important;
}
.file-picker[hidden]{
    display:none!important;
}
.file-picker input[type="file"]{
    position:absolute!important;
    width:1px!important;
    height:1px!important;
    opacity:0!important;
    overflow:hidden!important;
    clip:rect(0 0 0 0)!important;
    clip-path:inset(50%)!important;
    pointer-events:none!important;
}
.file-picker-button{
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    width:auto!important;
    height:32px!important;
    padding:0 10px!important;
    border:1px solid #d7e0eb!important;
    border-radius:7px!important;
    background:#fff!important;
    color:#52677f!important;
    font-size:10.5px!important;
    font-weight:700!important;
    line-height:1!important;
    white-space:nowrap!important;
    cursor:pointer!important;
}

/* File already attached: information card, NOT another picker button */
.attached-file-card{
    position:relative!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:flex-start!important;
    justify-content:center!important;
    min-width:150px!important;
    max-width:210px!important;
    min-height:44px!important;
    padding:7px 30px 7px 9px!important;
    border:1px solid #cfe8d9!important;
    border-radius:8px!important;
    background:#f7fcf9!important;
    overflow:visible!important;
}
.attached-file-card[hidden]{
    display:none!important;
}
.attached-file-ok{
    display:block!important;
    color:#188755!important;
    font-size:9px!important;
    line-height:1.15!important;
    font-weight:800!important;
    margin:0 0 2px!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
}
.attached-file-name{
    display:block!important;
    max-width:100%!important;
    color:#5f7188!important;
    font-size:9px!important;
    line-height:1.2!important;
    font-weight:600!important;
    white-space:nowrap!important;
    overflow:hidden!important;
    text-overflow:ellipsis!important;
    margin:0!important;
    padding:0!important;
    border:0!important;
    background:transparent!important;
}

/* Small X at top-right of the attached file card */
.attached-file-remove{
    position:absolute!important;
    top:5px!important;
    right:6px!important;
    width:18px!important;
    height:18px!important;
    min-width:18px!important;
    padding:0!important;
    border:0!important;
    border-radius:50%!important;
    background:#e9f3ed!important;
    color:#567063!important;
    font-size:14px!important;
    line-height:18px!important;
    font-weight:700!important;
    text-align:center!important;
    cursor:pointer!important;
}
.attached-file-remove:hover{
    background:#dcebe2!important;
    color:#1f4e35!important;
}

/* Send button remains completely separate and cannot overlap */
.history-action-card .history-send,
.history-compose-card .history-send{
    position:static!important;
    justify-self:end!important;
    align-self:end!important;
    width:auto!important;
    min-width:0!important;
    max-width:100%!important;
    height:32px!important;
    padding:0 11px!important;
    white-space:normal!important;
    line-height:1.1!important;
}

/* Narrow right-side detail column */
@media(min-width:1451px){
    .history-action-card .file-picker-button{
        padding:0 8px!important;
        font-size:10px!important;
    }

    .history-action-card .attached-file-card{
        min-width:130px!important;
        max-width:165px!important;
    }

    .history-action-card .history-send{
        padding:0 8px!important;
        font-size:10px!important;
    }
}

/* Wide stacked detail: keep a clean horizontal footer */
@media(max-width:1050px){
    .history-action-card .history-form-bottom,
    .history-compose-card .history-form-bottom{
        grid-template-columns:minmax(0,1fr) auto!important;
        gap:10px!important;
    }
}

/* Very narrow screens only: stack, never overlap */
@media(max-width:620px){
    .history-action-card .history-form-bottom,
    .history-compose-card .history-form-bottom{
        grid-template-columns:1fr!important;
        row-gap:8px!important;
    }
    .history-action-card .history-send,
    .history-compose-card .history-send{
        justify-self:stretch!important;
        width:100%!important;
    }
}


/* ===== PRIEMNAYA49 V3.1.13 – responsive history footer final fix ===== */

/* Base state: clean horizontal row for wide action cards */
.history-action-card .history-form-bottom,
.history-compose-card .history-form-bottom{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    gap:10px!important;
    align-items:center!important;
    width:100%!important;
}

.history-action-card .file-control,
.history-compose-card .file-control{
    justify-self:start!important;
    align-self:center!important;
    min-width:0!important;
    max-width:100%!important;
}

.history-action-card .history-send,
.history-compose-card .history-send{
    justify-self:end!important;
    align-self:center!important;
    margin:0!important;
}

/* Attached card should not push the send button lower */
.history-action-card .attached-file-card,
.history-compose-card .attached-file-card{
    margin:0!important;
    align-self:center!important;
}

/*
  When the appeal detail is on the RIGHT (desktop two-column workspace),
  each action card is narrow. In that mode we intentionally STACK the footer:
  1) file / attached-file area
  2) send button below it, full width
  This guarantees no overlap.
*/
@media(min-width:1451px){
    .history-action-card .history-form-bottom,
    .history-compose-card .history-form-bottom{
        grid-template-columns:1fr!important;
        row-gap:8px!important;
        align-items:stretch!important;
    }

    .history-action-card .file-control,
    .history-compose-card .file-control{
        justify-self:start!important;
        align-self:start!important;
        max-width:100%!important;
    }

    .history-action-card .history-send,
    .history-compose-card .history-send{
        justify-self:stretch!important;
        align-self:stretch!important;
        width:100%!important;
        margin:0!important;
    }

    .history-action-card .attached-file-card,
    .history-compose-card .attached-file-card{
        width:100%!important;
        max-width:100%!important;
        min-width:0!important;
    }

    .history-action-card .attached-file-name,
    .history-compose-card .attached-file-name{
        max-width:calc(100% - 8px)!important;
    }
}

/*
  When the appeal block has moved BELOW the list (<=1450px),
  there is enough room: keep file area + send button in one line
  and vertically CENTER them, so the send button no longer drops down
  when a file card is taller.
*/
@media(max-width:1450px){
    .history-action-card .history-form-bottom,
    .history-compose-card .history-form-bottom{
        grid-template-columns:minmax(0,1fr) auto!important;
        column-gap:12px!important;
        row-gap:0!important;
        align-items:center!important;
    }

    .history-action-card .history-send,
    .history-compose-card .history-send{
        justify-self:end!important;
        align-self:center!important;
        width:auto!important;
        margin:0!important;
    }

    .history-action-card .file-control,
    .history-compose-card .file-control{
        align-self:center!important;
    }

    .history-action-card .attached-file-card,
    .history-compose-card .attached-file-card{
        align-self:center!important;
        max-width:260px!important;
    }
}

/* Truly small screens: stack everything */
@media(max-width:700px){
    .history-action-card .history-form-bottom,
    .history-compose-card .history-form-bottom{
        grid-template-columns:1fr!important;
        row-gap:8px!important;
    }

    .history-action-card .history-send,
    .history-compose-card .history-send{
        justify-self:stretch!important;
        width:100%!important;
    }
}


/* ===== PRIEMNAYA49 V3.1.14 – attachment/footer alignment ===== */

/* Required visual gap from textarea to file/send controls */
.history-action-form .history-form-bottom,
.history-compose-card .history-form-bottom{
    margin-top:12px!important;
}

/* Never show picker together with attached-file card */
.file-control.has-file .file-picker{
    display:none!important;
}
.file-control:not(.has-file) .attached-file-card{
    display:none!important;
}

/* WIDE / detail moved below list:
   one clean horizontal row, same send-button level in both cards */
@media(max-width:1450px) and (min-width:701px){
    .history-action-card .history-form-bottom,
    .history-compose-card .history-form-bottom{
        display:grid!important;
        grid-template-columns:minmax(0,1fr) 150px!important;
        gap:14px!important;
        align-items:center!important;
        width:100%!important;
    }

    .history-action-card .file-control,
    .history-compose-card .file-control{
        grid-column:1!important;
        grid-row:1!important;
        justify-self:start!important;
        align-self:center!important;
        width:auto!important;
        max-width:100%!important;
    }

    .history-action-card .history-send,
    .history-compose-card .history-send{
        grid-column:2!important;
        grid-row:1!important;
        justify-self:stretch!important;
        align-self:center!important;
        width:150px!important;
        height:34px!important;
        margin:0!important;
        padding:0 10px!important;
        font-size:10.5px!important;
        white-space:nowrap!important;
    }

    .history-action-card .attached-file-card,
    .history-compose-card .attached-file-card{
        min-width:210px!important;
        max-width:300px!important;
        min-height:46px!important;
        margin:0!important;
    }
}

/* NARROW / detail on the right:
   row 1 = file button (if no file) + compact send button
   row 2 = attached-file card only, full width.
   This prevents any overlap and clipping. */
@media(min-width:1451px){
    .history-action-card .history-form-bottom,
    .history-compose-card .history-form-bottom{
        display:grid!important;
        grid-template-columns:minmax(0,1fr) 132px!important;
        grid-template-rows:auto auto!important;
        column-gap:8px!important;
        row-gap:8px!important;
        align-items:center!important;
        width:100%!important;
    }

    .history-action-card .file-control,
    .history-compose-card .file-control{
        grid-column:1!important;
        grid-row:1!important;
        justify-self:start!important;
        align-self:center!important;
        width:auto!important;
        max-width:100%!important;
        min-width:0!important;
    }

    .history-action-card .history-send,
    .history-compose-card .history-send{
        grid-column:2!important;
        grid-row:1!important;
        justify-self:stretch!important;
        align-self:center!important;
        width:132px!important;
        height:32px!important;
        min-width:132px!important;
        max-width:132px!important;
        margin:0!important;
        padding:0 7px!important;
        font-size:9.5px!important;
        line-height:1.05!important;
        white-space:normal!important;
    }

    /* after file chosen: picker disappears; attachment card moves BELOW send row */
    .history-action-card .file-control.has-file,
    .history-compose-card .file-control.has-file{
        grid-column:1 / -1!important;
        grid-row:2!important;
        width:100%!important;
        justify-self:stretch!important;
    }

    .history-action-card .file-control.has-file .attached-file-card,
    .history-compose-card .file-control.has-file .attached-file-card{
        width:100%!important;
        max-width:100%!important;
        min-width:0!important;
        min-height:44px!important;
        margin:0!important;
    }

    .history-action-card .attached-file-name,
    .history-compose-card .attached-file-name{
        max-width:calc(100% - 12px)!important;
    }

    .history-action-card .file-picker-button,
    .history-compose-card .file-picker-button{
        height:32px!important;
        padding:0 8px!important;
        font-size:9.5px!important;
        white-space:nowrap!important;
    }
}

/* Keep both action cards balanced visually */
.history-actions{
    align-items:stretch!important;
}
.history-action-card{
    height:100%!important;
}

/* Small screens: stack safely */
@media(max-width:700px){
    .history-action-card .history-form-bottom,
    .history-compose-card .history-form-bottom{
        display:grid!important;
        grid-template-columns:1fr!important;
        gap:8px!important;
    }

    .history-action-card .file-control,
    .history-compose-card .file-control,
    .history-action-card .history-send,
    .history-compose-card .history-send{
        grid-column:1!important;
        width:100%!important;
        max-width:100%!important;
    }

    .history-action-card .history-send,
    .history-compose-card .history-send{
        justify-self:stretch!important;
    }
}


/* ===== PRIEMNAYA49 V3.1.15 – fixed attachment rows ===== */

/* Footer is ALWAYS:
   row 1: [Файл или фото] ........ [Отправить]
   row 2: [прикреплённый файл на всю ширину]
*/
.history-action-card .history-form-bottom,
.history-compose-card .history-form-bottom{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) 150px!important;
    grid-template-rows:auto auto!important;
    column-gap:12px!important;
    row-gap:10px!important;
    align-items:center!important;
    width:100%!important;
    margin-top:12px!important;
}

/* Let picker and attached card participate directly in the parent grid. */
.history-action-card .file-control,
.history-compose-card .file-control{
    display:contents!important;
}

/* File picker always remains visible, even after a file is selected. */
.history-action-card .file-picker,
.history-compose-card .file-picker,
.history-action-card .file-control.has-file .file-picker,
.history-compose-card .file-control.has-file .file-picker{
    display:inline-flex!important;
    grid-column:1!important;
    grid-row:1!important;
    justify-self:start!important;
    align-self:center!important;
    width:auto!important;
    max-width:100%!important;
    margin:0!important;
}

.history-action-card .file-picker-button,
.history-compose-card .file-picker-button{
    height:34px!important;
    padding:0 11px!important;
    font-size:10.5px!important;
    white-space:nowrap!important;
}

/* Send button is always in the same row and same size in both cards. */
.history-action-card .history-send,
.history-compose-card .history-send{
    grid-column:2!important;
    grid-row:1!important;
    justify-self:stretch!important;
    align-self:center!important;
    width:150px!important;
    min-width:150px!important;
    max-width:150px!important;
    height:34px!important;
    margin:0!important;
    padding:0 10px!important;
    font-size:10.5px!important;
    line-height:1.1!important;
    white-space:nowrap!important;
}

/* Attached file is ALWAYS a separate second row below BOTH buttons. */
.history-action-card .attached-file-card,
.history-compose-card .attached-file-card{
    grid-column:1 / -1!important;
    grid-row:2!important;
    justify-self:stretch!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    min-height:46px!important;
    margin:0!important;
    padding:8px 34px 8px 10px!important;
    box-sizing:border-box!important;
}
.history-action-card .attached-file-card[hidden],
.history-compose-card .attached-file-card[hidden]{
    display:none!important;
}
.history-action-card .attached-file-name,
.history-compose-card .attached-file-name{
    max-width:calc(100% - 6px)!important;
}

/* Narrow right-side detail: same structure, only make controls compact. */
@media(min-width:1451px){
    .history-action-card .history-form-bottom,
    .history-compose-card .history-form-bottom{
        grid-template-columns:minmax(0,1fr) 118px!important;
        column-gap:8px!important;
        row-gap:8px!important;
    }

    .history-action-card .file-picker-button,
    .history-compose-card .file-picker-button{
        height:31px!important;
        padding:0 7px!important;
        font-size:9.5px!important;
    }

    .history-action-card .history-send,
    .history-compose-card .history-send{
        width:118px!important;
        min-width:118px!important;
        max-width:118px!important;
        height:31px!important;
        padding:0 6px!important;
        font-size:9px!important;
        white-space:normal!important;
    }

    .history-action-card .attached-file-card,
    .history-compose-card .attached-file-card{
        min-height:42px!important;
        padding:7px 30px 7px 9px!important;
    }
}

/* Small screens only: stack picker and send, file card remains below. */
@media(max-width:700px){
    .history-action-card .history-form-bottom,
    .history-compose-card .history-form-bottom{
        grid-template-columns:1fr!important;
        grid-template-rows:auto auto auto!important;
    }

    .history-action-card .file-picker,
    .history-compose-card .file-picker{
        grid-column:1!important;
        grid-row:1!important;
    }

    .history-action-card .history-send,
    .history-compose-card .history-send{
        grid-column:1!important;
        grid-row:2!important;
        width:100%!important;
        min-width:0!important;
        max-width:100%!important;
    }

    .history-action-card .attached-file-card,
    .history-compose-card .attached-file-card{
        grid-column:1!important;
        grid-row:3!important;
    }
}


/* ===== PRIEMNAYA49 V3.1.16 – narrow right-side button spacing ===== */

/* More breathing room under textarea in all history forms */
.history-action-form .history-form-bottom,
.history-compose-card .history-form-bottom{
    margin-top:16px!important;
}

/* When appeal detail is on the RIGHT and each action card is narrow:
   make both buttons smaller and add a real gap between them. */
@media(min-width:1451px){
    .history-action-card .history-form-bottom,
    .history-compose-card .history-form-bottom{
        grid-template-columns:minmax(0,1fr) 108px!important;
        column-gap:12px!important;
        row-gap:10px!important;
    }

    .history-action-card .file-picker,
    .history-compose-card .file-picker{
        max-width:100%!important;
    }

    .history-action-card .file-picker-button,
    .history-compose-card .file-picker-button{
        height:30px!important;
        padding:0 6px!important;
        font-size:9px!important;
        border-radius:7px!important;
        white-space:nowrap!important;
    }

    .history-action-card .history-send,
    .history-compose-card .history-send{
        width:108px!important;
        min-width:108px!important;
        max-width:108px!important;
        height:30px!important;
        padding:0 5px!important;
        font-size:8.8px!important;
        border-radius:7px!important;
        white-space:normal!important;
        line-height:1.05!important;
    }

    .history-action-card .attached-file-card,
    .history-compose-card .attached-file-card{
        margin-top:2px!important;
    }
}


/* ===== PRIEMNAYA49 V3.1.17 – equal vertical spacing ===== */

/* One spacing variable for the whole footer */
.history-action-card,
.history-compose-card{
    --history-footer-gap:14px;
}

/* Exactly the same distance from textarea to buttons */
.history-action-form .history-form-bottom,
.history-compose-card .history-form-bottom{
    margin-top:var(--history-footer-gap)!important;
    row-gap:var(--history-footer-gap)!important;
}

/* Exactly the same distance from the buttons row to attached-file card */
.history-action-card .attached-file-card,
.history-compose-card .attached-file-card{
    margin-top:0!important;
}

/* Wide mode: same vertical rhythm */
@media(max-width:1450px) and (min-width:701px){
    .history-action-card .history-form-bottom,
    .history-compose-card .history-form-bottom{
        margin-top:var(--history-footer-gap)!important;
        row-gap:var(--history-footer-gap)!important;
    }
}

/* Narrow right-side mode: same spacing too */
@media(min-width:1451px){
    .history-action-card .history-form-bottom,
    .history-compose-card .history-form-bottom{
        margin-top:var(--history-footer-gap)!important;
        row-gap:var(--history-footer-gap)!important;
    }

    .history-action-card .attached-file-card,
    .history-compose-card .attached-file-card{
        margin-top:0!important;
    }
}


/* ===== PRIEMNAYA49 V3.1.18 – exact equal 7px gaps ===== */

/*
  IMPORTANT:
  Old CSS contains:
  .history-action-card[open] .history-form-bottom { margin-top:auto!important; }
  It had higher specificity and was overriding the later spacing rules.
  Override that exact rule here.
*/

.history-action-card[open] .history-action-form .history-form-bottom,
.history-compose-card form .history-form-bottom{
    margin-top:7px!important;
    row-gap:7px!important;
}

/* File card sits exactly 7px below the button row via grid row-gap only. */
.history-action-card[open] .history-action-form .attached-file-card,
.history-compose-card form .attached-file-card{
    margin-top:0!important;
}

/* Keep the same 7px rhythm in both layout modes. */
@media(min-width:1451px){
    .history-action-card[open] .history-action-form .history-form-bottom,
    .history-compose-card form .history-form-bottom{
        margin-top:7px!important;
        row-gap:7px!important;
    }
}

@media(max-width:1450px) and (min-width:701px){
    .history-action-card[open] .history-action-form .history-form-bottom,
    .history-compose-card form .history-form-bottom{
        margin-top:7px!important;
        row-gap:7px!important;
    }
}

/* No extra margins on controls that could visually change the gap. */
.history-action-card[open] .history-action-form .file-picker,
.history-action-card[open] .history-action-form .history-send,
.history-action-card[open] .history-action-form .attached-file-card,
.history-compose-card form .file-picker,
.history-compose-card form .history-send,
.history-compose-card form .attached-file-card{
    margin-top:0!important;
    margin-bottom:0!important;
}
