:root {
  --bg: #edf3f1;
  --bg-2: #e8edf2;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --ink: #17201f;
  --muted: #6f7975;
  --line: #dbe5e1;
  --primary: #0d5f56;
  --primary-2: #073b36;
  --primary-soft: #dff1ed;
  --nav: #102320;
  --gold: #b9822b;
  --danger: #b7443f;
  --success: #1f8754;
  --shadow: 0 18px 45px rgba(32, 42, 39, .10);
  --shadow-soft: 0 10px 26px rgba(32, 42, 39, .07);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Tahoma, Arial, sans-serif;
  background:
    radial-gradient(circle at top right, rgba(13, 95, 86, .11), transparent 32rem),
    linear-gradient(135deg, var(--bg) 0%, #f8fbfa 58%, var(--bg-2) 100%);
  color: var(--ink);
  letter-spacing: 0;
}

a { color: var(--primary); text-decoration: none; }
button, input, select { font: inherit; letter-spacing: 0; }
button {
  min-height: 42px;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
button:hover { background: var(--primary-2); transform: translateY(-1px); box-shadow: var(--shadow-soft); }
button:active { transform: translateY(0); }

input, select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 10px 12px;
  color: var(--ink);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
input:focus, select:focus {
  border-color: rgba(13, 95, 86, .65);
  box-shadow: 0 0 0 4px rgba(13, 95, 86, .12);
}
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
h1 { margin: 0; font-size: clamp(24px, 2.2vw, 34px); line-height: 1.25; }
p { line-height: 1.75; }

table { width: 100%; border-collapse: separate; border-spacing: 0 8px; min-width: 720px; }
th { color: var(--muted); font-size: 12px; font-weight: 800; padding: 0 14px 6px; text-align: right; }
td {
  background: var(--surface);
  padding: 14px;
  border-top: 1px solid rgba(219, 229, 225, .86);
  border-bottom: 1px solid rgba(219, 229, 225, .86);
  text-align: right;
  vertical-align: middle;
}
td:first-child { border-radius: 0 var(--radius) var(--radius) 0; border-right: 1px solid rgba(219, 229, 225, .86); font-weight: 800; }
td:last-child { border-radius: var(--radius) 0 0 var(--radius); border-left: 1px solid rgba(219, 229, 225, .86); }
tr { transition: transform .16s ease, filter .16s ease; }
tbody tr:hover { transform: translateY(-1px); filter: drop-shadow(0 10px 18px rgba(32, 42, 39, .07)); }

.plain {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}
.plain::before {
  content: "";
  position: fixed;
  inset: 20px;
  border: 1px solid rgba(13, 95, 86, .12);
  border-radius: 22px;
  pointer-events: none;
}
.auth-card, .clock-card {
  width: min(100%, 440px);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(219, 229, 225, .88);
  border-radius: 18px;
  padding: 30px;
  box-shadow: var(--shadow);
  animation: rise .34s ease both;
}
.auth-card h1, .clock-card h1 { text-align: center; margin-bottom: 20px; }
.auth-card h1::before, .clock-card h1::before {
  content: "";
  display: block;
  width: 48px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--gold));
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 286px 1fr;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), transparent 30%),
    var(--nav);
  color: #fff;
  padding: 22px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  box-shadow: -12px 0 32px rgba(16, 35, 32, .08);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255,255,255,.10);
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #21a08e);
  box-shadow: 0 12px 24px rgba(0,0,0,.22);
  font-weight: 900;
}
.brand b { display: block; font-size: 16px; }
.brand small { display: block; margin-top: 4px; color: #a9bbb6; font-size: 11px; }
.sidebar nav { display: grid; align-content: start; gap: 7px; }
.sidebar a, .logout button {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #dce8e4;
  background: transparent;
  border-radius: var(--radius);
  padding: 11px 12px;
  text-align: right;
  font-weight: 800;
}
.sidebar a span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #b8cec7;
  background: rgba(255,255,255,.06);
}
.sidebar a:hover, .logout button:hover { background: rgba(255,255,255,.08); transform: translateX(-2px); box-shadow: none; }
.sidebar a.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(33,160,142,.26), rgba(255,255,255,.08));
  box-shadow: inset -3px 0 0 #21a08e;
}
.sidebar a.active span { background: #21a08e; color: #fff; }
.logout { margin: 0; }
.logout button { width: 100%; justify-content: center; color: #ffd9d6; }

.content {
  min-width: 0;
  padding: 24px clamp(16px, 3vw, 36px) 42px;
  overflow-x: hidden;
}
.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
  padding: 14px 16px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(219, 229, 225, .78);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}
.topbar > div:nth-child(2) { display: grid; gap: 4px; }
.topbar strong { font-size: 18px; }
.eyebrow { color: var(--muted); font-size: 12px; font-weight: 800; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.top-actions span {
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.user-menu { position: relative; }
.user-menu summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--nav);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu[open] summary { background: var(--primary); }
.user-menu > div {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 178px;
  z-index: 10;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
  animation: rise .18s ease both;
}
.user-menu a, .user-menu button {
  width: 100%;
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}
.user-menu button { color: var(--danger); }
.user-menu a:hover, .user-menu button:hover { background: var(--surface-soft); transform: none; box-shadow: none; }
.user-menu form { margin: 0; }
.menu-toggle { display: none; width: 44px; padding: 0; background: var(--nav); }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 0 0 18px;
}
.page-head p { margin: 0; color: var(--muted); font-size: 14px; }

.cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
}
.stat, .panel {
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(219, 229, 225, .88);
  border-radius: 14px;
  box-shadow: var(--shadow-soft);
}
.stat {
  position: relative;
  min-height: 142px;
  padding: 18px;
  overflow: hidden;
  animation: rise .28s ease both;
}
.stat::after {
  content: "";
  position: absolute;
  width: 98px;
  height: 98px;
  left: -34px;
  bottom: -42px;
  border-radius: 50%;
  background: rgba(13, 95, 86, .08);
}
.stat i {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-style: normal;
  font-weight: 900;
  margin-bottom: 16px;
}
.stat span { display: block; color: var(--muted); font-size: 13px; font-weight: 800; margin-bottom: 8px; }
.stat b { position: relative; z-index: 1; font-size: clamp(24px, 2.2vw, 32px); }
.stat.warn i { background: #fff1d9; color: var(--gold); }
.stat.warn b { color: var(--gold); }
.stat.success i { background: #ddf4e8; color: var(--success); }
.stat.success b { color: var(--success); }

.panel {
  padding: 18px;
  margin-bottom: 18px;
  overflow-x: auto;
  animation: rise .28s ease both;
}
.panel::-webkit-scrollbar { height: 8px; }
.panel::-webkit-scrollbar-thumb { background: #b9c8c3; border-radius: 999px; }

.form-grid { display: grid; gap: 15px; }
.employee-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
}
.form-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) 150px 140px minmax(160px, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.employee-form .days { grid-column: 1 / -1; }
fieldset {
  border: 1px dashed #b9c8c3;
  border-radius: 12px;
  display: flex;
  gap: 13px;
  flex-wrap: wrap;
  padding: 14px;
  background: var(--surface-soft);
}
legend { padding: 0 8px; color: var(--muted); font-size: 13px; font-weight: 900; }
.inline, fieldset label { display: flex; align-items: center; gap: 7px; }
.inline input, fieldset input { width: auto; min-height: auto; accent-color: var(--primary); }

.actions { display: flex; align-items: center; gap: 8px; }
.actions form { margin: 0; }
.actions a, .actions button {
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}
.actions button { background: #fff0ed; color: var(--danger); box-shadow: none; }

.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  max-width: 380px;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(219, 229, 225, .82);
}
.filters.wide { max-width: 640px; }

.toast {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 50;
  min-width: 260px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 14px 16px;
  border-radius: 14px;
  background: #13231f;
  color: #fff;
  box-shadow: 0 18px 40px rgba(0,0,0,.18);
  animation: toast-in .24s ease both;
}
.toast::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 8px;
  border-radius: 50%;
  background: #21a08e;
}
.toast.danger { background: var(--danger); }
.toast.warning { background: var(--gold); }

.clock-card {
  width: min(100%, 500px);
  background:
    linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.82)),
    radial-gradient(circle at top, rgba(13,95,86,.16), transparent 18rem);
}
.clock-status {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 22px 0;
}
.clock-status span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.clock-status b {
  display: block;
  margin-top: 7px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  min-height: 52px;
  direction: ltr;
  text-align: center;
}
.clock-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.clock-form button {
  min-height: 82px;
  font-size: 18px;
  border-radius: 16px;
}
.clock-in { background: linear-gradient(135deg, var(--primary), #18a08d); }
.clock-out { background: linear-gradient(135deg, #263b35, #111d1a); }
.logout.top { text-align: left; margin: 0 0 8px; }
.logout.top button { width: auto; min-height: 36px; color: var(--muted); background: #f3f0e9; }
.danger-text { color: var(--danger); direction: ltr; text-align: left; }

.scrim { display: none; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1120px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  .employee-form { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}

@media (max-width: 860px) {
  .app-shell { display: block; }
  .sidebar {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(82vw, 310px);
    z-index: 30;
    transform: translateX(105%);
    transition: transform .24s ease;
  }
  body.menu-open .sidebar { transform: translateX(0); }
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(16,35,32,.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  body.menu-open .scrim { opacity: 1; pointer-events: auto; }
  .menu-toggle { display: inline-grid; place-items: center; }
  .content { padding: 14px 14px 28px; }
  .topbar { position: sticky; top: 10px; z-index: 20; }
  .top-actions { display: none; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .form-row, .employee-form { grid-template-columns: 1fr; }
  .filters, .filters.wide { max-width: none; }
  .page-head { display: block; }
  .page-head p { margin-top: 6px; }
}

@media (max-width: 560px) {
  .plain { padding: 14px; }
  .auth-card, .clock-card { padding: 22px; border-radius: 16px; }
  .cards { grid-template-columns: 1fr; }
  .clock-form, .clock-status { grid-template-columns: 1fr; }
  .filters { display: grid; }
  table { min-width: 640px; }
}
