
* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

:root {
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: #17233b;
  background: #f4f6fb;
  font-synthesis: none;
}

body {
  margin: 0;
  min-width: 320px;
  background: #f4f6fb;
  font-size: 13px;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

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

/* Login: hide all authenticated application navigation and content. */
body.logged-out .app-shell {
  display: block;
  min-height: 100vh;
}

body.logged-out .sidebar,
body.logged-out .topbar {
  display: none !important;
}

body.logged-out .main-area {
  width: 100%;
  min-height: 100vh;
  padding: 0;
}

body.logged-out #loginSection {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

body.logged-out #employeeSection {
  display: none !important;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 26px 18px 20px;
  background: #fff;
  border-right: 1px solid #e5eaf3;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #111c33;
  text-decoration: none;
  font-size: 19px;
  font-weight: 800;
}

.brand-mark,
.login-logo {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 43px;
  height: 43px;
  border-radius: 13px;
  background: #dc2626;
  color: #fff;
  font-size: 23px;
  font-weight: 800;
}

.brand small {
  display: block;
  margin-top: 4px;
  color: #7886a3;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 2px;
}

.nav-label {
  margin: 48px 10px 16px;
  color: #8996b0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.navigation {
  display: grid;
  gap: 7px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 49px;
  padding: 0 14px;
  border-radius: 11px;
  color: #526381;
  text-decoration: none;
  font-weight: 650;
  transition: background .15s ease, color .15s ease;
}

.nav-link:hover {
  background: #fff1f1;
  color: #dc2626;
}

.nav-link.active {
  background: #fee2e2;
  color: #dc2626;
}

.nav-icon {
  width: 19px;
  text-align: center;
  font-size: 17px;
}

.sidebar-bottom {
  display: grid;
  gap: 18px;
  margin-top: auto;
}

.security-note {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 10px;
  border: 1px solid #e3e9f3;
  border-radius: 12px;
  background: #fff;
}

.security-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #e2f8ed;
  color: #0d9665;
  font-size: 18px;
}

.security-note strong,
.security-note small {
  display: block;
}

.security-note strong {
  font-size: 11px;
}

.security-note small {
  margin-top: 4px;
  color: #7886a3;
  font-size: 10px;
}

.logout-button {
  width: 100%;
  padding: 12px;
  border: 1px solid #e3e9f3;
  border-radius: 10px;
  background: #fff;
  color: #526381;
  text-align: left;
  font-size: 15px;
}

.logout-button:hover {
  background: #f8f9fd;
}

/* Main area and header */
.main-area {
  min-width: 0;
  padding: 0 34px 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 92px;
  margin-bottom: 32px;
  border-bottom: 1px solid #e3e8f1;
}

.topbar .eyebrow {
  display: none;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.6px;
}

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

.topbar-user strong,
.topbar-user small {
  display: block;
}

.topbar-user strong {
  font-size: 12px;
}

.topbar-user small {
  margin-top: 5px;
  color: #7b89a6;
  font-size: 11px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fee2e2;
  color: #dc2626;
  font-weight: 800;
}

/* Typography and page headings */
.eyebrow {
  margin: 0 0 10px;
  color: #8391ad;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.page-section {
  min-width: 0;
}

.welcome-row {
  margin: 0 0 24px;
}

