/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f4f6fb; color: #333; }
a { text-decoration: none; }

/* ── Login ─────────────────────────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; justify-content: center; align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); padding: 20px; }

.login-box { background: white; padding: 40px; border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,.2); width: 100%; max-width: 400px; }

.login-box h1 { font-size: 22px; color: #333; margin-bottom: 8px; text-align: center; }
.login-box h2 { font-size: 28px; color: #667eea; margin-bottom: 28px; text-align: center; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 5px; color: #555; font-weight: 500; font-size: 14px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 11px 13px; border: 1px solid #ddd; border-radius: 6px;
  font-size: 14px; transition: border-color .2s; background: #fafafa; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: #667eea; background: white;
  box-shadow: 0 0 0 3px rgba(102,126,234,.12); }

.error-message { background: #fee; color: #c33; padding: 10px; border-radius: 5px;
  margin-bottom: 14px; text-align: center; font-size: 14px; }

.btn-login { width: 100%; padding: 13px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white; border: none; border-radius: 6px; font-size: 16px;
  font-weight: 600; cursor: pointer; transition: transform .2s; }
.btn-login:hover { transform: translateY(-2px); }

/* ── Dashboard Layout ──────────────────────────────────────────────────────── */
.dashboard { display: flex; flex-direction: column; min-height: 100vh; }

.dashboard-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white; padding: 0 20px; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,.2); }

.header-content { display: flex; align-items: center; justify-content: space-between;
  height: 60px; max-width: 1400px; margin: 0 auto; width: 100%; }

.header-content h1 { font-size: 20px; font-weight: 700; }

.menu-toggle { display: none; background: none; border: none; color: white;
  font-size: 24px; cursor: pointer; padding: 5px; }

.user-info { display: flex; align-items: center; gap: 15px; font-size: 14px; }

.btn-logout { background: rgba(255,255,255,.2); color: white;
  border: 1px solid rgba(255,255,255,.5); padding: 6px 14px;
  border-radius: 5px; cursor: pointer; font-size: 14px; transition: background .2s; }
.btn-logout:hover { background: rgba(255,255,255,.35); }

.dashboard-container { display: flex; flex: 1; max-width: 1400px; margin: 0 auto; width: 100%; }

.sidebar { width: 220px; background: white; border-right: 1px solid #eee;
  padding: 20px 0; min-height: calc(100vh - 60px);
  position: sticky; top: 60px; height: calc(100vh - 60px);
  overflow-y: auto; flex-shrink: 0; }

