/* ============================================================
   Wanderus HR Portal — stylesheet
   Palette: neutral cool-gray surface, deep teal accent.
   ============================================================ */

:root {
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --text: #1A1D23;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --accent: #2F6F5E;
  --accent-dark: #24564A;
  --accent-tint: #E7F1EE;
  --warn: #C08A2E;
  --warn-tint: #FBF1DF;
  --danger: #B23A48;
  --danger-tint: #FBE9EB;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-weight: 700; margin: 0 0 8px; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------------- App shell / sidebar ---------------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 20px;
}

.brand-mark {
  width: 32px; height: 32px;
  background: var(--accent);
  color: white;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 15px;
}

.brand-name { font-weight: 700; font-size: 15px; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-grow: 1;
}

.sidebar-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}

.sidebar-nav a:hover { background: var(--bg); color: var(--text); }

.sidebar-nav a.active {
  background: var(--accent-tint);
  color: var(--accent-dark);
  font-weight: 600;
}

.sidebar-divider {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 16px 12px 4px;
  font-weight: 600;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 14px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 10px;
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 12px; color: var(--text-muted); }

.logout-link {
  display: block;
  font-size: 13px;
  padding: 6px 8px;
  color: var(--text-muted);
}

/* ---------------- Main content ---------------- */

.main-content {
  flex-grow: 1;
  padding: 32px 40px;
  max-width: 1000px;
}

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

/* ---------------- Cards ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.balance-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-top: 10px;
  overflow: hidden;
}
.balance-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}

/* ---------------- Forms ---------------- */

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  margin-top: 14px;
}
label:first-child { margin-top: 0; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
}

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

.form-row { display: flex; gap: 16px; }
.form-row > div { flex: 1; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-top: 18px;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #93202D; }

.btn-small { padding: 6px 12px; font-size: 13px; margin-top: 0; }

/* ---------------- Tables ---------------- */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }

/* ---------------- Pills / status ---------------- */

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.pill-approved { background: var(--accent-tint); color: var(--accent-dark); }
.pill-pending { background: var(--warn-tint); color: var(--warn); }
.pill-rejected { background: var(--danger-tint); color: var(--danger); }

/* ---------------- Flash messages ---------------- */

.flash {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 20px;
  font-weight: 500;
}
.flash-success { background: var(--accent-tint); color: var(--accent-dark); }
.flash-error { background: var(--danger-tint); color: var(--danger); }

/* ---------------- Login page ---------------- */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

/* ---------------- Hub posts ---------------- */

.hub-post {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.hub-post:last-child { border-bottom: none; }
.hub-post-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.hub-post-content { margin-top: 8px; white-space: pre-wrap; }
.pinned-badge { background: var(--warn-tint); color: var(--warn); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-left: 8px; }

/* ---------------- Team calendar ---------------- */

.cal-legend { display: flex; gap: 16px; margin-bottom: 16px; font-size: 13px; color: var(--text-muted); }
.cal-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }

.cal-entry {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.cal-entry:last-child { border-bottom: none; }

/* ---------------- Empty states ---------------- */

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

/* ---------------- Responsive ---------------- */

@media (max-width: 780px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 16px;
  }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-footer { display: none; }
  .main-content { padding: 20px; }
  .form-row { flex-direction: column; gap: 0; }
}
