/* 디자이너스호텔 관리 ERP - 공통 스타일 (라이트 모드, 브랜드 중립 팔레트) */
:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --page: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: #c3c2b7;

  --series-blue: #2a78d6;
  --series-orange: #eb6834;
  --series-aqua: #1baf7a;
  --series-yellow: #eda100;
  --series-violet: #4a3aa7;

  --status-good: #0ca30c;
  --status-good-bg: #e7f6e7;
  --status-warning: #b97400;
  --status-warning-bg: #fef1da;
  --status-serious: #c1502c;
  --status-serious-bg: #fbe6dd;
  --status-critical: #d03b3b;
  --status-critical-bg: #fbe4e4;
  --status-info: #2a78d6;
  --status-info-bg: #e6eefb;
  --status-muted: #6b6a65;
  --status-muted-bg: #eeede9;

  --radius: 10px;
  --radius-sm: 6px;
  --sidebar-w: 220px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

.app-shell { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}
.sidebar .brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  font-weight: 700;
  font-size: 14px;
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sidebar .brand-logo { max-width: 100%; height: auto; max-height: 56px; }
.sidebar .brand small {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-secondary);
  font-weight: 500;
  border-left: 3px solid transparent;
}
.nav-link:hover { background: var(--page); color: var(--text-primary); }
.nav-link.active {
  color: var(--series-blue);
  border-left-color: var(--series-blue);
  background: var(--status-info-bg);
}
.nav-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 16px 20px 6px;
}
.sidebar-footer {
  margin-top: auto;
  padding: 12px 20px 0;
  border-top: 1px solid var(--border);
}
.user-chip { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }
.user-chip strong { color: var(--text-primary); }
.role-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--status-muted-bg);
  color: var(--status-muted);
  margin-left: 6px;
}
.btn-logout {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
}
.btn-logout:hover { background: var(--page); }

