/* Worker dormitory module */
.dorm-view {
  max-width: 1560px;
  margin: 0 auto;
  padding: 0 26px 52px;
}

.dorm-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 4px 22px;
}

.dorm-head h1 {
  margin: 8px 0 7px;
  color: var(--ink);
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.dorm-head p {
  max-width: 680px;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.7;
}

.dorm-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.dorm-role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: #5f7468;
  background: #edf3ee;
  font-size: 10px;
  font-weight: 500;
}

.dorm-role-badge.is-admin {
  color: #24523e;
  background: #dff0e6;
}

.dorm-stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.dorm-stat {
  position: relative;
  overflow: hidden;
  min-height: 96px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.dorm-stat > span {
  display: block;
  color: var(--ink-muted);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.dorm-stat strong {
  display: inline-block;
  margin-top: 9px;
  color: var(--ink);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}

.dorm-stat small {
  margin-left: 4px;
  color: #9aa79e;
  font-size: 9px;
}

.dorm-stat--occupied {
  background: linear-gradient(135deg, #fff, #f2f8f4);
}

.dorm-stat--people {
  background: linear-gradient(135deg, #fff, #eef5ff);
}

.dorm-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 13px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.dorm-search {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1 1 280px;
  min-width: 220px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid #e6e6eb;
  border-radius: 8px;
  background: #fafafa;
}

.dorm-search .icon {
  width: 14px;
  height: 14px;
  color: #9ba59e;
}

.dorm-search input {
  width: 100%;
  height: 32px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 11px;
}

.dorm-select {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #8b978f;
  font-size: 9px;
}

.dorm-select select {
  height: 32px;
  min-width: 98px;
  padding: 0 24px 0 9px;
  border: 1px solid #e6e6eb;
  border-radius: 7px;
  color: var(--ink-soft);
  background: #fff;
  font-size: 10px;
}

.dorm-filtered-count {
  margin-left: auto;
  color: #9aa59d;
  font-family: var(--font-mono);
  font-size: 9px;
}

.dorm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.dorm-plan-panel,
.dorm-side-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.dorm-plan-panel {
  overflow: hidden;
}

.dorm-panel-head,
.dorm-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 17px;
  border-bottom: 1px solid #eef0ed;
}

.dorm-panel-head h2,
.dorm-side-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.dorm-panel-head span,
.dorm-side-head span {
  color: #a0aaa2;
  font-size: 9px;
}

.dorm-plan {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.dorm-building {
  border: 1px solid #e7ece7;
  border-radius: 12px;
  overflow: hidden;
  background: #fbfcfa;
}

.dorm-building-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 13px;
  border-bottom: 1px solid #e8ede7;
  background: linear-gradient(90deg, #f5faf5, #fbfcfa);
}

.dorm-building-head h3 {
  margin: 0;
  color: #345545;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.dorm-building-meta {
  display: flex;
  gap: 12px;
  color: #87988b;
  font-family: var(--font-mono);
  font-size: 9px;
}

.dorm-floor {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 8px;
  padding: 10px 12px;
}

.dorm-floor + .dorm-floor {
  border-top: 1px dashed #edf0eb;
}

.dorm-floor-label {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9aa99e;
  font-size: 9px;
  font-weight: 500;
  writing-mode: vertical-rl;
  letter-spacing: 0.12em;
}

.dorm-room-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(102px, 1fr));
  gap: 7px;
}

.dorm-room {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 74px;
  padding: 8px 9px;
  border: 1px solid #e3e9e4;
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.dorm-room:hover {
  z-index: 1;
  border-color: #b9cdbf;
  box-shadow: 0 4px 14px rgba(40, 70, 52, 0.08);
  transform: translateY(-1px);
}

.dorm-room.is-occupied {
  border-color: hsl(var(--dorm-hue, 145) 28% 80%);
  background: hsl(var(--dorm-hue, 145) 45% 96%);
}

.dorm-room.is-maintenance {
  border-style: dashed;
  background: #fffaf2;
}

.dorm-room-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #61756a;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
}

.dorm-room-people {
  display: inline-flex;
  align-items: center;
  min-height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  color: #2c6348;
  background: rgba(255, 255, 255, 0.8);
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 600;
}

.dorm-room-company {
  display: -webkit-box;
  overflow: hidden;
  color: #536b5d;
  font-size: 9.5px;
  line-height: 1.4;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.dorm-room.is-vacant .dorm-room-company {
  color: #a9b4ac;
}

.dorm-room-name {
  overflow: hidden;
  color: #819286;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dorm-room.is-maintenance .dorm-room-company {
  color: #a47c3d;
}

.dorm-empty-filter {
  grid-column: 1 / -1;
  padding: 40px 20px;
  color: #9aa79e;
  text-align: center;
  font-size: 11px;
}

.dorm-side {
  display: grid;
  gap: 14px;
}

.dorm-stat-list {
  display: grid;
  gap: 2px;
  padding: 8px 10px 12px;
}

.dorm-stat-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-bottom: 1px solid #f1f3f0;
}

.dorm-stat-row:last-child {
  border-bottom: 0;
}

.dorm-stat-row-main {
  min-width: 0;
}

.dorm-stat-row strong {
  display: block;
  overflow: hidden;
  color: #4b6255;
  font-size: 10px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dorm-stat-row small {
  color: #a1aca3;
  font-size: 8px;
}

.dorm-stat-row-value {
  color: #4d7560;
  font-family: var(--font-mono);
  font-size: 10px;
  white-space: nowrap;
}

.dorm-stat-bar {
  height: 3px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1ed;
}

.dorm-stat-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #8eae9b;
}

.dorm-recent {
  display: grid;
  gap: 0;
  padding: 7px 15px 12px;
}

.dorm-recent-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f1f3f0;
  font-size: 9px;
}

.dorm-recent-row:last-child {
  border-bottom: 0;
}

.dorm-recent-tag {
  display: inline-flex;
  justify-content: center;
  padding: 2px 4px;
  border-radius: 4px;
  color: #527763;
  background: #edf5ee;
  font-size: 8px;
}

.dorm-recent-tag.is-out {
  color: #9b7743;
  background: #fff6e8;
}

.dorm-recent-main {
  overflow: hidden;
  color: #697b6f;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dorm-recent-date {
  color: #a3ada5;
  font-family: var(--font-mono);
  font-size: 8px;
}

.dorm-room-dialog {
  width: min(780px, calc(100vw - 36px));
}

.dorm-room-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.dorm-room-current {
  padding: 13px 15px;
  border: 1px solid #e3ebe4;
  border-radius: 10px;
  background: #f8fbf7;
}

.dorm-room-current h3 {
  margin: 0 0 7px;
  color: #385b44;
  font-size: 13px;
}

.dorm-room-current-meta {
  color: #87998b;
  font-size: 10px;
  line-height: 1.7;
}

.dorm-room-current-meta strong {
  color: #4a6656;
  font-weight: 500;
}

.dorm-room-facts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dorm-room-fact {
  min-width: 82px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f5f7f4;
  color: #9aa79e;
  font-size: 8px;
}

.dorm-room-fact strong {
  display: block;
  margin-top: 4px;
  color: #4a6253;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}

.dorm-room-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.dorm-room-form {
  padding: 13px;
  margin-bottom: 15px;
  border: 1px solid #e8ede7;
  border-radius: 10px;
  background: #fbfcfa;
}

.dorm-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dorm-form-grid .field--full {
  grid-column: 1 / -1;
}

.dorm-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.dorm-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.dorm-history-head h3 {
  margin: 0;
  color: #516b5b;
  font-size: 12px;
  font-weight: 600;
}

.dorm-stay-history {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid #e8eee8;
  border-radius: 9px;
}

.dorm-stay {
  display: grid;
  grid-template-columns: minmax(110px, 1.3fr) 80px 1fr 1fr 65px 88px;
  gap: 10px;
  align-items: center;
  padding: 10px 11px;
  border-bottom: 1px solid #eef2ee;
  font-size: 9px;
}

.dorm-stay:last-child {
  border-bottom: 0;
}

.dorm-stay.is-active {
  background: #f7fbf7;
}

.dorm-stay-company {
  color: #4b6656;
  font-weight: 500;
}

.dorm-stay-date {
  color: #7e8f82;
  font-family: var(--font-mono);
  font-size: 8.5px;
}

.dorm-stay-days {
  color: #577965;
  font-family: var(--font-mono);
  font-size: 9px;
  white-space: nowrap;
}

.dorm-stay-note {
  overflow: hidden;
  color: #a0aaa2;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dorm-stay-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
}

.dorm-stay-actions .table-action {
  padding: 2px 5px;
  font-size: 8px;
}

.dorm-stay-pill {
  display: inline-flex;
  padding: 2px 5px;
  border-radius: 999px;
  color: #41725a;
  background: #e8f3ea;
  font-size: 8px;
}

.dorm-stay-pill.is-ended {
  color: #9ba69e;
  background: #f3f5f2;
}

.dorm-empty-history {
  padding: 20px;
  color: #a2ada4;
  text-align: center;
  font-size: 10px;
}

.permission-item--dorm {
  margin-top: 10px;
  border-color: #dce9df !important;
  background: #f8fbf7 !important;
}

@media (max-width: 1100px) {
  .dorm-layout { grid-template-columns: 1fr; }
  .dorm-side { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dorm-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .dorm-view { padding: 0 12px 32px; }
  .dorm-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .dorm-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dorm-side { grid-template-columns: 1fr; }
  .dorm-floor { grid-template-columns: 32px minmax(0, 1fr); padding: 8px; }
  .dorm-room-grid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
  .dorm-stay { grid-template-columns: minmax(100px, 1.4fr) 64px 1fr 1fr; }
  .dorm-stay-note, .dorm-stay-actions { display: none; }
  .dorm-form-grid { grid-template-columns: 1fr; }
}
