*{box-sizing:border-box}body{margin:0;background:#f4f5f7;color:#222;font:16px/1.45 system-ui,-apple-system,Segoe UI,sans-serif}a{color:#2656c7;text-decoration:none}button,.btn{border:0;border-radius:10px;padding:11px 16px;background:#2656c7;color:#fff;font-weight:700;cursor:pointer}input,textarea{width:100%;border:1px solid #ccd1da;border-radius:10px;padding:12px;font:inherit}label{display:block;margin:12px 0}.card,.admin,.chat-shell{max-width:1000px;margin:30px auto;background:#fff;border-radius:18px;padding:22px;box-shadow:0 8px 30px #0001}.narrow{max-width:520px}.grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}header{display:flex;justify-content:space-between;align-items:center;gap:16px;border-bottom:1px solid #eee;padding-bottom:14px}.messages{height:55vh;overflow:auto;padding:18px 0;display:flex;flex-direction:column;gap:10px}.msg{max-width:78%;padding:10px 13px;border-radius:14px;background:#eef1f5}.msg.admin{align-self:flex-end;background:#dce8ff}.msg p{margin:0 0 4px}.msg small{opacity:.6;font-size:12px}.msg img{max-width:100%;border-radius:10px}.composer{display:flex;gap:8px;align-items:center}.composer input[name=body]{flex:1}.attach input{display:none}.attach{font-size:25px;margin:0;cursor:pointer}.hidden{display:none!important}.rating{border-top:1px solid #eee;padding-top:15px}.stars{display:flex;gap:8px}.stars input{width:auto}.stars label{font-size:30px}.chat-row{display:grid;grid-template-columns:150px 1fr 120px;gap:14px;padding:15px;border-bottom:1px solid #eee;color:inherit}.badge{background:#e53935;color:#fff;border-radius:999px;padding:2px 7px}.quick{display:flex;flex-wrap:wrap;gap:7px;margin:10px 0}.quick button{background:#eef1f5;color:#222}.danger{background:#c62828;margin-top:12px}.qr-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:20px}.qr-grid article{text-align:center;border:1px solid #eee;border-radius:14px;padding:15px}.qr img{margin:auto}table{width:100%;border-collapse:collapse}th,td{text-align:left;padding:10px;border-bottom:1px solid #eee}.ok{color:green}.error{color:#b00020}@media(max-width:650px){.card,.admin,.chat-shell{margin:0;min-height:100vh;border-radius:0}.chat-row{grid-template-columns:1fr}.composer button{padding:11px}.grid{grid-template-columns:1fr}}

.secondary{background:#5d6470;margin-top:12px}

.attach.selected{background:#dce8ff;border-radius:10px;padding:4px 8px}.empty{color:#777;text-align:center}.composer button:disabled{opacity:.55;cursor:wait}

.brand-block{display:flex;align-items:center;gap:12px}.brand-logo{width:48px;height:48px;border-radius:12px;object-fit:contain;background:#fff;border:1px solid #e7e9ee}.welcome-card{display:flex;gap:14px;align-items:flex-start;background:linear-gradient(135deg,#eef4ff,#f8fbff);border:1px solid #dce8ff;border-radius:16px;padding:16px;margin:16px 0 2px}.welcome-card h2{margin:0 0 5px;font-size:19px}.welcome-card p{margin:0 0 6px}.welcome-icon{font-size:30px}.image-preview{display:flex;align-items:center;gap:12px;border:1px solid #d6dbe5;background:#fafbfc;border-radius:14px;padding:10px;margin:10px 0}.image-preview img{width:72px;height:72px;object-fit:cover;border-radius:10px}.image-preview div{min-width:0;flex:1}.image-preview strong,.image-preview small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.image-preview small{color:#717782}.icon-btn{background:#eef1f5;color:#333;font-size:22px;padding:6px 11px}.notice{padding:12px;border-radius:10px;background:#e8f6ec;color:#176a32}.settings-form{display:grid;gap:18px}.settings-section{border:1px solid #e6e8ed;border-radius:14px;padding:16px}.settings-section h2{margin-top:0}.logo-preview{display:flex;align-items:center;gap:16px}.logo-preview img{width:100px;height:100px;object-fit:contain;border:1px solid #ddd;border-radius:14px}.inline-check{display:flex;align-items:center;gap:8px}.inline-check input{width:auto}.muted{color:#6e7480;margin:4px 0}.header-actions{display:flex;align-items:center;gap:12px}.qr-page{max-width:1200px}.qr-grid{grid-template-columns:repeat(auto-fit,minmax(285px,1fr));align-items:stretch}.qr-card{display:flex;flex-direction:column;align-items:center;overflow:hidden;min-width:0}.qr-card h2{margin:10px 0 2px}.qr-hint{font-size:13px;color:#6e7480;margin:0 0 10px;max-width:240px}.qr-brand{display:flex;align-items:center;gap:8px;font-weight:700}.qr-brand img{width:34px;height:34px;object-fit:contain;border-radius:8px}.qr{background:#fff;padding:8px;border-radius:10px}.qr-url{width:100%;font:12px/1.35 ui-monospace,SFMono-Regular,Consolas,monospace;color:#69707c;background:#f4f5f7;border-radius:8px;padding:8px;margin-top:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.qr-actions{display:flex;gap:7px;margin-top:12px;flex-wrap:wrap;justify-content:center}.qr-actions button,.qr-actions .btn{font-size:13px;padding:8px 10px}.qr-actions .secondary{background:#eef1f5;color:#222}
@media print{body{background:#fff}.admin{box-shadow:none;margin:0;max-width:none}.qr-page>header,.qr-actions,.qr-url{display:none!important}.qr-grid{grid-template-columns:repeat(2,1fr);gap:12mm}.qr-card{break-inside:avoid;border:1px solid #bbb!important;padding:8mm!important}.qr img,.qr canvas{width:48mm!important;height:48mm!important}}
@media(max-width:650px){.brand-header{align-items:flex-start}.brand-header nav{font-size:13px}.welcome-card{margin-top:12px}.qr-grid{grid-template-columns:1fr}.header-actions{flex-wrap:wrap;justify-content:flex-end}.image-preview img{width:58px;height:58px}}

.admin-nav{display:flex;align-items:center;justify-content:flex-end;gap:12px;flex-wrap:wrap}.admin-nav a{white-space:nowrap}.home-link{font-weight:800}.notification-bell{position:relative;display:inline-flex;align-items:center;justify-content:center;width:42px;height:42px;border-radius:50%;background:#eef1f5;font-size:21px;line-height:1}.notification-bell.has-unread{background:#fff0f0;box-shadow:0 0 0 2px #ffd2d2}.bell-badge{position:absolute;right:-5px;top:-6px;min-width:21px;height:21px;padding:0 5px;border-radius:999px;background:#e53935;color:#fff;font-size:12px;font-weight:800;display:flex;align-items:center;justify-content:center;border:2px solid #fff}.notification-bell.ringing{animation:bell-ring .7s ease}.closed-row{opacity:.68;background:#fafafa}.closed-row em{color:#737985}@keyframes bell-ring{0%,100%{transform:rotate(0)}15%{transform:rotate(16deg)}30%{transform:rotate(-14deg)}45%{transform:rotate(10deg)}60%{transform:rotate(-8deg)}75%{transform:rotate(4deg)}}
@media(max-width:760px){.admin header{align-items:flex-start;flex-direction:column}.admin-nav{justify-content:flex-start;width:100%;gap:8px}.admin-nav a:not(.notification-bell){background:#f4f5f7;padding:7px 9px;border-radius:8px;font-size:13px}}

.category-panel{border:1px solid #e5e9f0;border-radius:16px;padding:14px;margin:14px 0}.category-panel h3{margin:0 0 10px;font-size:16px}.category-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:8px}.category-btn{background:#f3f5f8;color:#253047;text-align:left;padding:11px;border:1px solid transparent}.category-btn.active{background:#e5efff;border-color:#8fb5ff;color:#173f8f}.dashboard-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin:18px 0}.dashboard-stats div{border:1px solid #e5e8ee;border-radius:14px;padding:14px;background:#fafbfc}.dashboard-stats strong{display:block;font-size:27px}.dashboard-stats span{color:#69707c;font-size:13px}.dashboard-stats .stat-new{background:#fff4f3;border-color:#ffd6d2}.list-toolbar{display:flex;justify-content:space-between;margin-bottom:8px}.filter-btn{display:inline-block;padding:8px 12px;border-radius:9px;background:#f1f3f6;color:#333;margin-right:6px}.filter-btn.active{background:#2656c7;color:#fff}.category-label{display:block;margin-top:4px;color:#6c7380;font-weight:500}.state-chip{display:inline-flex;padding:4px 8px;border-radius:999px;font-style:normal;font-size:12px;font-weight:800;margin-right:6px}.state-new{background:#ffe7e4;color:#a8281f}.state-in_progress{background:#e3edff;color:#2453a4}.state-waiting{background:#fff1c9;color:#805d00}.state-done{background:#e5f5e9;color:#22713a}.workflow-bar{display:flex;gap:7px;flex-wrap:wrap;margin:10px 0}.workflow-bar button{background:#eef1f5;color:#222;padding:8px 11px}@media(max-width:700px){.dashboard-stats{grid-template-columns:1fr 1fr}.category-grid{grid-template-columns:1fr 1fr}}

/* v8: редактор быстрых ответов */
.quick-replies-page{max-width:1180px}.reply-editor-card,.reply-list-section{border:1px solid #e4e8ef;border-radius:16px;padding:18px;margin-top:18px;background:#fff}.reply-editor-card h2,.reply-list-section h2{margin:0 0 12px}.reply-editor-form textarea{resize:vertical;min-height:105px}.form-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.form-actions .secondary{margin-top:0}.section-heading{display:flex;justify-content:space-between;align-items:center;gap:12px}.reply-list{display:grid;gap:12px}.reply-item{display:grid;grid-template-columns:55px minmax(0,1fr) auto;gap:14px;align-items:center;border:1px solid #e5e8ee;border-radius:14px;padding:14px;background:#fafbfc}.reply-disabled{opacity:.62;background:#f2f3f5}.reply-order{display:flex;flex-direction:column;align-items:center;gap:4px}.reply-order form,.reply-actions form{margin:0}.small-icon{width:32px;height:28px;padding:0;border-radius:8px;background:#e9edf4;color:#273143;font-size:17px}.reply-title-line{display:flex;align-items:center;gap:9px;flex-wrap:wrap}.reply-title-line h3{margin:0}.reply-content p{margin:7px 0}.reply-en{color:#687180;font-size:14px}.reply-actions{display:flex;align-items:center;justify-content:flex-end;gap:7px;flex-wrap:wrap}.compact{padding:8px 10px;font-size:13px;margin:0}.error-box{padding:12px;border-radius:10px;background:#fff0f1;color:#a31124;border:1px solid #ffd0d5}
@media(max-width:800px){.reply-item{grid-template-columns:42px 1fr}.reply-actions{grid-column:1/-1;justify-content:flex-start}.quick-replies-page .grid{grid-template-columns:1fr}}
.assignment-bar{display:flex;justify-content:flex-end;margin:10px 0}.assignment-bar label{display:flex;align-items:center;gap:10px;font-weight:600}.assignment-bar select,.settings-card select{min-width:220px;padding:10px;border:1px solid #d7dce5;border-radius:10px;background:#fff}.staff-list{min-width:0}.staff-row{display:grid;grid-template-columns:minmax(180px,1fr) auto auto auto;gap:10px;align-items:center;padding:12px 0;border-bottom:1px solid #eceff4}.staff-row small,.assigned-label{display:block;color:#6b7280;margin-top:4px}.danger.small{padding:8px 10px}.check-row{display:flex!important;align-items:center;gap:8px}.check-row input{width:auto!important}@media(max-width:760px){.staff-row{grid-template-columns:1fr auto}.staff-row form,.staff-row>a{justify-self:start}.assignment-bar{justify-content:stretch}.assignment-bar label,.assignment-bar select{width:100%}}


.room-code{display:block;color:#6b7280;font-size:.78rem;margin-top:.15rem}
.rooms-admin-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:16px}
.room-admin-card{display:flex;flex-direction:column;gap:12px}
.room-admin-card form{display:grid;gap:10px}
.room-admin-card h2{margin:0 0 6px}
.settings-form small,.muted{display:block;color:#697386;font-size:.85rem;margin-top:.35rem}.form-actions{display:flex;gap:.65rem;flex-wrap:wrap;margin-top:.8rem}.form-actions .secondary{background:#596273}
.backup-list{display:grid;gap:10px}.backup-row{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px;border:1px solid #e5e7eb;border-radius:12px;background:#fff}.button-link{display:inline-flex;align-items:center;justify-content:center;padding:9px 13px;border-radius:9px;background:#2563eb;color:#fff;text-decoration:none;font-weight:600}.danger{background:#b91c1c}.backup-row form{margin:0}@media(max-width:700px){.backup-row{align-items:flex-start;flex-direction:column}.backup-row .form-actions{width:100%}}
/* v15: центр уведомлений и журнал */
.notification-wrap{position:relative;display:inline-flex}.notification-bell{border:0;padding:0;color:inherit;cursor:pointer}.notification-panel{position:absolute;right:0;top:50px;width:min(390px,calc(100vw - 28px));max-height:520px;overflow:auto;background:#fff;border:1px solid #e1e5ec;border-radius:15px;box-shadow:0 18px 50px #0003;padding:12px;z-index:100}.notification-panel>strong{display:block;padding:4px 5px 10px}.notification-items{display:grid;gap:6px}.notification-item{display:grid;gap:3px;color:#202633;padding:10px;border-radius:10px;background:#f6f8fb}.notification-item:hover{background:#eaf1ff}.notification-item span{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.notification-item small{color:#6e7480}.notification-empty{padding:18px 8px;text-align:center;color:#6e7480}.notification-all{display:block;text-align:center;padding:10px 5px 2px;font-weight:700}.activity-filters{display:flex;align-items:end;gap:10px;flex-wrap:wrap;margin:18px 0}.activity-filters label{min-width:190px;margin:0}.activity-filters select{width:100%;padding:10px;border:1px solid #ccd1da;border-radius:10px;background:#fff}.activity-list{display:grid;gap:9px}.activity-row{display:grid;grid-template-columns:minmax(170px,240px) 1fr auto;align-items:center;gap:14px;border:1px solid #e5e8ee;border-radius:12px;padding:12px;background:#fafbfc}.activity-row p{margin:0}.activity-row small{color:#707783;white-space:nowrap}.activity-action{display:block;color:#315ea8;font-size:12px;font-weight:800;text-transform:uppercase;margin-top:3px}@media(max-width:760px){.notification-panel{position:fixed;left:14px;right:14px;top:72px;width:auto}.activity-row{grid-template-columns:1fr}.activity-row small{white-space:normal}}

/* v16: dashboard и расширенный поиск */
.dashboard-page{max-width:1280px}.dashboard-page h1{margin:0}.dashboard-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:20px 0}.dashboard-kpis article{display:grid;gap:5px;border:1px solid #e3e7ee;border-radius:16px;padding:17px;background:linear-gradient(145deg,#fff,#f8fafc)}.dashboard-kpis article>span{color:#687180;font-size:13px;font-weight:700}.dashboard-kpis strong{font-size:31px;line-height:1.1}.dashboard-kpis small{color:#78808c}.dashboard-kpis .kpi-alert{background:linear-gradient(145deg,#fff7f6,#fff);border-color:#ffd8d3}.dashboard-kpis .kpi-time{font-size:23px}.dashboard-overview{display:grid;grid-template-columns:1fr 1.35fr 1.15fr;gap:14px;margin-bottom:15px}.dashboard-card{border:1px solid #e3e7ee;border-radius:16px;padding:17px;background:#fff}.dashboard-card h2{margin:0;font-size:18px}.status-summary{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin-top:15px}.status-summary div{padding:12px;border-radius:12px;background:#f5f7fa}.status-summary b{display:block;font-size:24px}.status-summary span{color:#687180;font-size:12px}.category-bars{display:grid;gap:10px;margin-top:15px}.category-bars>div{display:grid;grid-template-columns:minmax(135px,1fr) 1.4fr 30px;align-items:center;gap:9px;font-size:13px}.category-bars i{display:block;height:8px;border-radius:999px;background:#edf0f4;overflow:hidden}.category-bars em{display:block;height:100%;border-radius:inherit;background:#4a77d4}.category-bars b{text-align:right}.recent-ratings{display:grid;gap:7px;margin-top:12px}.recent-ratings a{display:grid;grid-template-columns:1fr auto;gap:2px 8px;padding:9px;border-radius:10px;background:#f7f8fa;color:#252b35}.recent-ratings small{grid-column:1/-1;color:#747b87}.rating-stars{color:#eea400;letter-spacing:1px}.search-card{margin-bottom:14px}.chat-search-form{display:grid;grid-template-columns:2fr repeat(3,minmax(140px,1fr)) repeat(2,minmax(130px,.8fr)) auto;gap:10px;align-items:end;margin-top:12px}.chat-search-form label{margin:0;font-size:12px;font-weight:700;color:#626b78}.chat-search-form input,.chat-search-form select{margin-top:5px;padding:10px;border:1px solid #ccd1da;border-radius:10px;background:#fff;width:100%}.chat-search-form button{height:42px}.chat-row .chat-time{display:block;color:#7a818d;margin-top:4px;font-size:12px}.list-toolbar>span{align-self:center}
@media(max-width:1050px){.dashboard-kpis{grid-template-columns:repeat(2,1fr)}.dashboard-overview{grid-template-columns:1fr 1fr}.dashboard-overview .dashboard-card:last-child{grid-column:1/-1}.chat-search-form{grid-template-columns:repeat(3,1fr)}.chat-search-form .search-wide{grid-column:span 2}}
@media(max-width:700px){.dashboard-kpis,.dashboard-overview{grid-template-columns:1fr}.dashboard-overview .dashboard-card:last-child{grid-column:auto}.chat-search-form{grid-template-columns:1fr}.chat-search-form .search-wide{grid-column:auto}.status-summary{grid-template-columns:repeat(3,1fr)}.category-bars>div{grid-template-columns:minmax(115px,1fr) 1fr 25px}}

/* v17: метки и внутренние заметки */
.chat-workspace{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:20px}.chat-main{min-width:0}.collaboration-panel{display:flex;flex-direction:column;gap:16px}.collaboration-panel>section{border:1px solid #e4e7ec;border-radius:15px;padding:15px;background:#fafbfc}.collaboration-panel h2{font-size:18px;margin:0 0 8px}.tag-editor{display:flex;flex-wrap:wrap;gap:8px}.tag-option{margin:0;cursor:pointer}.tag-option input{position:absolute;opacity:0;pointer-events:none}.tag-option span,.chat-tag{display:inline-flex;align-items:center;border-radius:999px;padding:6px 10px;font-size:13px;font-weight:750;border:1px solid transparent}.tag-option input:not(:checked)+span{filter:grayscale(.65);opacity:.48;background:#eef1f5!important;color:#4f5661!important;border-color:#dfe3e8!important}.tag-editor button{width:100%;margin-top:5px}.active-tags{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}.tag-urgent span,.chat-tag.tag-urgent{background:#ffe5e5;color:#a31212;border-color:#ffcaca}.tag-vip span,.chat-tag.tag-vip{background:#fff3c9;color:#755700;border-color:#ffe394}.tag-maintenance span,.chat-tag.tag-maintenance{background:#e7efff;color:#174b9c;border-color:#cbdcff}.tag-housekeeping span,.chat-tag.tag-housekeeping{background:#e5f8eb;color:#176934;border-color:#c4ebd0}.tag-complaint span,.chat-tag.tag-complaint{background:#ffe9d6;color:#994500;border-color:#ffd0a7}.tag-followup span,.chat-tag.tag-followup{background:#eee8ff;color:#5d31a7;border-color:#dcd0ff}.notes-list{display:flex;flex-direction:column;gap:10px;margin-top:12px;max-height:430px;overflow:auto}.notes-list article{background:#fff;border:1px solid #e4e7ec;border-radius:12px;padding:11px}.notes-list article>div{display:flex;justify-content:space-between;gap:8px}.notes-list time{font-size:12px;color:#777}.notes-list p{margin:7px 0;white-space:normal;overflow-wrap:anywhere}.note-delete{background:transparent;color:#b42318;padding:3px 0;font-size:12px}.chat-row-tags{display:flex;gap:4px;flex-wrap:wrap;margin-top:5px}.chat-row-tags .chat-tag{padding:2px 6px;font-size:11px}@media(max-width:980px){.chat-workspace{grid-template-columns:1fr}.collaboration-panel{display:grid;grid-template-columns:1fr 1fr}.messages{height:48vh}}@media(max-width:650px){.collaboration-panel{grid-template-columns:1fr}}

/* v18: журнал номера */
.room-profile-page .back-link{display:inline-block;margin-bottom:8px;text-decoration:none;font-weight:700}
.room-admin-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.room-profile-link{display:inline-flex;align-items:center;justify-content:center;text-decoration:none}
.room-kpis{margin-top:18px}
.room-overview{grid-template-columns:repeat(3,minmax(0,1fr))}
.room-review-list,.room-note-list{display:grid;gap:10px}
.room-review-list>div,.room-note-list>a{display:block;padding:10px 0;border-bottom:1px solid #e5e7eb;text-decoration:none;color:inherit}
.room-review-list p,.room-note-list p{margin:5px 0 0;line-height:1.4}
.room-review-list small,.room-note-list small{display:block;color:#6b7280;margin-top:2px}
.room-history-card{margin-top:18px;overflow:hidden}
.room-history-table{display:grid;gap:0}
.room-history-head,.room-history-row{display:grid;grid-template-columns:120px minmax(240px,2fr) minmax(130px,1fr) 120px 90px;gap:14px;align-items:center;padding:12px 14px}
.room-history-head{font-size:.78rem;text-transform:uppercase;letter-spacing:.04em;color:#6b7280;background:#f8fafc;border-radius:10px}
.room-history-row{color:inherit;text-decoration:none;border-bottom:1px solid #eef2f7}
.room-history-row:hover{background:#f8fafc}
.room-history-row>span{min-width:0}
.room-history-row small{display:block;color:#6b7280;margin-top:3px}
.room-history-row .chat-row-tags{margin-top:6px}
@media(max-width:1000px){.room-overview{grid-template-columns:1fr}.room-history-head{display:none}.room-history-row{grid-template-columns:1fr 1fr}.room-history-row>span:nth-child(2){grid-column:1/-1;grid-row:1}.room-history-row>span:nth-child(1){grid-row:2}.room-history-row>span:nth-child(3){grid-row:2}.room-history-row>span:nth-child(4),.room-history-row>span:nth-child(5){grid-row:3}}
@media(max-width:600px){.room-history-row{grid-template-columns:1fr}.room-history-row>span{grid-column:1!important;grid-row:auto!important}.room-admin-actions{align-items:stretch}.room-admin-actions>*{flex:1}}
.system-checks{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:10px}.system-check{display:flex;gap:10px;align-items:center;padding:12px;border:1px solid #ddd;border-radius:10px}.system-check span{display:grid;place-items:center;width:26px;height:26px;border-radius:50%;font-weight:700}.system-check.ok span{background:#dff7e7;color:#14753a}.system-check.bad span{background:#ffe1e1;color:#a11}.error-log{max-height:420px;overflow:auto;white-space:pre-wrap;background:#15171a;color:#eee;border-radius:10px;padding:14px;font-size:12px}.table-wrap{overflow:auto}.table-wrap table{width:100%;border-collapse:collapse}.table-wrap th,.table-wrap td{padding:9px;border-bottom:1px solid #ddd;text-align:left}

/* v20: единый современный визуальный стиль */
:root{
  --hc-bg:#f3f6fb;
  --hc-surface:#ffffff;
  --hc-surface-soft:#f8fafc;
  --hc-text:#172033;
  --hc-muted:#697386;
  --hc-line:#e3e8f0;
  --hc-primary:#315fc7;
  --hc-primary-dark:#234aa5;
  --hc-primary-soft:#eaf0ff;
  --hc-success:#15803d;
  --hc-danger:#c93737;
  --hc-warning:#b77900;
  --hc-shadow:0 14px 45px rgba(29,45,80,.10);
  --hc-shadow-soft:0 7px 22px rgba(29,45,80,.07);
  --hc-radius:18px;
}
html{scroll-behavior:smooth}
body{background:radial-gradient(circle at 15% 0,#eaf0ff 0,transparent 28%),var(--hc-bg);color:var(--hc-text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;letter-spacing:-.006em}
a{color:var(--hc-primary);transition:color .18s ease,background .18s ease,transform .18s ease}
a:hover{color:var(--hc-primary-dark)}
button,.btn{background:linear-gradient(145deg,var(--hc-primary),#4775da);border-radius:12px;padding:11px 16px;box-shadow:0 5px 14px rgba(49,95,199,.18);transition:transform .16s ease,box-shadow .16s ease,filter .16s ease}
button:hover,.btn:hover{transform:translateY(-1px);box-shadow:0 8px 20px rgba(49,95,199,.24);filter:saturate(1.04)}
button:active,.btn:active{transform:translateY(0)}
.secondary{background:#eef2f7!important;color:#354052!important;box-shadow:none!important}
.danger{background:linear-gradient(145deg,#bd3030,#d94d4d);box-shadow:0 5px 14px rgba(190,48,48,.18)}
input,textarea,select{border:1px solid #d7deea!important;background:#fff;color:var(--hc-text);border-radius:12px!important;outline:0;transition:border-color .16s ease,box-shadow .16s ease,background .16s ease}
input:focus,textarea:focus,select:focus{border-color:#7ea0e7!important;box-shadow:0 0 0 4px rgba(49,95,199,.11);background:#fff}
.card,.admin,.chat-shell{background:rgba(255,255,255,.96);border:1px solid rgba(222,228,238,.9);box-shadow:var(--hc-shadow);border-radius:22px}
.admin{max-width:1320px;margin:22px auto;padding:24px 28px}
.chat-shell{max-width:860px;margin:22px auto;padding:20px 22px;min-height:calc(100vh - 44px)}
header{border-bottom:1px solid var(--hc-line);padding-bottom:18px;margin-bottom:4px}
header h1{font-size:clamp(24px,3vw,34px);line-height:1.1;letter-spacing:-.035em;margin:0 0 4px}
.brand-logo{width:52px;height:52px;border-radius:15px;border:1px solid var(--hc-line);box-shadow:var(--hc-shadow-soft)}
.muted{color:var(--hc-muted)}
.notice{background:#eaf8ef;color:#146b34;border:1px solid #ccebd7;border-radius:13px}
.error,.error-box{background:#fff0f0;color:#a71f1f;border:1px solid #f4cccc;border-radius:13px;padding:12px}

/* Навигация */
.admin-nav{gap:7px;max-width:100%;padding:3px;justify-content:flex-end}
.admin-nav>a{display:inline-flex;align-items:center;min-height:38px;padding:8px 10px;border-radius:10px;color:#48546a;font-size:13px;font-weight:700;line-height:1;white-space:nowrap}
.admin-nav>a:hover{background:var(--hc-primary-soft);color:var(--hc-primary-dark)}
.admin-nav .home-link{background:var(--hc-primary-soft);color:var(--hc-primary-dark);padding-inline:13px}
.notification-bell{width:40px;height:40px;background:#f0f3f8;border:1px solid #e1e6ee;box-shadow:none}
.notification-panel{border:1px solid var(--hc-line);border-radius:17px;box-shadow:0 22px 55px rgba(23,32,51,.18);padding:13px}
.notification-item{border:1px solid transparent;background:#f7f9fc;border-radius:12px}
.notification-item:hover{border-color:#d9e3f6;background:#edf3ff;transform:none}

/* Главная */
.dashboard-kpis{gap:14px}
.dashboard-kpis article{border:1px solid var(--hc-line);border-radius:18px;padding:19px;background:linear-gradient(155deg,#fff,#f8faff);box-shadow:var(--hc-shadow-soft);position:relative;overflow:hidden}
.dashboard-kpis article:after{content:"";position:absolute;width:86px;height:86px;border-radius:50%;right:-30px;top:-34px;background:rgba(49,95,199,.07)}
.dashboard-kpis strong{font-size:34px;letter-spacing:-.045em}
.dashboard-kpis .kpi-alert{background:linear-gradient(150deg,#fff7f5,#fff);border-color:#f3d4cf}
.dashboard-card{border:1px solid var(--hc-line);border-radius:18px;box-shadow:var(--hc-shadow-soft);padding:19px}
.dashboard-card h2{font-size:17px;letter-spacing:-.02em}
.status-summary div{border:1px solid #edf0f5;background:#f7f9fc;border-radius:13px}
.category-bars i{height:9px;background:#e8edf5}
.category-bars em{background:linear-gradient(90deg,var(--hc-primary),#6e91e2)}
.recent-ratings a{background:#f8fafc;border:1px solid #edf0f5}
.recent-ratings a:hover{background:#eef4ff;border-color:#d8e3fa}
.search-card{background:linear-gradient(180deg,#fff,#fbfcfe)}
.list-toolbar{align-items:center;margin:18px 0 9px}
.filter-btn{background:#edf1f6;border:1px solid transparent;color:#495469;font-weight:750}
.filter-btn.active{background:var(--hc-primary);color:#fff;box-shadow:0 5px 13px rgba(49,95,199,.18)}
.list{display:grid;gap:9px}
.chat-row{border:1px solid var(--hc-line);border-radius:15px;background:#fff;padding:15px 17px;box-shadow:0 3px 12px rgba(29,45,80,.04);transition:transform .16s ease,border-color .16s ease,box-shadow .16s ease}
.chat-row:hover{transform:translateY(-1px);border-color:#cbd8ef;box-shadow:0 8px 22px rgba(29,45,80,.08);color:inherit}
.chat-row+.chat-row{border-top:1px solid var(--hc-line)}
.closed-row{background:#f9fafc;opacity:.78}
.state-chip{padding:5px 9px}
.badge{min-width:23px;height:23px;display:inline-flex;align-items:center;justify-content:center;box-shadow:0 3px 8px rgba(229,57,53,.2)}

/* Административный чат */
.chat-admin{max-width:1440px}
.chat-workspace{grid-template-columns:minmax(0,1fr) 350px;gap:18px;margin-top:18px}
.chat-main,.collaboration-panel>section{border:1px solid var(--hc-line);border-radius:18px;background:#fff;box-shadow:var(--hc-shadow-soft)}
.chat-main{padding:16px 18px}
.collaboration-panel>section{padding:17px;background:linear-gradient(180deg,#fff,#fafbfd)}
.messages{height:min(58vh,650px);padding:16px 5px 20px;scrollbar-width:thin;scrollbar-color:#cfd7e5 transparent}
.msg{padding:11px 14px;border-radius:16px 16px 16px 5px;background:#f0f3f7;border:1px solid #e6eaf0;box-shadow:0 2px 8px rgba(29,45,80,.04)}
.msg.admin{border-radius:16px 16px 5px 16px;background:linear-gradient(145deg,#dfe9ff,#edf3ff);border-color:#cad9f6}
.msg img{border-radius:12px;box-shadow:0 4px 16px rgba(0,0,0,.10)}
.assignment-bar{padding:11px 13px;background:#f8fafc;border:1px solid var(--hc-line);border-radius:13px}
.assignment-bar label{margin:0}
.workflow-bar button,.quick button{box-shadow:none;background:#eef2f7;color:#344054;border:1px solid #e0e6ef}
.workflow-bar button:hover,.quick button:hover{background:#e5edfb;color:#234b9f;border-color:#cad8f4}
.composer{position:relative;padding-top:8px}
.composer input[name=body]{min-height:46px;padding-left:15px}
.composer button{min-height:46px}
#closeBtn{width:100%;margin-top:10px}
.notes-list article{box-shadow:0 3px 10px rgba(29,45,80,.04)}

/* Гостевой чат */
.chat-shell header{position:sticky;top:0;z-index:10;background:rgba(255,255,255,.92);backdrop-filter:blur(12px);margin:-20px -22px 0;padding:16px 22px;border-radius:22px 22px 0 0}
.welcome-card{background:linear-gradient(145deg,#edf3ff,#f9fbff);border-color:#d5e1f7;padding:18px;border-radius:18px;box-shadow:0 5px 16px rgba(49,95,199,.06)}
.welcome-icon{display:grid;place-items:center;width:48px;height:48px;border-radius:15px;background:#fff;box-shadow:0 5px 14px rgba(29,45,80,.08)}
.category-panel{background:#fbfcfe;border-color:var(--hc-line);padding:16px}
.category-btn{background:#f2f5f9;border:1px solid #e6ebf2;box-shadow:none;min-height:46px}
.category-btn:hover{background:#eaf1ff;border-color:#cddcf7;color:#234b9f}
.category-btn.active{background:linear-gradient(145deg,#dfe9ff,#edf3ff);border-color:#96b4ec;color:#173f8f;box-shadow:0 4px 12px rgba(49,95,199,.10)}
.chat-shell .messages{height:48vh;min-height:330px;padding-inline:4px}
.chat-shell .composer{position:sticky;bottom:0;z-index:8;background:rgba(255,255,255,.94);backdrop-filter:blur(12px);margin:0 -10px -10px;padding:12px 10px 10px;border-top:1px solid var(--hc-line)}
.attach{display:grid;place-items:center;width:46px;height:46px;border-radius:13px;background:#eef2f7;font-size:22px;flex:0 0 auto}
.image-preview{border-color:#d8e0ec;box-shadow:0 6px 18px rgba(29,45,80,.06)}
.rating{background:#fbfcfe;border:1px solid var(--hc-line);border-radius:17px;padding:17px;margin-top:12px}
.stars label{color:#f3ad20;cursor:pointer;transition:transform .15s ease}
.stars label:hover{transform:scale(1.12)}

/* Формы, таблицы, настройки */
.settings-section,.reply-editor-card,.reply-list-section,.service-card,.room-history-card{border:1px solid var(--hc-line)!important;border-radius:18px!important;box-shadow:var(--hc-shadow-soft);background:#fff!important}
.settings-section h2{font-size:19px;letter-spacing:-.02em;padding-bottom:9px;border-bottom:1px solid #eef1f5}
table{background:#fff;border:1px solid var(--hc-line);border-radius:15px;overflow:hidden}
th{background:#f7f9fc;color:#5b6679;font-size:12px;text-transform:uppercase;letter-spacing:.035em}
th,td{padding:12px 13px;border-bottom:1px solid #edf0f5}
tr:hover td{background:#fafcff}
.qr-card{border-color:var(--hc-line)!important;border-radius:18px!important;background:linear-gradient(180deg,#fff,#fafcff);box-shadow:var(--hc-shadow-soft)}
.qr{box-shadow:0 5px 20px rgba(29,45,80,.08);border:1px solid #edf0f5}
.qr-url{background:#eef2f7;color:#566175}
.activity-row{background:#fff;border-color:var(--hc-line);box-shadow:0 3px 11px rgba(29,45,80,.04)}
.system-check{border-color:var(--hc-line);background:#fff}

/* Адаптивность */
@media(max-width:1100px){
  .admin{margin:10px;max-width:none;padding:20px}
  .admin header{align-items:flex-start;flex-direction:column}
  .admin-nav{width:100%;justify-content:flex-start;flex-wrap:nowrap;overflow-x:auto;padding-bottom:6px;scrollbar-width:none}
  .admin-nav::-webkit-scrollbar{display:none}
  .admin-nav>a{background:#f3f5f8;border:1px solid #e7ebf1}
  .notification-wrap{flex:0 0 auto}
}
@media(max-width:760px){
  body{background:#f5f7fb}
  .admin,.chat-shell{margin:0;min-height:100vh;border:0;border-radius:0;box-shadow:none;padding:16px}
  .chat-shell header{margin:-16px -16px 0;padding:14px 16px;border-radius:0}
  .dashboard-kpis{gap:9px}
  .dashboard-kpis article{padding:15px}
  .dashboard-kpis strong{font-size:29px}
  .chat-row{grid-template-columns:1fr;gap:8px;padding:14px}
  .chat-row>em{display:flex;align-items:center;justify-content:space-between}
  .chat-workspace{display:block;margin-top:12px}
  .chat-main{padding:12px;border-radius:15px}
  .collaboration-panel{margin-top:12px}
  .messages{height:52vh}
  .chat-shell .messages{height:50vh;min-height:300px}
  .category-grid{grid-template-columns:1fr 1fr}
  .composer{gap:6px}
  .composer button{padding-inline:12px}
  table{display:block;overflow-x:auto;white-space:nowrap}
}
@media(max-width:430px){
  .category-grid{grid-template-columns:1fr}
  .dashboard-kpis{grid-template-columns:1fr 1fr}
  .dashboard-kpis article>small{font-size:11px}
  .welcome-card{padding:14px}
  .welcome-icon{width:42px;height:42px}
}

/* HotelChat v2.1 — room inventory */
.room-create-layout{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin:20px 0}
.room-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.room-form-grid .form-actions{grid-column:1/-1}
.rooms-toolbar{display:flex;justify-content:flex-end;margin:0 0 16px}
.room-card-title{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:12px}
.room-card-title h2{margin:0 0 4px}
.room-danger-actions{display:flex;justify-content:space-between;gap:10px;border-top:1px solid var(--border,#e5e7eb);padding-top:12px;margin-top:12px}
.room-disabled{opacity:.78;background:#f8fafc}
button.danger,.danger{background:#fff;color:#b42318;border:1px solid #f2b8b5}
button.danger:hover,.danger:hover{background:#fff1f0}
.qr-inactive{display:inline-flex;margin:-4px 0 8px;padding:4px 9px;border-radius:999px;background:#f3f4f6;color:#6b7280;font-size:12px;font-weight:700}
@media(max-width:760px){
 .room-create-layout{grid-template-columns:1fr}
 .room-form-grid{grid-template-columns:1fr}
 .room-admin-actions,.room-danger-actions{flex-wrap:wrap}
 .rooms-toolbar{justify-content:stretch}.rooms-toolbar .btn{width:100%;text-align:center}
}

/* HotelChat Guest Chat 2.5 — modern message UI
   ВАЖНО: больше не используем класс .admin у сообщения,
   поскольку он предназначен для страницы панели администратора. */

.chat-shell .messages {
    display: flex;
    flex-direction: column;
    gap: 7px;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

.chat-shell .msg {
    position: relative;
    display: flex;
    flex-direction: column;
    width: fit-content;
    min-width: 92px;
    max-width: min(78%, 560px);
    height: auto !important;
    min-height: 0 !important;
    margin: 0;
    padding: 9px 11px 7px;
    border: 1px solid transparent;
    border-radius: 18px;
    box-shadow: 0 4px 14px rgba(28, 45, 78, .07);
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: normal;
    animation: guest-message-in .18s ease-out;
}

.chat-shell .msg-guest {
    align-self: flex-start;
    color: #1e293b;
    background: #f1f4f8;
    border-color: #e5e9ef;
    border-bottom-left-radius: 6px;
}

.chat-shell .msg-admin {
    align-self: flex-end;
    color: #17233d;
    background: linear-gradient(145deg, #dce8ff, #e8f0ff);
    border-color: #ccdcfb;
    border-bottom-right-radius: 6px;
}

.chat-shell .msg-sender {
    display: none;
    margin: 0 0 3px;
    color: #5871a3;
    font-size: 11px;
    font-weight: 800;
}

.chat-shell .msg-text {
    margin: 0;
    white-space: pre-wrap;
    font-size: 16px;
    line-height: 1.42;
}

.chat-shell .msg-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 17px;
    margin-top: 3px;
}

.chat-shell .msg-meta time {
    color: #727b8b;
    font-size: 11px;
    line-height: 1;
    white-space: nowrap;
}

.chat-shell .msg-photo {
    display: block;
    margin: -4px -6px 7px;
    overflow: hidden;
    border-radius: 14px;
    background: #dde3ec;
    cursor: zoom-in;
    -webkit-tap-highlight-color: transparent;
}

.chat-shell .msg-photo img {
    display: block;
    width: auto;
    min-width: 190px;
    max-width: min(70vw, 460px);
    max-height: 420px;
    object-fit: cover;
    border-radius: 0;
    transition: transform .18s ease;
}

.chat-shell .msg-photo:active img {
    transform: scale(.985);
}

.chat-shell .message-day-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 8px 0 5px;
}

.chat-shell .message-day-divider::before,
.chat-shell .message-day-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(138, 150, 171, .34)
    );
}

.chat-shell .message-day-divider::after {
    background: linear-gradient(
        90deg,
        rgba(138, 150, 171, .34),
        transparent
    );
}

.chat-shell .message-day-divider span {
    flex: 0 0 auto;
    margin: 0 10px;
    padding: 5px 10px;
    border: 1px solid #e1e6ee;
    border-radius: 999px;
    color: #707887;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 2px 8px rgba(28, 45, 78, .05);
    font-size: 11px;
    font-weight: 750;
}

body.guest-photo-open {
    overflow: hidden;
}

.guest-photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    grid-template-rows: 1fr auto;
    place-items: center;
    padding: max(52px, env(safe-area-inset-top)) 14px
        max(25px, env(safe-area-inset-bottom));
    background: rgba(7, 11, 19, .96);
    backdrop-filter: blur(8px);
    touch-action: none;
}

.guest-photo-stage {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
    touch-action: pinch-zoom;
}

.guest-photo-viewer img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 120px);
    object-fit: contain;
    transform-origin: center;
    transition: transform .18s ease;
    cursor: zoom-in;
    touch-action: pinch-zoom;
    user-select: none;
    -webkit-user-drag: none;
}

.guest-photo-viewer img.zoomed {
    max-width: none;
    max-height: none;
    transform: scale(2);
    cursor: zoom-out;
}

.guest-photo-close {
    position: fixed;
    top: max(10px, env(safe-area-inset-top));
    right: 12px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, .16);
    font-size: 30px;
    font-weight: 400;
    line-height: 1;
}

.guest-photo-hint {
    padding-top: 10px;
    color: rgba(255, 255, 255, .7);
    font-size: 12px;
    text-align: center;
}

@keyframes guest-message-in {
    from {
        opacity: 0;
        transform: translateY(5px) scale(.99);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 650px) {
    .chat-shell .messages {
        gap: 6px;
        padding: 12px 0 17px;
    }

    .chat-shell .msg {
        max-width: 84%;
        padding: 9px 11px 7px;
        border-radius: 17px;
    }

    .chat-shell .msg-guest {
        border-bottom-left-radius: 5px;
    }

    .chat-shell .msg-admin {
        border-bottom-right-radius: 5px;
    }

    .chat-shell .msg-text {
        font-size: 15.5px;
    }

    .chat-shell .msg-photo img {
        min-width: 170px;
        max-width: min(76vw, 390px);
        max-height: 340px;
    }
}
