:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --line: #d9dee7;
  --line-strong: #c5ccd8;
  --text: #17202e;
  --muted: #687386;
  --accent: #176b87;
  --accent-strong: #10526a;
  --accent-soft: #e7f4f7;
  --danger: #9a3412;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.shell {
  width: min(1480px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 16px 0 24px;
}

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

body.is-authenticated .topbar {
  display: flex;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  font-weight: 720;
}

h2 {
  font-size: 18px;
}

#subtitle,
.status-row,
.user-email {
  color: var(--muted);
}

.actions,
.tools,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button,
.icon-button {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  font-weight: 650;
}

.icon-button {
  width: 38px;
  font-size: 18px;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

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

.secondary:hover,
.icon-button:hover,
.table-nav-item:hover,
.table-action:hover {
  background: #f0f3f7;
}

.login {
  display: grid;
  min-height: calc(100vh - 56px);
  place-items: center;
}

.login-card {
  width: min(380px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 28px;
  box-shadow: 0 10px 30px rgb(23 32 46 / 8%);
}

.login-card h2 {
  margin-bottom: 18px;
  text-align: center;
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-form label,
.employee-form label,
.entity-picker {
  display: grid;
  gap: 6px;
  color: #344155;
  font-size: 13px;
  font-weight: 650;
}

.login-form input,
.employee-form input,
.employee-form select,
input[type="search"] {
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  padding: 0 10px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 12px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.google-button {
  width: 100%;
}

.data-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  min-height: calc(100vh - 92px);
}

.sidebar {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding-right: 10px;
}

.sidebar-toggle {
  margin-bottom: 10px;
}

.table-list {
  display: grid;
  gap: 4px;
}

.table-nav-item {
  min-height: 34px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 620;
  overflow: hidden;
  padding: 0 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-nav-item[aria-current="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

body.is-sidebar-collapsed .data-shell {
  grid-template-columns: 48px minmax(0, 1fr);
}

body.is-sidebar-collapsed .sidebar {
  padding-right: 0;
}

body.is-sidebar-collapsed .table-list {
  display: none;
}

.workspace {
  min-width: 0;
}

.toolbar {
  justify-content: space-between;
  margin-bottom: 10px;
}

.toolbar h2 {
  margin-bottom: 4px;
}

.tools {
  flex: 0 0 auto;
}

input[type="search"] {
  width: min(280px, 34vw);
}

#showAllColumnsButton[hidden] {
  display: none;
}

.status-row {
  display: flex;
  gap: 12px;
  min-height: 18px;
  font-size: 13px;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 152px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef2f6;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  position: relative;
  color: #344155;
  font-weight: 720;
  white-space: nowrap;
  user-select: none;
}

td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.th-content {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.th-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.column-hide {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  padding: 0;
}

.column-hide:hover {
  border-color: var(--line);
  background: var(--panel);
  color: var(--danger);
}

.column-hide:disabled {
  cursor: default;
  opacity: 0.35;
}

.column-hide:disabled:hover {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.column-resize {
  position: absolute;
  top: 0;
  right: -4px;
  bottom: 0;
  z-index: 2;
  width: 8px;
  cursor: col-resize;
}

.column-resize::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 3px;
  bottom: 9px;
  width: 1px;
  background: transparent;
}

.column-resize:hover::after {
  background: var(--accent);
}

tbody tr:hover {
  background: #f8fafc;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.download {
  color: var(--accent-strong);
  font-weight: 650;
}

.table-action {
  min-height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--accent-strong);
  font: inherit;
  font-weight: 650;
  padding: 0 10px;
  cursor: pointer;
}

.employee-editor {
  margin-bottom: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
  padding: 12px 0;
}

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

.employee-form-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  grid-column: 1 / -1;
}

.employee-form-head span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.employee-form h2 {
  font-size: 16px;
}

.entity-picker {
  grid-column: span 2;
  position: relative;
}

.entity-select {
  position: relative;
}

.entity-select summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 520;
  list-style: none;
  padding: 0 10px;
}

.entity-select summary::-webkit-details-marker {
  display: none;
}

.entity-select summary::after {
  content: "⌄";
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}

.entity-select[open] summary {
  border-color: var(--accent);
}

.entity-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  width: min(560px, 70vw);
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 12px 28px rgb(23 32 46 / 14%);
  padding: 8px;
}

.employee-form .entity-option {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-weight: 520;
}

.employee-form .entity-option input {
  min-height: 0;
  width: auto;
}

.employee-form-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.error {
  color: var(--danger);
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 20px, 1440px);
    padding-top: 12px;
  }

  .topbar,
  .toolbar,
  .tools {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    justify-content: space-between;
  }

  .data-shell,
  body.is-sidebar-collapsed .data-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 0 10px;
  }

  body.is-sidebar-collapsed .table-list {
    display: none;
  }

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

  .entity-picker {
    grid-column: auto;
  }

  .entity-list {
    position: static;
    grid-template-columns: 1fr;
    width: 100%;
  }

  input[type="search"] {
    width: 100%;
  }

  .table-wrap {
    max-height: calc(100vh - 260px);
  }
}
