/* M365 Offboarding Portal — Custom Styles */

:root {
  --primary:    #0f4c81;
  --primary-lt: #1a6fba;
  --accent:     #e8a923;
  --danger:     #c0392b;
  --success:    #27ae60;
  --warning:    #e67e22;
  --info:       #2980b9;
  --bg:         #f0f2f5;
  --card-bg:    #ffffff;
  --text:       #1a1a2e;
  --muted:      #6c757d;
  --border:     #dee2e6;
  --sidebar-w:  260px;
}

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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Sidebar ──────────────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--primary);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.sidebar-brand h1 {
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.sidebar-brand span {
  color: var(--accent);
}

.sidebar-brand p {
  color: rgba(255,255,255,.55);
  font-size: 11px;
  margin-top: 4px;
}

.sidebar-nav { flex: 1; padding: 16px 0; }

.nav-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  color: rgba(255,255,255,.4);
  padding: 12px 20px 4px;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.8);
  text-decoration: none;
  font-size: 13.5px;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255,255,255,.1);
  color: #fff;
  border-left-color: var(--accent);
}

.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.sidebar-user .user-name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-role {
  color: rgba(255,255,255,.5);
  font-size: 11px;
}

.sidebar-user a {
  color: rgba(255,255,255,.5);
  font-size: 11px;
  text-decoration: none;
}

.sidebar-user a:hover { color: var(--accent); }

/* ── Main content ─────────────────────────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  padding: 32px;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}

.page-header p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

/* ── Cards ────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafbfc;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.card-body { padding: 20px; }

/* ── Stats grid ───────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.stat-card .label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
}

.stat-card .value {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
  margin-top: 4px;
}

/* ── Tables ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: #f5f6f8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border); transition: background .1s; }
tbody tr:hover { background: #f8f9ff; }
tbody td { padding: 10px 14px; vertical-align: middle; }

/* ── Badges ───────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-error   { background: #f8d7da; color: #721c24; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info    { background: #d1ecf1; color: #0c5460; }
.badge-muted   { background: #e9ecef; color: #6c757d; }
.badge-running { background: #cce5ff; color: #004085; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all .15s;
  line-height: 1;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-lt); }

.btn-accent {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-accent:hover { filter: brightness(1.1); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { filter: brightness(1.1); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }

/* ── Forms ────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

label .hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15,76,129,.12);
}

textarea { resize: vertical; min-height: 80px; }

/* ── Step checklist ───────────────────────────────────────────────────── */
.step-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
  background: #fff;
}

.step-item:hover { border-color: var(--primary); background: #f0f4ff; }

.step-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.step-item .step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Step log timeline ────────────────────────────────────────────────── */
.step-log-row td:first-child { font-family: monospace; font-size: 12px; }

.status-ok      { color: var(--success); }
.status-error   { color: var(--danger); }
.status-skipped { color: var(--muted); }

/* ── Progress bar ─────────────────────────────────────────────────────── */
.progress-bar-wrap {
  height: 8px;
  background: #e9ecef;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-lt));
  border-radius: 4px;
  transition: width .4s ease;
}

/* ── Upload zone ──────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 28px;
  text-align: center;
  background: #fafbfc;
  transition: all .2s;
  cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: #f0f4ff;
}

.upload-zone p { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* ── Alerts ───────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  font-size: 13px;
  border-left: 4px solid;
  margin-bottom: 16px;
}

.alert-danger  { background: #fff5f5; border-color: var(--danger); color: #721c24; }
.alert-success { background: #f0fff4; border-color: var(--success); color: #155724; }
.alert-info    { background: #eff8ff; border-color: var(--info); color: #0c5460; }
.alert-warning { background: #fffdf0; border-color: var(--warning); color: #856404; }

/* ── Login page ───────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #16304f 100%);
}

.login-card {
  background: #fff;
  border-radius: 14px;
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  text-align: center;
}

.login-card .logo { font-size: 40px; margin-bottom: 8px; }
.login-card h1 { font-size: 22px; font-weight: 800; color: var(--primary); }
.login-card p  { color: var(--muted); font-size: 13px; margin: 8px 0 28px; }

.ms-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 13px;
  background: #fff;
  border: 1.5px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  text-decoration: none;
  transition: all .15s;
  cursor: pointer;
}

.ms-btn:hover { border-color: #0078d4; box-shadow: 0 2px 8px rgba(0,120,212,.15); }

/* ── Snapshot view ────────────────────────────────────────────────────── */
.snap-section { margin-bottom: 20px; }
.snap-section h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.snap-tag {
  display: inline-block;
  padding: 2px 8px;
  background: #e8f0fe;
  color: #1a56db;
  border-radius: 4px;
  font-size: 12px;
  margin: 2px;
}

/* ── Mode toggle ──────────────────────────────────────────────────────── */
.mode-tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
  width: fit-content;
}

.mode-tab {
  padding: 9px 22px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: #fff;
  color: var(--muted);
  transition: all .15s;
}

.mode-tab.active {
  background: var(--primary);
  color: #fff;
}

/* ── Util ─────────────────────────────────────────────────────────────── */
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.text-muted { color: var(--muted); }
.text-sm { font-size: 12px; }
.font-mono { font-family: monospace; }
.text-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

/* ── Detail toggle ────────────────────────────────────────────────────── */
.detail-cell {
  font-size: 11px;
  color: var(--muted);
  font-family: monospace;
  max-width: 360px;
  white-space: pre-wrap;
  word-break: break-all;
}

.collapsible { cursor: pointer; }
.collapsible:after { content: ' ▼'; font-size: 10px; }
.collapsible.open:after { content: ' ▲'; }
