/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; color: #222; background: #f5f6f8; }
a { color: #01A490; text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'Courier New', monospace; font-size: 13px; background: #f0f0f0; padding: 1px 5px; border-radius: 3px; }

/* ── Navbar ───────────────────────────────────────────────── */
.navbar { background: #01A490; color: #fff; display: flex; align-items: center; padding: 0 24px; height: 52px; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 4px rgba(0,0,0,.15); }
.nav-brand { display: flex; align-items: center; gap: 10px; margin-right: 32px; }
.nav-logo { background: #fff; color: #01A490; font-weight: 800; font-size: 18px; width: 32px; height: 32px; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.nav-title { font-weight: 600; font-size: 16px; }
.nav-links { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav-link { color: rgba(255,255,255,.85); padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 14px; }
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.15); color: #fff; text-decoration: none; }
.nav-dropdown { position: relative; }
.nav-dropdown-menu { display: none; position: absolute; top: 100%; left: 0; background: #fff; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,.15); min-width: 180px; padding: 4px 0; margin-top: 4px; }
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-menu a { display: block; padding: 8px 16px; color: #222; font-size: 14px; }
.nav-dropdown-menu a:hover { background: #f5f6f8; color: #01A490; text-decoration: none; }
.nav-user { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.nav-user-name { color: rgba(255,255,255,.8); font-size: 13px; }

/* ── Login ────────────────────────────────────────────────── */
.login-page { background: #f5f6f8; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.1); padding: 48px 40px; width: 360px; text-align: center; }
.login-logo { background: #01A490; color: #fff; font-weight: 800; font-size: 32px; width: 60px; height: 60px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.login-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.login-sub { color: #666; margin-bottom: 28px; }
.btn-google { display: flex; align-items: center; justify-content: center; width: 100%; padding: 11px 16px; background: #fff; border: 1px solid #ddd; border-radius: 6px; color: #333; font-size: 14px; font-weight: 500; cursor: pointer; transition: background .15s; }
.btn-google:hover { background: #f8f8f8; text-decoration: none; }

/* ── Flash Messages ───────────────────────────────────────── */
.flash-container { padding: 0 24px 0; margin-top: 16px; }
.flash { padding: 10px 16px; border-radius: 6px; margin-bottom: 8px; font-size: 14px; }
.flash-success { background: #d4edda; color: #155724; border-left: 4px solid #28a745; }
.flash-error   { background: #f8d7da; color: #721c24; border-left: 4px solid #dc3545; }
.flash-warn    { background: #fff3cd; color: #856404; border-left: 4px solid #ffc107; }
.flash-info    { background: #d1ecf1; color: #0c5460; border-left: 4px solid #17a2b8; }

/* ── Main Content ─────────────────────────────────────────── */
.main-content { padding: 24px; max-width: 1400px; margin: 0 auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-sub { color: #666; margin-bottom: 20px; font-size: 13px; }
.user-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.section { margin-bottom: 28px; }
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.warn-title { color: #856404; }
.section-sub { color: #666; font-size: 13px; margin-bottom: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ── Cards ────────────────────────────────────────────────── */
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 16px; overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid #eee; }
.card-header h2 { font-size: 15px; font-weight: 600; }

/* ── Stat Cards ───────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); padding: 20px; text-align: center; }
.stat-card-warn { border-top: 3px solid #ffc107; }
.stat-number { font-size: 36px; font-weight: 700; color: #01A490; }
.stat-card-warn .stat-number { color: #856404; }
.stat-label { font-size: 12px; color: #666; margin-top: 4px; }
.stat-action { font-size: 11px; color: #856404; margin-top: 6px; font-weight: 500; }

/* ── Tables ───────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #f8f9fa; text-align: left; padding: 10px 14px; font-weight: 600; font-size: 12px; color: #555; border-bottom: 2px solid #eee; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
.data-table tr:hover td { background: #fafafa; }
.data-table tr:last-child td { border-bottom: none; }
.row-inactive td { color: #999; }
.note-cell { max-width: 200px; font-size: 12px; color: #666; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-count { font-size: 13px; color: #666; margin-bottom: 12px; }
.empty-state { color: #999; padding: 24px; text-align: center; font-style: italic; }
.small-text { font-size: 12px; color: #666; }

/* ── Status Badges ────────────────────────────────────────── */
.status-badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.status-active     { background: #d4edda; color: #155724; }
.status-inactive   { background: #e2e3e5; color: #383d41; }
.status-terminated { background: #f8d7da; color: #721c24; }
.status-suspended  { background: #fff3cd; color: #856404; }

/* ── System Badges ────────────────────────────────────────── */
.badge-cell { white-space: nowrap; }
.sys-badge { display: inline-block; width: 30px; height: 20px; line-height: 20px; text-align: center; border-radius: 3px; font-size: 10px; font-weight: 700; margin-right: 2px; }
.sys-on   { background: #01A490; color: #fff; }
.sys-off  { background: #e2e3e5; color: #999; }
.sys-warn { background: #ffc107; color: #333; }
.badge { display: inline-block; padding: 2px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-blue   { background: #cfe2ff; color: #084298; }
.badge-red    { background: #f8d7da; color: #721c24; }
.badge-yellow { background: #fff3cd; color: #856404; }

/* ── Detail layout ────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.detail-sidebar { display: flex; flex-direction: column; gap: 0; }
.action-card .card-header { padding: 12px 16px; }
.action-card > * { padding: 0 16px 16px; }
.action-card .card-header { padding: 12px 16px; margin-bottom: 0; }
.action-status { font-size: 14px; font-weight: 600; padding: 8px 0 4px; }
.status-ok   { color: #155724; }
.status-warn { color: #856404; }
.status-off  { color: #999; }
.action-hint { font-size: 12px; color: #666; margin: 4px 0 8px; }
.action-btn-row { margin-top: 8px; }
.btn-full { width: 100%; }
.info-list { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; padding: 16px 20px; }
.info-list dt { font-weight: 600; color: #555; font-size: 13px; }
.info-list dd { color: #222; font-size: 13px; }
.notes-box { margin: 0 20px 16px; padding: 10px 12px; background: #f8f9fa; border-radius: 6px; font-size: 13px; border-left: 3px solid #01A490; }
.warn-box { border-left-color: #ffc107; background: #fffbea; }
.cc-list { background: #f8f9fa; border-radius: 6px; padding: 8px; }
.cc-item { font-size: 12px; padding: 3px 0; }
.cc-label { color: #666; margin-right: 4px; }
.hint { font-size: 12px; color: #666; margin-top: 4px; }

/* ── System Access Grid (detail) ────────────────────────────── */
.sys-badge-lg { width: 36px; height: 36px; line-height: 36px; text-align: center; border-radius: 6px; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.access-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; padding: 16px; }
.access-item { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: 12px; cursor: default; }
.access-toggle { cursor: pointer; }
.access-toggle input[type=checkbox] { display: none; }
.access-status { font-size: 11px; color: #666; }

/* ── Forms ────────────────────────────────────────────────── */
.form-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); padding: 28px; max-width: 760px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-group label { font-weight: 600; font-size: 13px; color: #444; }
.label-hint { font-weight: 400; color: #888; font-size: 12px; }
.form-input, .form-select, .form-textarea { padding: 8px 10px; border: 1px solid #d0d5dd; border-radius: 6px; font-size: 14px; width: 100%; }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: #01A490; box-shadow: 0 0 0 2px rgba(1,164,144,.15); }
.form-textarea { resize: vertical; font-family: inherit; }
.form-divider { border: none; border-top: 1px solid #eee; margin: 20px 0; }
.form-actions { display: flex; gap: 10px; align-items: center; padding-top: 8px; }
.input-with-addon { display: flex; }
.input-with-addon .form-input { border-radius: 6px 0 0 6px; flex: 1; }
.input-addon { background: #f0f4f8; border: 1px solid #d0d5dd; border-left: none; padding: 8px 10px; border-radius: 0 6px 6px 0; font-size: 12px; color: #555; white-space: nowrap; display: flex; align-items: center; }
.input-with-btn { display: flex; gap: 8px; align-items: center; }
.input-with-btn .form-input { flex: 1; }
.form-input-inline { min-width: 160px; }
.form-input-sm { width: 100px !important; min-width: 80px; }
.form-select-sm { width: 160px !important; }
.checkbox-row { display: flex; gap: 20px; margin-bottom: 14px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.checkbox-label-sm { font-size: 12px; display: flex; align-items: center; gap: 4px; white-space: nowrap; cursor: pointer; }
.checkbox-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; background: #f8f9fa; padding: 12px; border-radius: 6px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 7px 14px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: background .15s, opacity .15s; text-decoration: none; }
.btn:hover { text-decoration: none; opacity: .9; }
.btn-primary   { background: #01A490; color: #fff; }
.btn-secondary { background: #e8f8f6; color: #01A490; border: 1px solid #01A490; }
.btn-ghost     { background: #f0f0f0; color: #444; }
.btn-danger    { background: #dc3545; color: #fff; }
.btn-danger-ghost { color: #dc3545; }
.btn-danger-ghost:hover { background: #f8d7da; }
.btn-sm  { padding: 4px 10px; font-size: 12px; }
.btn-xs  { padding: 3px 8px; font-size: 11px; }
.btn-lg  { padding: 10px 20px; font-size: 15px; }

/* ── Filter Bar ───────────────────────────────────────────── */
.filter-bar { display: flex; gap: 10px; align-items: center; background: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.08); margin-bottom: 16px; flex-wrap: wrap; }
.filter-input { flex: 1; min-width: 180px; padding: 7px 10px; border: 1px solid #d0d5dd; border-radius: 6px; font-size: 13px; }
.filter-select { padding: 7px 10px; border: 1px solid #d0d5dd; border-radius: 6px; font-size: 13px; }

/* ── Username check ───────────────────────────────────────── */
.username-section { background: #f8f9fa; border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.username-status { margin-top: 12px; padding: 12px; background: #fff; border-radius: 6px; border: 1px solid #eee; }
.check-row { display: flex; gap: 10px; align-items: center; padding: 4px 0; font-size: 13px; }
.fallback-row { display: flex; gap: 10px; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid #eee; font-size: 13px; }
.checking       { color: #888; font-style: italic; }
.status-available { color: #155724; font-weight: 600; }
.status-taken   { color: #721c24; font-weight: 600; }
.status-unknown { color: #888; }
.rehire-hint    { color: #155724; font-size: 12px; }
.conflict-hint  { color: #721c24; font-size: 12px; }

/* ── Setup pages ─────────────────────────────────────────── */
.setup-grid { display: grid; grid-template-columns: 320px 1fr; gap: 24px; align-items: start; }
.setup-grid .card { padding: 20px; }

/* ── Template editor ─────────────────────────────────────── */
.template-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.template-textarea { font-family: 'Courier New', monospace; font-size: 12px; min-height: 480px; }
.preview-note { font-size: 11px; color: #888; padding: 4px 16px 0; }
.preview-frame { width: 100%; height: 520px; border: none; padding: 12px; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn-warning { background: #fd7e14; color: #fff; }
.btn-warning:hover { background: #e86e0a; }

/* ── Offboarding checklist ────────────────────────────────── */
.checklist-item { display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.checklist-item:last-child { border-bottom: none; }
.checklist-done { color: #28a745; font-size: 13px; }

/* ── Forwarding page ──────────────────────────────────────── */
.action-cell { white-space: nowrap; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  .detail-grid    { grid-template-columns: 1fr; }
  .two-col        { grid-template-columns: 1fr; }
  .form-row       { grid-template-columns: 1fr; }
  .template-layout { grid-template-columns: 1fr; }
  .setup-grid     { grid-template-columns: 1fr; }
  .stat-grid      { grid-template-columns: repeat(2,1fr); }
  .access-grid    { grid-template-columns: repeat(3,1fr); }
}