/* ---------- Main content ---------- */
.main {
  flex: 1;
  min-width: 0;
  padding: 28px 32px 60px;
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 20px; margin: 0 0 4px; }
.page-header p { margin: 0; color: var(--text-secondary); font-size: 13px; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Stat tiles ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-tile .stat-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.stat-tile .stat-value {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: proportional-nums;
}
.stat-tile .stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-tile.accent-critical .stat-value { color: var(--status-critical); }
.stat-tile.accent-warning .stat-value { color: var(--status-warning); }
.stat-tile.accent-good .stat-value { color: var(--status-good); }

/* ---------- Cards / panels ---------- */
.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.panel h2 { font-size: 15px; margin: 0 0 14px; }
.panel-flex { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.panel-flex > .panel { flex: 1 1 320px; margin-bottom: 0; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--gridline);
  white-space: nowrap;
}
.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.data-table tbody tr:hover { background: var(--page); }
.data-table td.wrap { white-space: normal; }
.row-link { cursor: pointer; }
.empty-state { padding: 30px; text-align: center; color: var(--text-muted); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-good { color: var(--status-good); background: var(--status-good-bg); }
.badge-warning { color: var(--status-warning); background: var(--status-warning-bg); }
.badge-serious { color: var(--status-serious); background: var(--status-serious-bg); }
.badge-critical { color: var(--status-critical); background: var(--status-critical-bg); }
.badge-info { color: var(--status-info); background: var(--status-info-bg); }
.badge-muted { color: var(--status-muted); background: var(--status-muted-bg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.btn:hover { background: var(--page); }
.btn-primary { background: var(--series-blue); border-color: var(--series-blue); color: #fff; }
.btn-primary:hover { background: #2266ba; }
.btn-danger { background: var(--status-critical); border-color: var(--status-critical); color: #fff; }
.btn-danger:hover { background: #b52f2f; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.field input, .field select, .field textarea {
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--text-primary);
}
.field textarea { resize: vertical; min-height: 64px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--series-blue);
  outline-offset: -1px;
}
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filter-bar select, .filter-bar input { padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 13px; background: #fff; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(11,11,11,0.35);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto; z-index: 50;
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--surface-1);
  border-radius: var(--radius);
  padding: 22px 24px;
  width: 100%;
  max-width: 560px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.18);
}
.modal h3 { margin: 0 0 16px; font-size: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal-close { float: right; cursor: pointer; color: var(--text-muted); font-size: 18px; background: none; border: none; }

/* ---------- Misc ---------- */
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.mono { font-variant-numeric: tabular-nums; }
.section-gap { margin-top: 28px; }
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
}
.alert-error { background: var(--status-critical-bg); color: var(--status-critical); }
.alert-success { background: var(--status-good-bg); color: var(--status-good); }
.comment-item { padding: 10px 0; border-bottom: 1px solid var(--gridline); font-size: 13px; }
.comment-item:last-child { border-bottom: none; }
.comment-meta { color: var(--text-muted); font-size: 11px; margin-bottom: 2px; }

/* ---------- Login page ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page);
}
.login-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 100%;
  max-width: 360px;
}
.login-card h1 { font-size: 18px; margin: 0 0 4px; }
.login-card p.sub { color: var(--text-muted); font-size: 12px; margin: 0 0 22px; }
.login-card .field { margin-bottom: 14px; }
.login-hint {
  margin-top: 18px;
  padding: 10px 12px;
  background: var(--status-info-bg);
  color: var(--status-info);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  line-height: 1.6;
}

/* ---------- Calendar ---------- */
.calendar-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.calendar-nav { display: flex; align-items: center; gap: 10px; }
.calendar-title { font-size: 16px; font-weight: 700; min-width: 120px; text-align: center; }
.calendar-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; }
.calendar-legend label { display: flex; align-items: center; gap: 5px; cursor: pointer; color: var(--text-secondary); }
.calendar-legend input { width: auto; margin: 0; }
.calendar-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--gridline); border-left: 1px solid var(--gridline); }
.calendar-weekday { padding: 8px; text-align: center; font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--page); border-right: 1px solid var(--gridline); border-bottom: 1px solid var(--gridline); }
.calendar-cell { min-width: 0; min-height: 96px; padding: 6px; border-right: 1px solid var(--gridline); border-bottom: 1px solid var(--gridline); vertical-align: top; overflow: hidden; }
.calendar-cell.outside { background: var(--page); }
.calendar-cell.outside .calendar-date { color: var(--text-muted); }
.calendar-cell.today { background: var(--status-info-bg); }
.calendar-date { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.calendar-event { display: block; width: 100%; max-width: 100%; font-size: 11px; padding: 2px 5px; border-radius: 4px; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; box-sizing: border-box; }
.calendar-event-more { font-size: 11px; color: var(--text-muted); cursor: pointer; }

/* ---------- Room blocks ---------- */
.room-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; margin-bottom: 18px; }
.room-legend span.calendar-dot { width: 9px; height: 9px; }
.room-floor-group { margin-bottom: 22px; }
.room-floor-label { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.03em; }
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.room-block {
  min-width: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 12px 10px;
  cursor: pointer;
  background: var(--surface-1);
  position: relative;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.room-block:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.10); }
.room-block .room-number { font-size: 16px; font-weight: 700; }
.room-block .room-type { font-size: 11px; color: var(--text-secondary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-block .room-flags { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.room-block.status-AVAILABLE { background: var(--status-good-bg); }
.room-block.status-OCCUPIED { background: var(--status-info-bg); }
.room-block.status-OOO { background: var(--status-critical-bg); }
.room-block.status-OOS { background: var(--status-warning-bg); }
.room-block .maint-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--status-critical);
  position: absolute; top: 10px; right: 10px;
  border: 1.5px solid var(--surface-1);
}

@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { padding: 20px; }
  .form-grid { grid-template-columns: 1fr; }
}