.welcome-row h2,
.section-heading h2 {
  margin: 0;
  color: #14213a;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

.muted {
  color: #7886a3;
  line-height: 1.6;
}

.welcome-row .muted,
.section-heading .muted {
  margin: 8px 0 0;
}

/* Dashboard summary cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 36px;
}

.stat-card {
  min-width: 0;
  padding: 21px 20px;
  border: 1px solid #e5eaf3;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(32, 48, 82, 0.035);
}

.stat-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #7886a3;
  font-size: 12px;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: 18px;
}

.stat-icon.indigo {
  background: #fee2e2;
  color: #dc2626;
}

.stat-icon.teal {
  background: #ddf9f4;
  color: #0b9e91;
}

.stat-icon.orange {
  background: #fff0df;
  color: #e77b00;
}

.stat-icon.blue {
  background: #fee2e2;
  color: #dc2626;
}

.stat-number {
  margin: 22px 0 6px;
  color: #14213a;
  font-size: 29px;
  font-weight: 800;
}

.stat-caption {
  margin: 0;
  color: #8996b0;
  font-size: 11px;
}

/* Directory */
.directory-section {
  margin-top: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid #e0e6f1;
  border-radius: 10px;
  background: #fff;
  color: #4d5e7b;
  font-size: 12px;
  font-weight: 700;
  transition: background .15s ease, border-color .15s ease;
}

.button:hover {
  background: #f8f9fd;
  border-color: #cbd4e5;
}

.button.primary {
  border-color: #dc2626;
  background: #dc2626;
  color: #fff;
}

.button.primary:hover {
  border-color: #b91c1c;
  background: #b91c1c;
}

.button.secondary {
  background: #fff;
}

.button.full-width {
  width: 100%;
}

.button.text-button {
  border-color: transparent;
  background: transparent;
  color: #dc2626;
}

.directory-card,
.editor-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e3e9f3;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(32, 48, 82, 0.035);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 17px 16px;
  border-bottom: 1px solid #edf0f6;
}

.search-box {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 9px;
  min-width: 150px;
  min-height: 41px;
  padding: 0 12px;
  border: 1px solid #dfe6f1;
  border-radius: 10px;
  color: #8190ac;
}

.search-box:focus-within {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #263550;
  font-size: 12px;
}

.toolbar select,
.pagination select {
  min-height: 40px;
  padding: 0 28px 0 12px;
  border: 1px solid #dfe6f1;
  border-radius: 10px;
  background: #fff;
  color: #526381;
  font-size: 11px;
}

.status-message {
  min-height: 26px;
  padding: 8px 18px 4px;
  color: #8290aa;
  font-size: 11px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

thead {
  background: #f9fafd;
}

th {
  padding: 13px 15px;
  color: #8391aa;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  white-space: nowrap;
}

td {
  padding: 14px 15px;
  border-top: 1px solid #edf0f6;
  color: #566582;
  font-size: 11px;
  vertical-align: middle;
}

.employee-cell {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 145px;
}

.employee-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  background: #fee2e2;
  color: #dc2626;
  font-weight: 800;
}

.employee-name,
.employee-subtitle {
  display: block;
}

.employee-name {
  color: #1a2740;
  font-size: 12px;
  font-weight: 750;
}

.employee-subtitle {
  margin-top: 5px;
  color: #8794ad;
  font-size: 10px;
}

.department-pill {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 6px;
  background: #f0f2f8;
  color: #52617c;
  white-space: nowrap;
}

.status-pill {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.3;
  white-space: nowrap;
}

.status-pill.active {
  background: #dcfce7;
  color: #166534;
}

.status-pill.inactive {
  background: #fee2e2;
  color: #991b1b;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.row-action {
  min-height: 29px;
  padding: 0 9px;
  border: 1px solid #e0e6f1;
  border-radius: 7px;
  background: #fff;
  color: #52617c;
  font-size: 10px;
  font-weight: 650;
}

.row-action:hover {
  background: #f5f7fc;
}

.row-action.delete {
  color: #c03939;
}

.row-action.delete:hover {
  border-color: #f1c6c6;
  background: #fff4f4;
}

.empty-state {
  padding: 38px 20px;
  text-align: center;
}

.empty-icon {
  margin-bottom: 12px;
  color: #dc2626;
  font-size: 28px;
}

.empty-state h3 {
  margin: 0 0 8px;
  color: #1a2740;
  font-size: 17px;
}

.empty-state p {
  margin: 0 0 18px;
  color: #7886a3;
  line-height: 1.6;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 17px;
  border-top: 1px solid #edf0f6;
  color: #7886a3;
  font-size: 11px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 9px;
}

.pagination-controls label {
  margin-right: 1px;
}

.pagination select {
  min-height: 33px;
}

.page-button {
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 20px;
}

