:root {
  color-scheme: light;
  --ink: #151515;
  --muted: #676767;
  --line: #dedbd6;
  --panel: #ffffff;
  --soft: #f6f4ef;
  --green: #17a56b;
  --teal: #0f8fa3;
  --red: #c2413b;
  --amber: #b7791f;
  --shadow: 0 18px 60px rgba(21, 21, 21, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--soft);
  color: var(--ink);
  font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 440px) 1fr;
}

.brand-pane {
  background: #050505;
  color: white;
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand-pane img {
  width: min(280px, 80%);
  filter: invert(1) brightness(2.3);
}

.brand-pane h1 {
  font-size: clamp(38px, 5vw, 76px);
  line-height: 0.96;
  margin: 48px 0 16px;
  letter-spacing: 0;
}

.brand-pane p {
  max-width: 420px;
  color: #d7d7d7;
  margin: 0;
}

.login-card {
  align-self: center;
  justify-self: center;
  width: min(460px, calc(100% - 36px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-card h2,
.panel h2,
.panel h3 {
  margin: 0;
}

.hint {
  color: var(--muted);
  margin: 8px 0 22px;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #111;
  color: white;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
}

.sidebar-head {
  display: grid;
  gap: 18px;
}

.sidebar-head img {
  width: 160px;
  filter: invert(1) brightness(2.5);
}

.sidebar-menu {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 22px;
}

.menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #2b2b2b;
  place-items: center;
  gap: 5px;
  padding: 10px;
}

.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: #fff;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  min-height: 42px;
  border-radius: 8px;
  text-align: left;
  padding: 0 14px;
  color: #e9e9e9;
  background: transparent;
}

.nav button.active,
.nav button:hover {
  background: #2b2b2b;
  color: white;
}

.user-box {
  margin-top: auto;
  border-top: 1px solid #333;
  padding-top: 18px;
  color: #d4d4d4;
}

.content {
  padding: 28px;
  max-width: 1480px;
  width: 100%;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar h1 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 30px;
  margin: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 8px 24px rgba(21, 21, 21, 0.05);
  min-width: 0;
}

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-7 {
  grid-column: span 7;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: span 12;
}

.metric {
  display: grid;
  gap: 6px;
}

.metric strong {
  font-size: 28px;
}

.status-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  align-items: stretch;
  gap: 24px;
  border-left: 8px solid var(--red);
  padding: 0;
  overflow: hidden;
}

.status-card.is-present {
  border-left-color: var(--green);
}

.status-content {
  padding: 22px 20px;
}

.attendance-action-panel {
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 22px;
  background: #faf7f2;
  border-left: 1px solid var(--line);
}

.status-card.is-present .attendance-action-panel {
  background: #fff5f4;
}

.action-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-card h2 {
  margin: 0;
}

.dashboard-clock-card.is-present .attendance-action-panel {
  background: #f2fbf7;
}

.attendance-cta {
  min-height: 122px;
  width: 100%;
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 24px;
  line-height: 1.1;
  box-shadow: 0 20px 38px rgba(21, 21, 21, 0.24);
}

.time-toolbar,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.panel-head {
  margin-bottom: 14px;
}

.panel-head h2 {
  margin-bottom: 4px;
}

.range-form {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.summary-strip {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 14px;
}

.summary-strip span {
  display: grid;
  min-width: 150px;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf9f6;
}

.summary-strip strong {
  font-size: 20px;
}

.summary-strip small {
  color: var(--muted);
}

.bar-meter {
  width: 130px;
  max-width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #ece9e2;
  overflow: hidden;
  display: inline-flex;
  vertical-align: middle;
  margin-right: 8px;
}

.bar-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.tabbar {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f2ec;
}

.tabbar button {
  min-height: 34px;
  border-radius: 6px;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.tabbar button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 5px rgba(15, 23, 42, 0.08);
}

.status-metrics {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 14px 0 10px;
}

.status-metrics span {
  display: grid;
  gap: 2px;
}

.status-metrics strong {
  font-size: 22px;
}

.status-metrics small {
  color: var(--muted);
}

.text-link {
  background: transparent;
  color: var(--teal);
  font-weight: 700;
  padding: 0;
  min-height: auto;
  white-space: nowrap;
}

.quiet-panel {
  box-shadow: none;
}

.needs-project {
  background: #fffaf0;
}

.needs-project td:first-child {
  border-left: 4px solid var(--amber);
}

.vacation-row {
  background: #f2f8f6;
}

.vacation-row td:first-child {
  border-left: 4px solid var(--teal);
}

.vacation-pill {
  background: #e4f4f0;
  color: var(--teal);
}

.pill.muted {
  background: #ece9e2;
  color: var(--muted);
}

.compact-select {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.compact-select span {
  color: var(--muted);
  font-size: 13px;
}

.project-booking {
  display: grid;
  gap: 14px;
}

.form-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.form-head .hint {
  margin-bottom: 0;
}

.label-action {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: fit-content;
}

.field-icon-btn {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: #ece9e2;
  color: var(--teal);
  font-weight: 800;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}

.field-icon-btn:hover {
  background: #dfeeea;
}

.compact-form {
  grid-template-columns: minmax(220px, 1.2fr) minmax(160px, 0.6fr) minmax(260px, 1.4fr);
}

.project-time-form {
  grid-template-columns: minmax(240px, 1.2fr) repeat(3, minmax(140px, 0.7fr));
}

.disabled-panel {
  opacity: 0.64;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.weekly-targets {
  display: grid;
  grid-template-columns: repeat(7, minmax(48px, 1fr));
  gap: 8px;
  grid-column: 1 / -1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.weekly-targets legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
}

.weekly-targets label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.weekly-targets span {
  font-weight: 700;
  color: var(--ink);
}

.weekly-targets input {
  min-height: 38px;
  padding: 7px 8px;
}

label {
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
}

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

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.btn {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--ink);
  color: white;
  font-weight: 700;
  white-space: nowrap;
  overflow-wrap: normal;
}

.btn.secondary {
  background: #ece9e2;
  color: var(--ink);
}

.btn.green {
  background: var(--green);
}

.btn.red {
  background: var(--red);
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #ece9e2;
  color: var(--ink);
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
  width: 100%;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow-wrap: normal;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  background: #edf7f2;
  color: #0f6b48;
  white-space: nowrap;
}

.project-pill {
  max-width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.date-cell {
  white-space: nowrap;
  overflow-wrap: normal;
}

.clock-box {
  display: flex;
  align-items: center;
  min-height: 34px;
  margin-top: 14px;
}

.pill.pending {
  background: #fff4d8;
  color: var(--amber);
}

.pill.rejected {
  background: #fde8e7;
  color: var(--red);
}

.notice {
  border-left: 4px solid var(--teal);
  background: #edf9fb;
  padding: 12px;
  border-radius: 8px;
  color: #14515b;
}

.error {
  color: var(--red);
  min-height: 22px;
}

.hidden {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(17, 17, 17, 0.52);
}

.modal {
  width: min(640px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 0;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

@media (max-width: 900px) {
  .login-shell,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .brand-pane {
    min-height: 280px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    height: auto;
    max-height: none;
    z-index: 3;
    padding: 12px 18px;
    overflow: visible;
  }

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

  .sidebar-head img {
    width: 128px;
  }

  .menu-toggle {
    display: grid;
  }

  .sidebar-menu {
    display: none;
    padding-top: 16px;
  }

  .sidebar.is-open .sidebar-menu {
    display: flex;
  }

  .nav {
    grid-template-columns: 1fr;
  }

  .user-box {
    margin-top: 0;
  }

  .span-4,
  .span-5,
  .span-7,
  .span-8,
  .span-12 {
    grid-column: span 12;
  }

  .content {
    padding: 18px;
  }

  .status-card {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .attendance-action-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .attendance-cta {
    width: 100%;
  }

  .compact-form {
    grid-template-columns: 1fr;
  }

  .form-head {
    align-items: stretch;
    flex-direction: column;
  }

  .form-head .btn {
    width: 100%;
  }

  .responsive-table {
    min-width: 0;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 12px;
    background: #fff;
  }

  .responsive-table td {
    display: grid;
    grid-template-columns: minmax(110px, 38%) 1fr;
    gap: 12px;
    align-items: center;
    border-bottom: 0;
    padding: 8px 4px;
  }

  .responsive-table td.date-cell {
    display: grid;
  }

  .responsive-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
  }
}

@media (max-width: 560px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .weekly-targets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .btn {
    width: 100%;
  }

  .responsive-table td {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .responsive-table .btn {
    width: 100%;
  }

  .project-pill {
    max-width: min(220px, 100%);
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}
