:root {
  --bg: #edf1f4;
  --nav: #41465d;
  --card: #ffffff;
  --text: #1e2534;
  --muted: #6d7688;
  --accent: #d63a3a;
  --accent-2: #ef8f72;
  --green: #00a886;
  --orange: #ff9d6a;
  --blue: #1f98d7;
  --border: #dce2e8;
  --radius: 12px;
  --shadow: 0 8px 20px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  height: 70px;
  background: linear-gradient(110deg, #3e4257 0%, #4e5572 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
}

.topbar .brand {
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.2px;
}

.topbar .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
}

.topbar .user-info .btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid #d8deea;
  background: #ffffff;
  color: #2a3448;
  font-weight: 700;
}

.topbar .user-info .btn:hover {
  background: #f4f7fc;
}

.topbar .user-info .btn.active-lang {
  background: linear-gradient(90deg, #d63a3a, #e56a56);
  color: #fff;
  border-color: #d54b4b;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(145deg, #f2c1b5, #e95e4f);
}

.layout {
  max-width: 1400px;
  margin: 16px auto;
  padding: 0 12px 40px;
}

.nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.nav-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 16px;
  background: #e8edf3;
  border: 1px solid var(--border);
  color: #4b5568;
  font-size: 15px;
  font-weight: 600;
  border-radius: 10px;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease;
}

.nav-tabs a.active {
  background: linear-gradient(90deg, #d73f3f, #e06a59);
  color: #fff;
  border-color: #cd4d4d;
}

.nav-tabs a:hover {
  transform: translateY(-1px);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 16px;
}

.metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric .title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}

.metric .value {
  font-size: 36px;
  font-weight: 700;
}

.metric.green .value {
  color: var(--green);
}

.metric.orange .value {
  color: var(--orange);
}

.metric.blue .value {
  color: var(--blue);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.toolbar input,
.toolbar select,
.toolbar button,
.toolbar textarea {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  background: #fff;
  color: var(--text);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(90deg, #d63a3a, #e56a56);
  color: #fff;
  border-color: #d64a4a;
}

.btn-success {
  background: linear-gradient(90deg, #00aa88, #00c09a);
  color: #fff;
  border-color: #00a684;
}

.btn-ghost {
  background: #f9fafb;
}

.table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1000px;
}

thead th {
  text-align: left;
  background: #f7f8fb;
  border-bottom: 1px solid var(--border);
  color: #2c3448;
  padding: 12px 10px;
  font-size: 15px;
}

tbody td {
  border-top: 1px solid #eef2f7;
  padding: 10px;
  font-size: 14px;
}

tbody tr:nth-child(odd) {
  background: #f3f2ff;
}

.forms-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.forms-grid input,
.forms-grid select {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}

.forms-grid .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.forms-grid .field label {
  font-size: 12px;
  font-weight: 700;
  color: #4b5568;
  padding-left: 2px;
}

.flash-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.flash {
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
}

.flash.success {
  background: #dcfce7;
  color: #0f5132;
}

.flash.error {
  background: #fee2e2;
  color: #8f1d1d;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(232, 99, 79, 0.25), transparent 36%),
    radial-gradient(circle at 85% 80%, rgba(59, 83, 141, 0.2), transparent 40%),
    #ecf1f7;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 430px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 26px;
}

.auth-card h1 {
  margin: 0 0 6px;
}

.auth-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.auth-card label {
  display: block;
  margin: 8px 0 6px;
  font-weight: 600;
}

.auth-card input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.auth-card button {
  margin-top: 14px;
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  border: 0;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(90deg, #d73f3f, #e56d58);
  cursor: pointer;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.worker-body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(224, 91, 86, 0.2), transparent 32%),
    radial-gradient(circle at 88% 88%, rgba(65, 86, 145, 0.22), transparent 30%),
    linear-gradient(160deg, #141d37 0%, #252f56 52%, #18213f 100%);
  color: #fff;
}

.worker-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 14px;
}

.worker-card {
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 18px;
  box-shadow: 0 20px 30px rgba(0, 0, 0, 0.35);
  padding: 20px;
  backdrop-filter: blur(6px);
}

.worker-head h1 {
  margin: 0 0 4px;
  font-size: 30px;
}

#worker-clock {
  margin: 0;
  color: #cfdaff;
}

.worker-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.worker-action {
  border: 0;
  border-radius: 10px;
  min-height: 48px;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.worker-action.active {
  outline: 2px solid #fff;
}

.action-checkin { background: linear-gradient(135deg, #0aa382, #2bcf9a); }
.action-checkout { background: linear-gradient(135deg, #d84f4f, #ee6a6a); }
.action-breakstart { background: linear-gradient(135deg, #ea9a4b, #f3bc51); }
.action-breakend { background: linear-gradient(135deg, #6078df, #8798f5); }
.action-fieldstart { background: linear-gradient(135deg, #0591c7, #34b7eb); }
.action-fieldend { background: linear-gradient(135deg, #8f59dd, #b27ced); }

.worker-form {
  margin-top: 14px;
}

.worker-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.worker-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
}

.worker-form button {
  margin-top: 10px;
  width: 100%;
  border: 0;
  min-height: 46px;
  border-radius: 10px;
  background: linear-gradient(90deg, #d73f3f, #ef7664);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.worker-message {
  margin-top: 10px;
  min-height: 24px;
  font-weight: 700;
}

.worker-message.ok {
  color: #79ffc2;
}

.worker-message.err {
  color: #ffb0b0;
}

.worker-footer {
  margin-top: 10px;
  color: #d6deff;
  word-break: break-all;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
}

.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fff7ed; color: #c2410c; }

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

@media (max-width: 1100px) {
  .cards {
    grid-template-columns: 1fr;
  }
  .forms-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 720px) {
  .forms-grid {
    grid-template-columns: 1fr;
  }
  .worker-actions {
    grid-template-columns: 1fr;
  }
  .topbar {
    height: auto;
    padding: 10px 12px;
    gap: 10px;
    flex-direction: column;
    align-items: flex-start;
  }
}
