:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #17211b;
  --muted: #68736c;
  --line: #d9dfd8;
  --accent: #256f5c;
  --accent-strong: #164d3e;
  --warn: #a34720;
  --good: #27633d;
  --shadow: 0 16px 38px rgba(23, 33, 27, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 0.72rem 1rem;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

.secondary:hover {
  background: #dfe6df;
}

.danger-button {
  background: #ffe8e5;
  color: #b42b1f;
}

.danger-button:hover {
  background: #ffd6d0;
}

.approve-button {
  background: #e6f6eb;
  color: #207341;
}

.approve-button:hover {
  background: #d5efde;
}

.nav-link {
  background: #e9eee9;
  border-radius: 8px;
  color: var(--ink);
  display: inline-flex;
  font-weight: 800;
  padding: 0.72rem 1rem;
  text-decoration: none;
}

.nav-link:hover {
  background: #dfe6df;
}

.header-actions {
  align-items: center;
  display: flex;
  gap: 0.8rem;
}

.profile-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
}

.profile-card {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 0.65rem;
  padding: 0.45rem;
}

.profile-card span {
  color: var(--muted);
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
}

.profile-card strong {
  display: block;
  font-size: 0.9rem;
  line-height: 1.1;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-avatar {
  align-items: center;
  aspect-ratio: 1;
  background: #e3eee8;
  border-radius: 999px;
  color: var(--accent-strong);
  display: grid;
  font-size: 0.78rem;
  font-weight: 900;
  justify-items: center;
  line-height: 1;
  place-items: center;
  text-align: center;
  width: 2.2rem;
}

.compact-button {
  padding: 0.5rem 0.7rem;
  white-space: nowrap;
}

.icon-action {
  align-items: center;
  display: inline-grid;
  font-size: 1rem;
  height: 2.25rem;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 2.25rem;
}

.app-header {
  align-items: center;
  background: var(--accent);
  border-bottom: 1px solid var(--accent-strong);
  display: flex;
  gap: 1.5rem;
  justify-content: space-between;
  padding: 1.15rem clamp(1rem, 4vw, 3rem);
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 0.9rem;
}

.logo-placeholder {
  align-items: center;
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 8px;
  color: #fff;
  display: grid;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  place-items: center;
  width: 3rem;
}

.app-header h1 {
  color: #fff;
  font-size: clamp(1.5rem, 2.4vw, 2.1rem);
}

.app-header p {
  color: rgba(255, 255, 255, 0.78);
  margin: 0.25rem 0 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 0.3rem;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1.08;
  margin-bottom: 0;
  max-width: 680px;
}

h2 {
  font-size: 1.45rem;
  margin-bottom: 0.3rem;
}

h3 {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

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

main {
  padding: 1.5rem clamp(1rem, 4vw, 3rem) 3rem;
}

body.sso-locked .app-header,
body.sso-locked .toolbar {
  display: none;
}

body.sso-locked main {
  display: grid;
  min-height: 100vh;
  padding: 1rem;
  place-items: center;
}

.role-switch {
  background: #eef2ed;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 230px;
  padding: 0.25rem;
}

.role-switch button {
  background: transparent;
  color: var(--ink);
  padding: 0.65rem 0.9rem;
}

.role-switch button.active {
  background: var(--panel);
  box-shadow: 0 4px 12px rgba(23, 33, 27, 0.1);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.toolbar,
.panel-header,
.actions {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.toolbar {
  margin-bottom: 1rem;
}

.field-row,
.assignment-form {
  display: grid;
  gap: 0.8rem;
}

.field-row.compact {
  grid-template-columns: minmax(160px, 220px);
}

.identity-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0.28rem;
  min-height: 2.55rem;
  padding: 0.58rem 0.68rem;
}

.identity-card span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

label,
.filter-label {
  color: var(--muted);
  display: grid;
  font-size: 0.83rem;
  font-weight: 700;
  gap: 0.35rem;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 2.55rem;
  padding: 0.58rem 0.68rem;
}

textarea {
  min-height: 4.6rem;
  resize: vertical;
}

.summary-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: minmax(160px, 220px);
  margin-bottom: 1rem;
}

.summary-card,
.panel,
.review-card,
.assignment-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-card {
  padding: 1rem;
}

.summary-card strong {
  display: block;
  font-size: 1.55rem;
  margin-top: 0.25rem;
}

.panel {
  box-shadow: var(--shadow);
  padding: 1rem;
}

.actions {
  margin-top: 1rem;
}

#employeeStatus {
  margin-bottom: 0;
}

#employeeStatus:empty {
  display: none;
}

