/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --bg2: #f7f7f5;
  --bg3: #f0efec;
  --border: rgba(0,0,0,0.10);
  --border2: rgba(0,0,0,0.18);
  --text: #1a1a1a;
  --text2: #555550;
  --text3: #888880;
  --accent: #1a1a1a;
  --accent-fg: #ffffff;
  --radius: 10px;
  --radius-sm: 6px;
  --danger: #c0392b;
  --danger-bg: #fdf0ef;
  --success: #1a7a4a;
  --success-bg: #edf8f2;
  --warning: #8a5c00;
  --warning-bg: #fef8ec;
  --info: #1a4f8a;
  --info-bg: #eef4fc;
  --role-admin-bg: #f0effe; --role-admin: #5b50c8;
  --role-manager-bg: #e8f8f2; --role-manager: #0f7a58;
  --role-staff-bg: #fef4e6; --role-staff: #9a6200;
  --role-accountant-bg: #e8f2fc; --role-accountant: #1a5fa0;
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; background: var(--bg2); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; }

/* ── Auth Layout ── */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }

.auth-container {
  display: flex;
  width: 100%;
  max-width: 820px;
  min-height: 580px;
  background: var(--bg);
  border-radius: 16px;
  border: 0.5px solid var(--border);
  overflow: hidden;
}

.auth-sidebar {
  width: 260px;
  background: var(--bg2);
  border-right: 0.5px solid var(--border);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.brand-name { font-size: 17px; font-weight: 600; color: var(--text); }
.brand-org { font-size: 12px; color: var(--text3); margin-bottom: 32px; }

.auth-features { display: flex; flex-direction: column; gap: 16px; }
.feat { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text2); line-height: 1.4; }
.feat-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; }

.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px; }

.auth-form { width: 100%; max-width: 360px; display: none; }
.auth-form.active { display: block; }
.auth-form h1 { font-size: 22px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.auth-subtitle { font-size: 14px; color: var(--text2); margin-bottom: 24px; }

/* ── Form Elements ── */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 12px; font-size: 13px; color: var(--text);
  background: var(--bg); border: 0.5px solid var(--border2);
  border-radius: var(--radius-sm); outline: none; transition: border-color 0.15s;
  font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(26,26,26,0.08); }
.field input::placeholder { color: var(--text3); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 38px; }
.pw-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text3); padding: 0; display: flex; align-items: center; }
.pw-toggle:hover { color: var(--text); }

.pw-strength-bar { height: 3px; background: var(--bg3); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.pw-strength-bar div { height: 100%; width: 0; border-radius: 2px; transition: width 0.3s, background 0.3s; }
.pw-strength-text { font-size: 11px; color: var(--text3); margin-top: 3px; display: block; }

/* ── Role Grid ── */
.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.role-card {
  border: 0.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px; cursor: pointer; transition: all 0.15s;
  display: flex; flex-direction: column; gap: 2px;
}
.role-card:hover { border-color: var(--border2); background: var(--bg2); }
.role-card.selected { border-color: #1a1a1a; background: var(--bg2); }
.role-icon { font-size: 18px; margin-bottom: 2px; }
.role-card strong { font-size: 12px; font-weight: 600; color: var(--text); }
.role-card span { font-size: 10px; color: var(--text3); line-height: 1.3; }

/* ── Buttons ── */
.btn-primary {
  width: 100%; padding: 10px; background: var(--accent); color: var(--accent-fg);
  border: none; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: opacity 0.15s; margin-top: 6px; font-family: inherit;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-switch { font-size: 12px; color: var(--text3); text-align: center; margin-top: 14px; }
.auth-switch a { color: var(--text); font-weight: 500; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* ── Error/Success Messages ── */
.error-msg { background: var(--danger-bg); color: var(--danger); font-size: 12px; padding: 9px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; border: 0.5px solid rgba(192,57,43,0.2); }
.success-msg { background: var(--success-bg); color: var(--success); font-size: 12px; padding: 9px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.hidden { display: none !important; }

/* ── Role Badge ── */
.role-badge-pill {
  font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 500; display: inline-flex; align-items: center;
}
.role-Admin { background: var(--role-admin-bg); color: var(--role-admin); }
.role-Manager { background: var(--role-manager-bg); color: var(--role-manager); }
.role-Staff { background: var(--role-staff-bg); color: var(--role-staff); }
.role-Accountant { background: var(--role-accountant-bg); color: var(--role-accountant); }

/* ── Type Pills ── */
.type-pill { font-size: 10px; padding: 2px 7px; border-radius: 20px; font-weight: 500; display: inline-block; margin-bottom: 5px; }
.type-si { background: #e8f8f2; color: #0f7a58; }
.type-pb { background: #e8f2fc; color: #1a5fa0; }
.type-rc { background: #fef4e6; color: #9a6200; }
.type-er { background: #fdf0f8; color: #8a3060; }
.type-ct { background: #f0effe; color: #5b50c8; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: var(--text); color: var(--accent-fg); padding: 10px 18px;
  border-radius: var(--radius); font-size: 13px; display: flex; align-items: center; gap: 10px;
  transition: transform 0.3s; z-index: 999; white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast-spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 600px) {
  .auth-sidebar { display: none; }
  .auth-container { max-width: 100%; min-height: auto; }
  .auth-main { padding: 24px 20px; }
  .field-row { grid-template-columns: 1fr; }
}