#pageInfo {
  min-width: 34px;
  text-align: center;
}

/* Add/edit employee form */
.editor-card {
  margin-top: 24px;
  padding: 24px;
}

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

.form-field label,
#loginForm label {
  display: block;
  margin-bottom: 8px;
  color: #35435d;
  font-size: 11px;
  font-weight: 750;
}

.form-field input,
.form-field select,
#loginForm input {
  display: block;
  width: 100%;
  min-height: 43px;
  padding: 0 12px;
  border: 1px solid #dfe5f0;
  border-radius: 9px;
  outline: none;
  background: #fff;
  color: #263550;
  font-size: 12px;
}

.form-field input:focus,
.form-field select:focus,
#loginForm input:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.09);
}

.form-message {
  min-height: 20px;
  margin-top: 14px;
  color: #c03939;
  font-size: 12px;
}

.form-message.success {
  color: #14804a;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
}

/* Login card */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 65vh;
}

.login-card {
  width: min(100%, 420px);
  padding: 34px;
  border: 1px solid #e4e9f3;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(32, 48, 82, 0.045);
}

.login-logo {
  margin-bottom: 23px;
  width: 48px;
  height: 48px;
  border-radius: 13px;
}

.login-card h2 {
  margin: 0;
  color: #17233b;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.login-card > .muted {
  margin: 10px 0 27px;
  font-size: 12px;
}

#loginForm {
  margin-top: 0;
}

#loginForm input {
  margin-bottom: 18px;
}

#loginForm button {
  margin-top: 8px;
  min-height: 42px;
}

.login-footnote {
  margin: 20px 0 0;
  padding-top: 18px;
  border-top: 1px solid #e9edf5;
  color: #8794ad;
  text-align: center;
  font-size: 10px;
}

/* Employee profile modal */
.modal-overlay {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 20px;
  background: rgba(17, 28, 51, 0.48);
}

.profile-modal {
  position: relative;
  width: min(100%, 500px);
  padding: 30px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(17, 28, 51, 0.2);
}

.modal-close {
  position: absolute;
  top: 13px;
  right: 15px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: #f4f6fb;
  color: #52617c;
  font-size: 23px;
}

.profile-avatar {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  margin-bottom: 18px;
  border-radius: 14px;
  background: #fee2e2;
  color: #dc2626;
  font-size: 19px;
  font-weight: 800;
}

.profile-modal h2 {
  margin: 0;
  color: #17233b;
  font-size: 22px;
}

.profile-modal > .muted {
  margin: 8px 0 22px;
}

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

.profile-details > div {
  min-width: 0;
  padding: 13px;
  border: 1px solid #e8edf5;
  border-radius: 10px;
}

.profile-details span,
.profile-details strong {
  display: block;
}

.profile-details span {
  margin-bottom: 7px;
  color: #8794ad;
  font-size: 10px;
}

.profile-details strong {
  overflow-wrap: anywhere;
  color: #273650;
  font-size: 12px;
}

/* Responsive layout */
@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .main-area {
    padding-right: 22px;
    padding-left: 22px;
  }

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

  .toolbar {
    flex-wrap: wrap;
  }

  .search-box {
    flex-basis: 100%;
  }
}

@media (max-width: 700px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid #e5eaf3;
  }

  .nav-label {
    margin: 20px 5px 8px;
  }

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

  .sidebar-bottom {
    margin-top: 14px;
  }

  .security-note {
    display: none;
  }

  .main-area {
    padding: 0 14px 28px;
  }

  .topbar {
    min-height: 75px;
    margin-bottom: 22px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .topbar-user small {
    display: none;
  }

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

  .heading-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .toolbar select {
    flex: 1 1 40%;
    min-width: 0;
  }

  .toolbar .text-button {
    flex: 1 1 auto;
  }

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

  .editor-card {
    padding: 17px;
  }

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

  .pagination-controls {
    flex-wrap: wrap;
  }

  .profile-modal {
    padding: 22px;
  }

  .profile-details {
    grid-template-columns: 1fr;
  }
}
