@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@500;600;700&display=swap');

:root {
  /* THE AMNIS 高雄然一酒店 風格參考：水的意象、極簡奢華、黑白高對比、木質/大理石暖灰調 */
  --navy: #1a1917;
  --navy-light: #322f2a;
  --gold: #a1815a;
  --gold-light: #cbb28f;
  --bg: #f6f4ef;
  --card: #ffffff;
  --text: #1c1b19;
  --muted: #83796c;
  --danger: #b5443c;
  --warn: #a1815a;
  --ok: #4d6b5e;
  --border: #e6e1d6;
  --radius: 4px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "PingFang TC", "Microsoft JhengHei", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

h1, h2, .brand-text, .login-brand {
  font-family: "Noto Serif TC", "PingFang TC", serif;
  letter-spacing: 0.03em;
}

.app { min-height: 100vh; display: none; flex-direction: column; }
.app.active { display: flex; }

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
  padding: 20px;
}
.login-screen.hidden { display: none; }

.login-box {
  background: white;
  border-radius: var(--radius);
  padding: 32px 28px;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 4px;
}
.login-box h1 { font-size: 18px; margin: 0 0 6px; }
.login-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 16px;
}

.topbar {
  background: var(--navy);
  color: white;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  font-size: 18px;
  font-weight: 600;
}
.brand-icon { font-size: 22px; }

.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tab-btn {
  background: transparent;
  border: none;
  color: #cfd8e3;
  padding: 12px 14px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all .15s;
}
.tab-btn:hover { color: white; }
.tab-btn.active {
  color: white;
  border-bottom-color: var(--gold);
  font-weight: 600;
}

.user-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
}
.user-switcher #current-username {
  color: #cfd8e3;
  font-size: 13px;
}
.user-switcher #logout-btn {
  padding: 5px 12px;
  font-size: 12px;
}
.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: white;
  background: var(--muted);
}
.role-badge.coordinator { background: var(--gold); color: var(--navy); }
.role-badge.housekeeper { background: #3d7fd9; }

.permission-note {
  background: #fff9ec;
  border: 1px solid var(--warn);
  color: #7a5b0d;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 18px;
}

.content {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 17px; margin: 0 0 10px; }

.page { display: none; }
.page.active { display: block; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--border);
  text-align: center;
}
.stat-card.warn { border-color: var(--warn); background: #fff9ec; }
.stat-card.danger { border-color: var(--danger); background: #fdf1f1; }

.stat-num { font-size: 32px; font-weight: 700; color: var(--navy); }
.stat-card.warn .stat-num { color: var(--warn); }
.stat-card.danger .stat-num { color: var(--danger); }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

.panel {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px;
  margin-bottom: 18px;
}

.hint { color: var(--muted); font-size: 13px; margin: 0 0 12px; }

.reminder-list { display: flex; flex-direction: column; gap: 8px; }
.reminder-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f8f9fb;
  border-left: 4px solid var(--muted);
  font-size: 14px;
}
.reminder-item.warn { border-left-color: var(--warn); background: #fff9ec; }
.reminder-item.danger { border-left-color: var(--danger); background: #fdf1f1; }
.reminder-item .badge { font-size: 12px; padding: 2px 8px; border-radius: 20px; }
.badge.warn { background: var(--warn); color: white; }
.badge.danger { background: var(--danger); color: white; }
.empty-msg { color: var(--muted); font-size: 14px; padding: 12px 0; }

.card-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  max-width: 720px;
}

.form-row { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.form-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-row.two-col > div { display: flex; flex-direction: column; gap: 6px; }

label { font-size: 13px; font-weight: 600; color: var(--navy-light); }
.req { color: var(--danger); }

input[type=text], input[type=number], input[type=date],
input[type=datetime-local], select, textarea {
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy-light);
}

.photo-preview {
  margin-top: 8px;
  max-width: 160px;
  max-height: 160px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: cover;
}

.form-actions { display: flex; gap: 10px; margin-top: 6px; }

button { cursor: pointer; font-family: inherit; }

.btn-primary {
  background: var(--navy);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
}
.btn-primary:hover { background: var(--navy-light); }

.btn-secondary {
  background: white;
  color: var(--navy);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 7px;
  font-size: 14px;
}
.btn-secondary:hover { background: #f2f4f7; }

.btn-danger {
  background: white;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 10px 18px;
  border-radius: 7px;
  font-size: 14px;
}
.btn-danger:hover { background: #fdf1f1; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  background: var(--card);
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.filter-bar input, .filter-bar select { flex: 1; min-width: 140px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
th, td {
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
th {
  background: #f8f9fb;
  color: var(--navy-light);
  font-weight: 600;
}
tr:hover td { background: #fafbfd; }
tr.clickable { cursor: pointer; }

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}
.status-pending { background: var(--warn); }
.status-claimed { background: var(--ok); }
.status-returned { background: #3d7fd9; }
.status-disposed, .status-donated { background: var(--muted); }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 36, 62, .5);
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: white;
  border-radius: 12px;
  max-width: 560px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 26px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  font-size: 18px;
  color: var(--muted);
}

.detail-grid { display: grid; grid-template-columns: 120px 1fr; row-gap: 10px; font-size: 14px; }
.detail-grid dt { color: var(--muted); font-weight: 600; }
.detail-grid dd { margin: 0; }
.detail-photo { max-width: 100%; max-height: 220px; border-radius: 8px; margin-bottom: 14px; }

.action-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.action-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.action-buttons button {
  border: 1px solid var(--border);
  background: white;
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 13px;
}
.action-buttons button:hover { background: #f2f4f7; }
.action-buttons button.danger { color: var(--danger); border-color: var(--danger); }

.claim-form { display: none; flex-direction: column; gap: 10px; margin-top: 10px; }
.claim-form.active { display: flex; }
.claim-form input, .claim-form textarea { width: 100%; }

.daily-summary { display: flex; gap: 20px; margin-bottom: 12px; font-size: 14px; }
.daily-summary b { color: var(--navy); font-size: 20px; }

.attendance-file {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  background: #f8f9fb;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

tr.row-missing td { background: #fdf1f1; }
tr.row-missing td:first-child { border-left: 3px solid var(--danger); }

@media (max-width: 640px) {
  .form-row.two-col { grid-template-columns: 1fr; }
  .content { padding: 14px; }
}