.timesheet-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.table-wrap {
  margin-top: 1rem;
  overflow-x: hidden;
}

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

.timesheet-table {
  background: #fff;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.42rem 0.28rem;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #e3eee8;
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.timesheet-table tbody tr:nth-child(even) {
  background: #f8fafb;
}

.timesheet-table tbody tr:hover {
  background: #eef7fb;
}

.timesheet-table th:nth-child(1),
.timesheet-table td:nth-child(1) {
  width: 3%;
}

.timesheet-table th:nth-child(2),
.timesheet-table td:nth-child(2) {
  width: 14%;
}

.timesheet-table th:nth-child(3),
.timesheet-table td:nth-child(3) {
  width: 17%;
}

.timesheet-table th:nth-child(n + 4):nth-child(-n + 10),
.timesheet-table td:nth-child(n + 4):nth-child(-n + 10) {
  text-align: center;
  width: 7%;
}

.timesheet-table th:nth-child(11),
.timesheet-table td:nth-child(11) {
  text-align: center;
  width: 10%;
}

.timesheet-table th:nth-child(12),
.timesheet-table td:nth-child(12) {
  text-align: center;
  width: 7%;
}

.select-cell {
  text-align: center;
  width: 3%;
}

.select-cell input {
  accent-color: #28a8c7;
  min-height: auto;
}

.project-cell {
  width: 14%;
}

.task-cell {
  width: 17%;
}

td input[type="number"] {
  min-width: 0;
  text-align: center;
  width: 100%;
}

td select {
  min-width: 0;
  width: 100%;
}

td textarea {
  min-height: 2.4rem;
  min-width: 0;
  width: 100%;
}

.timesheet-table input[type="number"],
.timesheet-table select,
.timesheet-table textarea {
  background: transparent;
  border-color: transparent;
  border-radius: 6px;
  min-height: 2rem;
  padding: 0.3rem 0.28rem;
}

.timesheet-table input[type="number"]:focus,
.timesheet-table select:focus,
.timesheet-table textarea:focus {
  background: #fff;
  border-color: #28a8c7;
  outline: 2px solid rgba(40, 168, 199, 0.14);
}

.timesheet-table input:disabled,
.timesheet-table select:disabled,
.timesheet-table textarea:disabled {
  color: #59656e;
  cursor: not-allowed;
  opacity: 1;
}

.hour-cell,
.total-cell {
  text-align: center;
  white-space: nowrap;
  width: 6.5%;
}

.total-cell {
  color: #53606a;
  font-weight: 800;
}

.icon-button {
  background: transparent;
  color: var(--warn);
  padding: 0.55rem;
}

.status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.28rem 0.62rem;
  text-transform: capitalize;
}

.status-draft {
  background: #edf0ed;
  color: #4a554d;
}

.status-submitted {
  background: #fff4cf;
  color: #805d12;
}

.status-approved {
  background: #e8f4ec;
  color: var(--good);
}

.status-rejected {
  background: #fff0e8;
  color: var(--warn);
}

.approval-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1;
  padding: 0.32rem 0.46rem;
  white-space: nowrap;
}

.approval-stack {
  align-items: center;
  display: grid;
  gap: 0.25rem;
  justify-items: center;
}

.note-view-button {
  background: transparent;
  color: var(--accent);
  font-size: 0.72rem;
  padding: 0.1rem 0.25rem;
  text-decoration: underline;
}

.note-view-button:hover {
  background: transparent;
  color: var(--accent-strong);
}

.approval-draft {
  background: #edf0ed;
  color: #4a554d;
}

.approval-pending {
  background: #e3f0ff;
  color: #1d63ad;
}

.approval-rejected {
  background: #ffe8e5;
  color: #b42b1f;
}

.approval-approved {
  background: #e6f6eb;
  color: #207341;
}

.manager-layout {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(280px, 380px) 1fr;
}

.manager-workspace {
  align-items: start;
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(190px, 230px) minmax(0, 1fr);
}

.manager-tab-stack {
  min-width: 0;
}

.tab-bar {
  background: #eef2ed;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
}

.vertical-tabs {
  align-self: start;
  display: grid;
  gap: 0.25rem;
  margin-bottom: 0;
  position: sticky;
  top: 1rem;
}

.tab-bar button {
  background: transparent;
  color: var(--ink);
  justify-content: flex-start;
  text-align: left;
  width: 100%;
}

.tab-bar button.active {
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(23, 33, 27, 0.12);
  color: #fff;
}

