:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1c2230;
  --muted: #6b7280;
  --border: #e3e6ea;
  --primary: #1f6f4f;
  --primary-dark: #16543b;
  --danger: #b3261e;
  --warning: #a86400;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { font-weight: 700; font-size: 1.1rem; }
.brand span { color: var(--primary); }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-left: auto;
}

.nav a {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
}

.nav a:hover, .nav a.active { background: var(--bg); color: var(--primary-dark); font-weight: 600; }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

h1 { font-size: 1.4rem; margin: 0.5rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}
.flash-success { background: #e4f5ea; color: var(--primary-dark); }
.flash-error { background: #fbe7e6; color: var(--danger); }

.btn {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius);
  border: none;
  background: var(--primary);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); }
.btn-secondary { background: var(--muted); }
.btn-block { display: block; width: 100%; }
.btn-lg { font-size: 1.3rem; padding: 1.4rem; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; }

.clock-status { text-align: center; padding: 1.5rem 1rem; }
.clock-status .big-time { font-size: 2rem; font-weight: 700; margin: 0.5rem 0; }
.clock-status .state { color: var(--muted); margin-bottom: 1rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}
.stat-box { background: var(--bg); border-radius: var(--radius); padding: 0.9rem; text-align: center; }
.stat-box .value { font-size: 1.4rem; font-weight: 700; }
.stat-box .label { color: var(--muted); font-size: 0.85rem; }

form label { display: block; margin: 0.6rem 0 0.25rem; font-weight: 600; font-size: 0.9rem; }
form input, form select, form textarea {
  width: 100%;
  padding: 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: white;
  color: var(--text);
}
form .row { display: flex; gap: 1rem; flex-wrap: wrap; }
form .row > div { flex: 1; min-width: 140px; }
form .actions { margin-top: 1rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.55rem 0.5rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; }
.table-wrap { overflow-x: auto; }
tfoot th { border-top: 2px solid var(--border); border-bottom: none; color: var(--text); }
.wh-today { background: #eef7f1; }

.badge { padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.badge-pending { background: #fdf1de; color: var(--warning); }
.badge-approved { background: #e4f5ea; color: var(--primary-dark); }
.badge-denied { background: #fbe7e6; color: var(--danger); }

.muted { color: var(--muted); }
.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain li { padding: 0.6rem 0; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: none; }

.inline-form { display: inline; }

.section-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; }

.login-wrap {
  max-width: 380px;
  margin: 3rem auto;
}

@media (max-width: 600px) {
  .nav { gap: 0; }
  .nav a { padding: 0.45rem 0.5rem; font-size: 0.85rem; }
  .container { padding: 0.75rem; }
}

.cal-wrap { overflow-x: auto; }
.cal-grid {
  display: grid;
  min-width: 820px;
}
.cal-corner { border-bottom: 1px solid var(--border); }
.cal-day-head {
  text-align: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
.cal-day-head.cal-today { background: #eef7f1; }
.cal-day-name { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; }
.cal-day-num { font-size: 1.05rem; font-weight: 700; }

.cal-hours { position: relative; }
.cal-hour-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
  padding-right: 0.4rem;
  transform: translateY(-0.6em);
}

.cal-day-col {
  position: relative;
  border-left: 1px solid var(--border);
}
.cal-day-col.cal-today { background: #fbfdfc; }
.cal-hour-line { border-bottom: 1px solid var(--border); box-sizing: border-box; }

.cal-event {
  position: absolute;
  border-radius: 6px;
  color: white;
  font-size: 0.72rem;
  line-height: 1.25;
  padding: 2px 5px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.cal-event-open { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,0.25) 0 6px, transparent 6px 12px); }

.docs-layout { display: flex; gap: 1rem; align-items: flex-start; }
.docs-sidebar { width: 240px; flex-shrink: 0; padding: 0.5rem; }
.docs-sidebar .list-plain li { padding: 0; border-bottom: none; }
.docs-employee-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.92rem;
}
.docs-employee-link:hover { background: var(--bg); }
.docs-employee-link.active { background: var(--primary); color: white; }
.docs-employee-link.active .badge-approved,
.docs-employee-link.active .badge-pending { background: rgba(255,255,255,0.25); color: white; }
.docs-main { flex: 1; min-width: 0; }

@media (max-width: 700px) {
  .docs-layout { flex-direction: column; }
  .docs-sidebar { width: 100%; }
}