.sidebar-header { display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px 20px; font-weight: 700; font-size: 18px; color: #333; }

.close-menu { background: none; border: none; font-size: 28px; cursor: pointer; color: #666; line-height: 1; }

.nav-link { display: flex; align-items: center; gap: 10px; padding: 14px 20px;
  color: #555; font-weight: 500; transition: all .2s; border-left: 3px solid transparent; }
.nav-link:hover { background: #f0eeff; color: #667eea; }
.nav-link.active { background: #f0eeff; color: #667eea; border-left-color: #667eea; }
.nav-icon { font-size: 18px; }
.nav-divider { border-top: 1px solid #eee; margin: 8px 16px; }

.main-content { flex: 1; padding: 20px; overflow-y: auto; }

.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 150; }

.desktop-only { display: flex; }
.mobile-only  { display: none; }

/* ── Page ───────────────────────────────────────────────────────────────────── */
.page { max-width: 1200px; margin: 0 auto; }

.page-header { display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-header h2 { font-size: 24px; color: #333; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn-primary { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white; border: none; padding: 10px 20px; border-radius: 6px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(102,126,234,.4); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.btn-secondary { background: #f0f0f0; color: #333; border: 1px solid #ddd;
  padding: 10px 20px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.btn-secondary:hover { background: #e0e0e0; }

.btn-edit { background: #e3f2fd; color: #1976d2; border: 1px solid #90caf9;
  padding: 5px 12px; border-radius: 4px; font-size: 13px; cursor: pointer; }
.btn-edit:hover { background: #bbdefb; }

.btn-delete { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a;
  padding: 5px 12px; border-radius: 4px; font-size: 13px; cursor: pointer; }
.btn-delete:hover { background: #ffcdd2; }

.btn-copy { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7;
  padding: 5px 12px; border-radius: 4px; font-size: 13px; cursor: pointer; transition: all .2s; }
.btn-copy:hover { background: #c8e6c9; }
.btn-copy.copied { background: #2e7d32; color: white; border-color: #2e7d32; }

/* ── Search ─────────────────────────────────────────────────────────────────── */
.search-bar { position: relative; margin-bottom: 20px; }
.search-input { width: 100%; padding: 12px 16px; border: 1px solid #ddd;
  border-radius: 8px; font-size: 15px; transition: border-color .2s, box-shadow .2s; }
.search-input:focus { outline: none; border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102,126,234,.15); }

.clear-search { position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; font-size: 22px; color: #999; cursor: pointer; line-height: 1; }
.clear-search:hover { color: #333; }

/* ── Stats ──────────────────────────────────────────────────────────────────── */
.customer-stats { display: flex; gap: 16px; margin-bottom: 20px; }
.stat-card { background: white; border-radius: 10px; padding: 16px 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07); display: flex; flex-direction: column;
  align-items: center; min-width: 120px; border-left: 4px solid #667eea; }
.stat-number { font-size: 32px; font-weight: 700; color: #667eea; line-height: 1; }
.stat-label  { font-size: 12px; color: #888; margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }

/* ── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; justify-content: center; align-items: center; z-index: 1000; padding: 20px; }
.modal { background: white; border-radius: 10px; width: 100%; max-width: 500px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-large { max-width: 700px; }

.modal-header { display: flex; justify-content: space-between; align-items: center;
  padding: 20px; border-bottom: 1px solid #eee; }
.modal-header h3 { font-size: 20px; color: #333; }
.modal-close { background: none; border: none; font-size: 28px; cursor: pointer;
  color: #888; line-height: 1; padding: 0; }
.modal-close:hover { color: #333; }

.modal-form { padding: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── Table ──────────────────────────────────────────────────────────────────── */
.table-container { background: white; border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08); overflow: hidden; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 600px; }
.data-table th { background: #f8f8f8; padding: 12px 16px; text-align: left;
  font-size: 13px; color: #555; font-weight: 600; text-transform: uppercase;
  letter-spacing: .5px; border-bottom: 2px solid #eee; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid #f0f0f0;
  font-size: 14px; color: #333; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbff; }

.desc-cell { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions-cell { display: flex; gap: 6px; white-space: nowrap; }
.empty-row { text-align: center; color: #999; padding: 40px; font-style: italic; }
.empty-state { text-align: center; color: #999; padding: 60px; font-style: italic;
  background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.08); }

.badge { background: #e8eeff; color: #667eea; padding: 3px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }

.row-num { color: #aaa; font-size: 13px; width: 40px; }
.date-cell { color: #666; font-size: 13px; white-space: nowrap; }

.customer-name-cell { display: flex; align-items: center; gap: 12px; }
.customer-avatar { width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; flex-shrink: 0; }

/* ── Auth Cards ─────────────────────────────────────────────────────────────── */
.auth-cards { display: flex; flex-direction: column; gap: 16px; }
.auth-card { background: white; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.08);
  overflow: hidden; border: 1px solid #eee; }
.auth-card-header { display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid #f0f0f0; background: #fafbff;
  flex-wrap: wrap; gap: 8px; }
.auth-card-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.auth-text-preview { padding: 16px; background: #1e1e1e; overflow-x: auto; }
.auth-text-preview pre { color: #d4d4d4; font-family: 'Courier New', monospace;
  font-size: 13px; white-space: pre-wrap; word-break: break-all; margin: 0; line-height: 1.6; }
.auth-card-footer { padding: 8px 16px; border-top: 1px solid #f0f0f0; background: #fafbff; }
.char-count-display { font-size: 12px; color: #999; }
.char-count { font-size: 12px; color: #999; font-weight: 400; margin-left: 8px; }
.auth-textarea { font-family: 'Courier New', monospace; font-size: 13px;
  resize: vertical; min-height: 200px; }

/* ── Change Password ────────────────────────────────────────────────────────── */
.cp-page { max-width: 480px; margin: 0 auto; padding: 10px 0; }
.cp-card { background: white; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.09); overflow: hidden; }
.cp-header { display: flex; align-items: center; gap: 16px; padding: 24px 28px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.cp-avatar { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700;
  flex-shrink: 0; border: 2px solid rgba(255,255,255,.5); }
.cp-header h2 { font-size: 20px; margin-bottom: 2px; }
.cp-username { font-size: 13px; opacity: .85; margin: 0; }
.cp-form { padding: 28px; }
.cp-divider { border-top: 1px dashed #eee; margin: 8px 0 20px; }

.input-eye { position: relative; display: flex; align-items: center; }
.input-eye input { width: 100%; padding: 11px 44px 11px 14px; border: 1.5px solid #ddd;
  border-radius: 8px; font-size: 15px; background: #fafafa;
  transition: border-color .2s, box-shadow .2s; }
.input-eye input:focus { outline: none; border-color: #667eea; background: white;
  box-shadow: 0 0 0 3px rgba(102,126,234,.12); }
.eye-btn { position: absolute; right: 10px; background: none; border: none;
  cursor: pointer; font-size: 18px; padding: 0; line-height: 1; opacity: .6; }
.eye-btn:hover { opacity: 1; }

.strength-wrap { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.strength-bar  { flex: 1; height: 5px; background: #eee; border-radius: 4px; overflow: hidden; }
.strength-fill { height: 100%; border-radius: 4px; transition: width .3s, background .3s; }
.strength-label { font-size: 12px; font-weight: 600; min-width: 46px; }

.match-msg { font-size: 13px; margin-top: 6px; font-weight: 500; }
.match-msg.match    { color: #4caf50; }
.match-msg.no-match { color: #f44336; }

.btn-save { width: 100%; padding: 13px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white; border: none; border-radius: 8px; font-size: 15px;
  font-weight: 600; cursor: pointer; transition: transform .2s, box-shadow .2s; margin-top: 8px; }
.btn-save:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(102,126,234,.4); }
.btn-save:disabled { opacity: .5; cursor: not-allowed; }

/* ── Notification Toast ─────────────────────────────────────────────────────── */
.notification { position: fixed; top: 76px; right: 20px; z-index: 2000;
  padding: 14px 20px; border-radius: 8px; font-weight: 500; font-size: 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15); animation: slideIn .3s ease; max-width: 360px; }
.notification.success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #4caf50; }
.notification.error   { background: #fce4ec; color: #c62828; border-left: 4px solid #f44336; }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .menu-toggle  { display: block; }
  .desktop-only { display: none; }
  .mobile-only  { display: block; }

  .sidebar { position: fixed; top: 0; left: -280px; width: 280px; height: 100vh;
    z-index: 200; transition: left .3s ease; padding-top: 0;
    display: flex; flex-direction: column; }
  .sidebar.open { left: 0; }
  .overlay { display: block; }

  .main-content { padding: 15px; }
  .page-header h2 { font-size: 20px; }
  .modal { border-radius: 10px; }
  .modal-actions { flex-direction: column; }
  .modal-actions button { width: 100%; }
  .customer-stats { flex-wrap: wrap; }
  .stat-card { flex: 1; min-width: 100px; }
  .auth-card-header { flex-direction: column; align-items: flex-start; }
  .auth-card-actions { width: 100%; justify-content: flex-end; }
  .cp-form   { padding: 20px; }
  .cp-header { padding: 20px; }
  .notification { right: 10px; left: 10px; max-width: none; }
}
