*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, sans-serif; font-size: 14px; background: #f0f2f5; color: #1a1a2e; padding-bottom: 42px; }

/* ── Login ───────────────────────────────────────────────── */
.login-overlay {
  display: none; position: fixed; inset: 0;
  background: #1a1a2e;
  align-items: center; justify-content: center; z-index: 200;
}
.login-overlay.open { display: flex; }
.login-box {
  background: #fff; border-radius: 12px; padding: 40px;
  width: 100%; max-width: 380px; box-shadow: 0 8px 40px rgba(0,0,0,.4);
}
.login-box h1 { font-size: 20px; margin-bottom: 6px; }
.login-box p  { color: #888; font-size: 13px; margin-bottom: 24px; }
.login-box .form-group { margin-bottom: 14px; }
.login-box label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 5px; }
.login-box input { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; }
.login-box input:focus { outline: 2px solid #4f8ef7; border-color: transparent; }
.login-btn { width: 100%; padding: 11px; background: #4f8ef7; color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 6px; }
.login-btn:hover { background: #3a7de8; }
.login-error { color: #c5221f; font-size: 13px; margin-top: 10px; display: none; }

/* ── Header ─────────────────────────────────────────────── */
header { background: #1a1a2e; color: #fff; padding: 12px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
header h1 { font-size: 16px; font-weight: 600; }
.date-nav { display: flex; align-items: center; gap: 8px; }
.date-nav button { background: rgba(255,255,255,.15); border: none; color: #fff; padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 16px; }
.date-nav button:hover { background: rgba(255,255,255,.25); }
#date-input { background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3); color: #fff; padding: 6px 10px; border-radius: 6px; font-size: 14px; }
#date-input::-webkit-calendar-picker-indicator { filter: invert(1); }
.tab-bar { display: flex; gap: 4px; }
.tab-bar button { background: rgba(255,255,255,.1); border: none; color: rgba(255,255,255,.7); padding: 7px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.tab-bar button.active { background: #4f8ef7; color: #fff; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-info { font-size: 13px; color: rgba(255,255,255,.8); }
.user-info strong { color: #fff; }
.logout-btn { background: rgba(255,255,255,.15); border: none; color: #fff; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.logout-btn:hover { background: rgba(255,100,100,.3); }

/* ── Toolbar ─────────────────────────────────────────────── */
.toolbar { padding: 12px 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; background: #fff; border-bottom: 1px solid #e0e0e0; }
.toolbar select { padding: 7px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; background: #fff; }
.btn { padding: 7px 14px; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500; }
.btn-primary { background: #4f8ef7; color: #fff; }
.btn-primary:hover { background: #3a7de8; }
.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: #c5221f; color: #fff; }
.btn-danger:hover { background: #a31c1c; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Common ──────────────────────────────────────────────── */
main { padding: 16px 20px; }
.empty   { text-align: center; padding: 40px; color: #aaa; }
.loading { text-align: center; padding: 40px; color: #aaa; }

/* Badges */
.task-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; min-width: 36px; text-align: center; }
.task-STY { background: #e8f0fe; color: #1967d2; }
.task-LIN { background: #e6f4ea; color: #188038; }
.task-DEP { background: #fce8e6; color: #c5221f; }
.task-MFL { background: #fef3e2; color: #b45309; }
.task-TUR { background: #f0f0f0; color: #888; }
.task-OTHER { background: #f3e8ff; color: #7c3aed; }
.status-pill { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.sp-PENDING     { background: #f0f0f0; color: #666; }
.sp-IN_PROGRESS { background: #e8f0fe; color: #1967d2; }
.sp-DONE        { background: #e6f4ea; color: #188038; }
.sp-SKIPPED     { background: #fce8e6; color: #c5221f; }
.resort-badge { display: inline-block; background: #fff3e0; color: #e65100; padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.floor-badge { display: inline-block; background: #eef2ff; color: #4f8ef7; padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.manual-badge { display: inline-block; background: #f3e8ff; color: #7c3aed; padding: 2px 7px; border-radius: 4px; font-size: 11px; font-weight: 600; }

/* ── Batch list ──────────────────────────────────────────── */
.batch-list { background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.batch-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid #f0f0f0;
  cursor: pointer; transition: background .1s;
}
.batch-row:last-child { border-bottom: none; }
.batch-row:hover { background: #f7f8ff; }
.br-time { font-size: 12px; color: #888; white-space: nowrap; min-width: 50px; }
.br-type { flex: 0 0 220px; display: flex; align-items: center; gap: 6px; overflow: hidden; }
.br-type .br-desc { font-size: 12px; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.br-resort { flex-shrink: 0; width: 72px; }
.br-class { font-weight: 600; font-size: 13px; min-width: 80px; }
.br-creator { font-size: 12px; color: #666; white-space: nowrap; }
.br-progress { flex: 1; display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.br-prog-text { font-size: 12px; color: #555; white-space: nowrap; }
.br-prog-bar { width: 80px; height: 6px; background: #f0f0f0; border-radius: 3px; overflow: hidden; flex-shrink: 0; }
.br-prog-fill { height: 100%; background: #27ae60; border-radius: 3px; transition: width .3s; }
.br-count { font-size: 13px; font-weight: 600; white-space: nowrap; min-width: 24px; text-align: right; }
.br-arrow { color: #ccc; font-size: 14px; flex-shrink: 0; }

/* ── Batch detail modal task list ─────────────────────────── */
.batch-task-list { width: 100%; border-collapse: collapse; margin-top: 8px; }
.batch-task-list th { text-align: left; padding: 6px 10px; font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid #eee; }
.batch-task-list td { padding: 8px 10px; border-bottom: 1px solid #f5f5f5; vertical-align: middle; }
.batch-task-list tr:last-child td { border-bottom: none; }
.batch-task-list tr:hover td { background: #fafafa; }
.td-select { padding: 5px 7px; border: 1px solid #ddd; border-radius: 5px; font-size: 12px; background: #fff; cursor: pointer; }

/* ── Report ──────────────────────────────────────────────── */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.report-card { background: #fff; border-radius: 8px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.08); text-align: center; }
.report-card .value { font-size: 28px; font-weight: 700; }
.report-card .label { font-size: 12px; color: #888; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; }
thead tr { border-bottom: 2px solid #eee; background: #fafafa; }
tbody tr { border-bottom: 1px solid #f0f0f0; }
tbody tr:hover { background: #fafafa; }

/* ── Admin ───────────────────────────────────────────────── */
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.admin-header h2 { font-size: 15px; font-weight: 600; }
.admin-accordion { background:#fff; border-radius:10px; box-shadow:0 1px 4px rgba(0,0,0,.08); margin-bottom:16px; overflow:hidden; }
.acc-header { display:flex; align-items:center; gap:10px; padding:15px 20px; cursor:pointer; user-select:none; transition:background .15s; }
.acc-header:hover { background:#f7f8ff; }
.acc-icon { font-size:16px; }
.acc-title { font-size:15px; font-weight:700; color:#1a1a2e; flex:1; }
.acc-arrow { font-size:11px; color:#aaa; transition:transform .2s; }
.acc-header.open .acc-arrow { transform:rotate(180deg); }
.role-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; }
.role-admin    { background: #fce8e6; color: #c5221f; }
.role-inspector { background: #e8f0fe; color: #1967d2; }
.resort-list { display: flex; flex-wrap: wrap; gap: 4px; }
.resort-chip { background: #f0f2f5; padding: 2px 7px; border-radius: 4px; font-size: 11px; color: #555; }

/* ── HK ──────────────────────────────────────────────────── */
.hk-section { margin-bottom: 24px; }
.hk-section-title { font-size: 13px; font-weight: 700; color: #888; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; padding: 0 4px; }
.hk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.hk-card { background: #fff; border-radius: 8px; padding: 14px 16px; box-shadow: 0 1px 4px rgba(0,0,0,.08); display: flex; align-items: center; gap: 12px; }
.hk-card .hk-name { font-weight: 600; font-size: 14px; flex: 1; }
.hk-card .hk-actions { display: flex; gap: 6px; flex-shrink: 0; }
.hk-stats { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: #666; margin-top: 4px; }
.hk-stat { font-size: 12px; color: #666; }
.hk-stat strong { color: #1a1a2e; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 500px; box-shadow: 0 8px 32px rgba(0,0,0,.2); margin: auto; }
.modal.modal-wide { max-width: 860px; }
.modal h2 { font-size: 16px; margin-bottom: 16px; }
.modal-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 8px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; background: #fff; }
.form-group textarea { resize: vertical; min-height: 70px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.btn-cancel { background: #f0f0f0; color: #555; }
.btn-cancel:hover { background: #e0e0e0; }
.resort-checks { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px; border: 1px solid #ddd; border-radius: 6px; background: #fafafa; }
.resort-checks label { display: flex; align-items: center; gap: 5px; cursor: pointer; font-size: 13px; font-weight: normal; color: #333; margin: 0; }
.resort-checks input[type=checkbox] { width: auto; }

/* ── Room calendar ───────────────────────────────────────── */
.cal-modal { max-width: 560px; }
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-header h3 { font-size: 16px; font-weight: 700; }
.cal-header button { background: #f0f0f0; border: none; border-radius: 6px; padding: 5px 12px; cursor: pointer; font-size: 16px; }
.cal-header button:hover { background: #e0e0e0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: #888; padding: 4px 0; }
.cal-day {
  min-height: 54px; border-radius: 6px; padding: 4px 5px;
  background: #f7f8ff; border: 1px solid #e8eaf0;
  display: flex; flex-direction: column; gap: 2px;
}
.cal-day.today { border-color: #4f8ef7; background: #eef4ff; }
.cal-day.empty { background: transparent; border-color: transparent; }
.cal-day.occupied { background: #fff; }
.cal-day-num { font-size: 11px; color: #aaa; font-weight: 600; }
.cal-day.today .cal-day-num { color: #4f8ef7; }
.cal-day-task { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; text-align: center; }
.cal-status-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; margin-left: 2px; }
.dot-DONE { background: #27ae60; }
.dot-PENDING { background: #aaa; }
.dot-IN_PROGRESS { background: #4f8ef7; }
.dot-SKIPPED { background: #c5221f; }

/* ── GEN badges ──────────────────────────────────────────── */
.gen-ok    { background: #e6f4ea; color: #188038; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.gen-warn  { background: #fef3e2; color: #b45309; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.gen-due   { background: #fce8e6; color: #c5221f; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }

/* ── HK status badges ────────────────────────────────────── */
.hk-dirty      { background: #fce8e6; color: #c5221f; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.hk-clean      { background: #e6f4ea; color: #188038; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.hk-inspected  { background: #e8f0fe; color: #1967d2; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.hk-unknown    { background: #f0f0f0; color: #888;    padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }

/* ── Toast ───────────────────────────────────────────────── */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1a1a2e; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,.2); animation: slide-in .2s ease; }
.toast.error { background: #c5221f; }
@keyframes slide-in { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Print ───────────────────────────────────────────────── */
#print-area { display: none; }

@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area {
    display: block !important;
    position: static;
    padding: 20px;
    font-size: 12px;
    font-family: system-ui, sans-serif;
    background: #fff;
    color: #000;
  }
  #print-area table { width: 100%; border-collapse: collapse; }
  #print-area thead { display: table-header-group; }
  #print-area .print-title-row td { padding: 8px 8px 4px; border: none; font-size: 14px; font-weight: 700; }
  #print-area .print-meta-row td { padding: 0 8px 6px; border: none; font-size: 11px; color: #555; border-bottom: 2px solid #333; }
  #print-area .print-col-row th { background: #f0f0f0; border: 1px solid #ccc; padding: 5px 8px; text-align: left; font-size: 11px; font-weight: 700; }
  #print-area td { border: 1px solid #ddd; padding: 5px 8px; font-size: 11px; }
  #print-area tbody tr:nth-child(even) td { background: #fafafa; }
  #print-area tbody tr { page-break-inside: avoid; }
  #print-area th { background: #f0f0f0; border: 1px solid #ccc; padding: 5px 8px; text-align: left; font-size: 11px; }
}

/* ── Mobile (max 600px) ──────────────────────────────────── */
@media (max-width: 600px) {
  /* Шапка — компактнее */
  header { padding: 8px 12px; gap: 8px; }
  header h1 { font-size: 15px; }
  .header-right { width: 100%; justify-content: flex-end; }

  /* Вкладки — горизонтальная прокрутка */
  .tab-bar {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
    padding-bottom: 2px;
  }
  .tab-bar::-webkit-scrollbar { display: none; }
  .tab-bar button { white-space: nowrap; flex-shrink: 0; padding: 7px 12px; font-size: 13px; }

  /* Основной контент */
  main { padding: 10px 10px; }

  /* Таблицы — горизонтальная прокрутка */
  .table-wrap, table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Кнопки — удобнее для пальца */
  button { min-height: 36px; }

  /* Модальное окно — снизу на весь экран */
  .modal, .modal.modal-wide {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 12px 12px 0 0 !important;
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal-overlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }
}