.manager-tab-panel {
  display: none;
}

.manager-tab-panel.active {
  display: block;
}

.effort-list {
  margin-top: 1rem;
}

.effort-table {
  min-width: 900px;
}

.access-panel {
  align-items: center;
  display: grid;
  gap: 0.7rem;
  justify-items: center;
  margin: 0 auto;
  max-width: 460px;
  padding: clamp(1.1rem, 3vw, 1.6rem);
  text-align: center;
  width: 100%;
}

.access-panel h3 {
  font-size: 1.35rem;
  margin-bottom: 0.35rem;
}

.access-panel p {
  margin-bottom: 0;
}

.access-panel p:empty {
  display: none;
}

#googleSignInButton {
  display: flex;
  justify-content: center;
  min-height: 44px;
  width: 100%;
}

.access-form {
  display: grid;
  gap: 0.8rem;
}

.assignment-form {
  grid-template-columns: 1fr;
  margin: 1rem 0;
}

.assignment-list,
.project-list,
.review-list {
  display: grid;
  gap: 0.75rem;
}

.assignment-item,
.project-item,
.review-card {
  padding: 0.85rem;
}

.assignment-item,
.project-item {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.project-form {
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
  padding-bottom: 1rem;
}

.manager-form {
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding-top: 1rem;
}

.project-list {
  margin-bottom: 1rem;
}

.project-section {
  display: grid;
  gap: 0.55rem;
  margin-top: 1rem;
}

.project-section + .project-section {
  border-top: 1px solid var(--line);
  margin-top: 1.3rem;
  padding-top: 1rem;
}

.project-section-header,
.project-editor-header,
.project-table-actions {
  align-items: center;
  display: flex;
  gap: 0.55rem;
  justify-content: space-between;
}

.project-section-header h4,
.project-editor-header h4 {
  margin: 0;
}

.project-table-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.project-table {
  table-layout: auto;
}

.manager-assignment-table {
  table-layout: fixed;
}

.review-table {
  table-layout: fixed;
}

.project-table th:nth-child(1),
.project-table td:nth-child(1) {
  width: 4rem;
}

.project-table th:nth-child(2),
.project-table td:nth-child(2) {
  width: auto;
}

.project-table th:nth-child(3),
.project-table td:nth-child(3),
.project-table th:nth-child(4),
.project-table td:nth-child(4) {
  text-align: left;
  white-space: nowrap;
  width: 1%;
}

.project-table th:nth-child(5),
.project-table td:nth-child(5),
.project-table th:nth-child(6),
.project-table td:nth-child(6) {
  text-align: left;
  white-space: nowrap;
  width: 1%;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.project-table .project-tags {
  align-items: start;
  display: grid;
  gap: 0.25rem;
  margin-top: 0;
}

.project-table .tag {
  white-space: nowrap;
  width: fit-content;
}

.project-date {
  color: #53606a;
  font-weight: 800;
  white-space: nowrap;
}

.project-date.past-date {
  color: #b42b1f;
}

.project-editor-row {
  background: #f8faf8;
}

.project-editor-row td {
  vertical-align: top;
}

.project-editor-row input[type="text"] {
  min-width: 0;
  width: 100%;
}

.project-editor-row input[type="date"] {
  min-width: 8.5rem;
  width: 100%;
}

.inline-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.project-checkbox-list {
  display: grid;
  gap: 0.35rem;
  max-height: 13rem;
  overflow-y: auto;
}

.project-checkbox-option {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  font-size: 0.8rem;
  gap: 0.4rem;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 0.4rem 0.5rem;
}

.project-checkbox-option input {
  min-height: auto;
}

.compact-empty {
  padding: 0.65rem;
}

.manager-assignment-table th:nth-child(1),
.manager-assignment-table td:nth-child(1) {
  width: 2.75rem;
}

.manager-assignment-table th:nth-child(2),
.manager-assignment-table td:nth-child(2),
.manager-assignment-table th:nth-child(3),
.manager-assignment-table td:nth-child(3),
.manager-assignment-table th:nth-child(4),
.manager-assignment-table td:nth-child(4) {
  width: calc((100% - 2.75rem) / 3);
}

.manager-assignment-table select,
.manager-assignment-table textarea {
  width: 100%;
}

.manager-assignment-table textarea {
  min-height: 4.4rem;
}

.dialog-overlay {
  align-items: center;
  background: rgba(23, 33, 27, 0.38);
  display: grid;
  inset: 0;
  padding: 1rem;
  position: fixed;
  z-index: 20;
}

.review-table th:nth-child(1),
.review-table td:nth-child(1) {
  text-align: center;
  width: 3%;
}

.review-table th:nth-child(2),
.review-table td:nth-child(2) {
  width: 12%;
}

.review-table th:nth-child(3),
.review-table td:nth-child(3),
.review-table th:nth-child(4),
.review-table td:nth-child(4),
.review-table th:nth-child(6),
.review-table td:nth-child(6) {
  white-space: nowrap;
  width: 11%;
}

.review-table th:nth-child(5),
.review-table td:nth-child(5) {
  text-align: center;
  width: 8%;
}

.review-table th:nth-child(7),
.review-table td:nth-child(7) {
  width: auto;
}

.manager-note-input {
  min-height: 2.6rem;
  width: 100%;
}

.effort-user-list {
  display: grid;
  gap: 0.25rem;
}

.effort-user-line {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  max-width: 260px;
}

.effort-user-line span {
  color: #53606a;
  font-weight: 800;
  white-space: nowrap;
}

.review-detail-row > td {
  background: #f8faf8;
  padding: 0.75rem;
}

.review-detail-table {
  font-size: 0.74rem;
  table-layout: fixed;
}

.review-detail-table th,
.review-detail-table td {
  text-align: center;
}

.review-detail-table th:nth-child(1),
.review-detail-table td:nth-child(1) {
  text-align: left;
  width: 15%;
}

.review-detail-table th:nth-child(2),
.review-detail-table td:nth-child(2) {
  overflow-wrap: anywhere;
  text-align: left;
  width: 25%;
}

.review-detail-table th:nth-child(n + 3),
.review-detail-table td:nth-child(n + 3) {
  width: 6.5%;
}

.dialog-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.75rem;
  justify-self: center;
  max-width: 440px;
  padding: 1rem;
  width: 100%;
}

.dialog-card p {
  margin-bottom: 0;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.org-tree {
  overflow-x: auto;
  padding: 1.25rem 0.5rem;
  text-align: center;
}

.org-item {
  align-items: center;
  display: inline-flex;
  flex-direction: column;
  position: relative;
}

.org-branch {
  align-items: center;
  display: flex;
  flex-direction: column;
  padding-top: 1.5rem;
  position: relative;
}

.org-node {
  background: var(--accent);
  border: 1px solid var(--accent-strong);
  border-radius: 8px;
  color: #fff;
  display: inline-grid;
  gap: 0.2rem;
  min-width: 220px;
  padding: 0.65rem 0.75rem;
  position: relative;
  text-align: center;
  z-index: 1;
}

.org-node span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
}

.org-children {
  display: flex;
  gap: clamp(1rem, 3vw, 2.5rem);
  justify-content: center;
  margin-top: 1.5rem;
  min-width: 100%;
  position: relative;
}

.org-children::before {
  background: var(--line);
  content: "";
  height: 1px;
  left: 110px;
  position: absolute;
  right: 110px;
  top: 0;
}

.org-children.single-child::before {
  display: none;
}

.org-item > .org-children::after {
  background: var(--line);
  content: "";
  height: 1.5rem;
  left: 50%;
  position: absolute;
  top: -1.5rem;
  width: 1px;
}

.org-branch::before {
  background: var(--line);
  content: "";
  height: 1.5rem;
  left: 50%;
  position: absolute;
  top: 0;
  width: 1px;
}

.tag {
  background: #edf2ee;
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
}

.review-card header,
.review-card footer {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.review-meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0.3rem 0 0;
}

.review-lines {
  display: grid;
  gap: 0.45rem;
  margin: 0.8rem 0;
}

.review-line {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0.4rem;
  grid-template-columns: 1.3fr 0.8fr 2fr;
  padding-top: 0.55rem;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: end;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 1.25rem;
  text-align: center;
}

@media (max-width: 860px) {
  .app-header,
  .toolbar,
  .panel-header,
  .actions,
  .review-card header,
  .review-card footer {
    align-items: stretch;
    flex-direction: column;
  }

  .role-switch,
  .field-row.compact,
  .summary-grid,
  .manager-layout,
  .manager-workspace,
  .review-line {
    grid-template-columns: 1fr;
  }

  .vertical-tabs {
    position: static;
  }

  .review-actions {
    justify-content: stretch;
  }

  .profile-actions,
  .profile-card {
    align-items: stretch;
    justify-content: stretch;
    width: 100%;
  }

  .profile-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
  }

  .project-section-header,
  .project-editor-header {
    align-items: stretch;
    flex-direction: column;
  }
}
