*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  background: #fff;
  color: #111;
  min-height: 100vh;
}

/* ── LOGIN ── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-box {
  width: 100%;
  max-width: 360px;
  border: 1.5px solid #111;
  padding: 32px 28px;
}

.login-box input {
  width: 100%; padding: 12px;
  border: 1.5px solid #111; border-radius: 0;
  font-size: 15px; outline: none;
  margin-bottom: 10px;
  letter-spacing: 2px;
}

.login-box input:focus { box-shadow: 2px 2px 0 #111; }

.login-box button {
  width: 100%; padding: 13px;
  background: #111; color: #fff;
  border: 1.5px solid #111; border-radius: 0;
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: opacity 0.15s;
}
.login-box button:hover { opacity: 0.8; }

#login-error {
  margin-top: 10px;
  font-size: 12px;
  color: #c00;
  text-align: center;
  min-height: 16px;
}

/* ── DASHBOARD ── */
#app { max-width: 640px; margin: 0 auto; padding: 24px 16px; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 2px solid #111;
  margin-bottom: 24px;
}

.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 36px; height: 36px;
  background: #111; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600;
}
.logo-name { font-size: 16px; font-weight: 600; letter-spacing: -0.3px; }
.logo-sub { font-size: 11px; color: #888; }

#logout-btn {
  font-size: 12px; color: #888;
  background: none; border: none; cursor: pointer;
  padding: 4px 8px;
}
#logout-btn:hover { color: #111; }

.search-row { display: flex; gap: 8px; margin-bottom: 20px; }
.search-row input {
  flex: 1; padding: 10px 12px;
  border: 1.5px solid #111; border-radius: 0;
  font-size: 14px; outline: none;
}
.search-row input:focus { border-color: #111; box-shadow: 2px 2px 0 #111; }

.client-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 4px;
  border: 1px solid #e0e0e0; cursor: pointer;
  transition: border-color 0.1s;
}
.client-card:hover { border-color: #111; }
.client-card.active { border: 1.5px solid #111; background: #f9f9f9; }

.client-av {
  width: 40px; height: 40px; border: 1.5px solid #111;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.client-info { flex: 1; }
.client-name { font-size: 14px; font-weight: 600; }
.client-phone { font-size: 12px; color: #888; }
.client-tickets { text-align: right; }
.ticket-count { font-size: 24px; font-weight: 600; line-height: 1; }
.ticket-count.zero { color: #aaa; text-decoration: line-through; }
.ticket-count.low { color: #888; }
.ticket-label { font-size: 10px; color: #aaa; text-transform: uppercase; letter-spacing: 0.5px; }

.detail-panel {
  margin-top: 16px;
  border: 1.5px solid #111;
  padding: 20px;
}
.detail-header {
  display: flex; gap: 14px; align-items: center;
  padding-bottom: 16px; border-bottom: 1px solid #e0e0e0; margin-bottom: 16px;
}
.detail-av {
  width: 52px; height: 52px; border: 1.5px solid #111;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600; flex-shrink: 0;
}
.detail-name { font-size: 17px; font-weight: 600; }
.detail-meta { font-size: 12px; color: #888; margin-top: 2px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.stat { border: 1px solid #e0e0e0; padding: 12px; text-align: center; }
.stat-val { font-size: 24px; font-weight: 600; }
.stat-key { font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

.btn-primary {
  width: 100%; padding: 14px;
  background: #111; color: #fff;
  border: 1.5px solid #111; border-radius: 0;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.8; }
.btn-primary:disabled { opacity: 0.25; cursor: not-allowed; }

.section-label {
  font-size: 10px; color: #888;
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 8px; font-weight: 600;
}

.history-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0; border-bottom: 0.5px solid #e0e0e0;
  font-size: 12px;
}
.history-row:last-child { border: none; }
.history-date, .history-by { color: #888; }
.history-action { font-weight: 600; }

.no-result { text-align: center; padding: 32px; color: #888; font-size: 13px; }
.loading { text-align: center; padding: 24px; font-size: 13px; color: #888; }

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #111; color: #fff;
  padding: 10px 24px; font-size: 13px; font-weight: 600;
  opacity: 0; transition: opacity 0.2s; pointer-events: none;
  white-space: nowrap;
}
#toast.show { opacity: 1; }

/* ── MODAL ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.4); z-index: 100;
  align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }

.modal-box {
  background: #fff; border: 1.5px solid #111;
  width: 90%; max-width: 380px; padding: 24px;
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.modal-body { font-size: 14px; color: #555; margin-bottom: 20px; line-height: 1.5; }
.modal-actions { display: flex; gap: 8px; }
.modal-actions button {
  flex: 1; padding: 12px; font-size: 14px; font-weight: 600;
  border: 1.5px solid #111; cursor: pointer; transition: opacity 0.15s;
}
.modal-actions button:hover { opacity: 0.8; }
.modal-cancel { background: #fff; color: #111; }
.modal-confirm { background: #111; color: #fff; }

.close-detail {
  position: absolute; top: 20px; right: 20px;
  width: 28px; height: 28px; border: 1.5px solid #111;
  background: #fff; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  font-size: 18px; line-height: 1; font-weight: 600;
  transition: background 0.15s;
}
.close-detail:hover { background: #f5f5f5; }

/* ── MANUAL SESSIONS INPUT ── */
.manual-sessions-wrapper {
  background: #fafafa;
  border: 1px solid #e8e8e8;
  padding: 12px;
  margin-top: 12px;
}

.manual-sessions-input {
  flex: 1;
  padding: 11px 12px;
  border: 1.5px solid #ddd;
  font-size: 13px;
  outline: none;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.manual-sessions-input:focus {
  border-color: #111;
  box-shadow: 0 0 0 2px rgba(17, 17, 17, 0.08);
}

.manual-sessions-button {
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: #111;
  color: #fff;
  border: 1.5px solid #111;
  cursor: pointer;
  transition: opacity 0.15s;
}

.manual-sessions-button:hover { opacity: 0.85; }

/* ── EDIT FORM ── */
.edit-form-wrapper {
  background: #fafafa;
  border: 1px solid #e8e8e8;
  padding: 16px;
  margin-top: 16px;
  display: none;
}

.edit-form-input {
  width: 100%;
  padding: 11px 12px;
  border: 1.5px solid #ddd;
  font-size: 13px;
  margin-bottom: 10px;
  outline: none;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.edit-form-input:focus {
  border-color: #111;
  box-shadow: 0 0 0 2px rgba(17, 17, 17, 0.08);
}

.edit-form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.edit-cancel-btn, .edit-save-btn {
  padding: 11px;
  border: 1.5px solid #111;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.15s;
}

.edit-cancel-btn {
  background: #fff;
  color: #111;
}

.edit-save-btn {
  background: #111;
  color: #fff;
}

.edit-cancel-btn:hover, .edit-save-btn:hover { opacity: 0.85; }

.edit-toggle-btn {
  width: 100%;
  margin-top: 16px;
  padding: 11px;
  border: 1.5px solid #e0e0e0;
  background: #fff;
  color: #666;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.edit-toggle-btn:hover {
  border-color: #111;
  color: #111;
}

/* ── BUTTON GRID IMPROVEMENTS ── */
.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.add-session-btn {
  background: #fff;
  color: #111;
  border: 1.5px solid #111;
  font-size: 12px;
  font-weight: 600;
  padding: 11px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.add-session-btn:hover {
  background: #111;
  color: #fff;
}

/* ── SECTION DIVIDER ── */
.section-divider {
  height: 1px;
  background: #e8e8e8;
  margin: 20px 0;
}
