/* Admin panel */
body {
  background: var(--gray-50);
}
.app {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}
/* sidebar (right side in RTL) */
.side {
  background: var(--navy-950);
  color: #c9d5ea;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
  padding: 2px;
}
.brand-name {
  font-weight: 800;
  color: #fff;
  font-size: 16.5px;
}
.brand-sub {
  font-size: 12px;
  opacity: 0.7;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px;
  flex: 1;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  font-weight: 500;
  font-size: 14.5px;
}
.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.nav a.active {
  background: rgba(59, 120, 224, 0.22);
  color: #fff;
}
.nav a .count {
  margin-inline-start: auto;
  background: var(--red-600);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 0 7px;
  min-width: 20px;
  text-align: center;
}
.nav a .count.blue {
  background: var(--blue-500);
}
.side-foot {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.side-foot .who {
  min-width: 0;
}
.side-foot .who strong {
  display: block;
  color: #fff;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-foot button {
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
}
.side-foot button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.content {
  min-width: 0;
  padding: 26px 30px 60px;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h1 {
  font-size: 24px;
  font-weight: 700;
}
.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* stats */
.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  padding: 14px 16px;
  cursor: pointer;
  text-align: start;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: var(--r);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.stat:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow);
}
.stat .k {
  font-size: 13px;
  color: var(--muted);
}
.stat .v {
  font-size: 26px;
  font-weight: 700;
  color: var(--navy-950);
  line-height: 1.2;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.stat.red .v {
  color: var(--red-600);
}
.stat.amber .v {
  color: var(--amber-600);
}

/* toolbar */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.toolbar .input {
  min-height: 38px;
  width: auto;
}
.search {
  position: relative;
  flex: 1 1 240px;
  max-width: 340px;
}
.search .icon {
  position: absolute;
  top: 50%;
  inset-inline-start: 10px;
  transform: translateY(-50%);
  color: var(--gray-400);
}
.search .input {
  width: 100%;
  padding-inline-start: 36px;
}
.toolbar .check {
  font-size: 14px;
  align-items: center;
}

/* table */
.table-wrap {
  overflow-x: auto;
  position: relative; /* contain absolutely-positioned children (sr-only labels) so they can't widen the page */
}
table.t {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.t th {
  text-align: start;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--gray-600);
  background: var(--gray-50);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.t td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.t tbody tr:last-child td {
  border-bottom: 0;
}
.t tbody tr.clickable {
  cursor: pointer;
}
.t tbody tr.clickable:hover td {
  background: #f8fafd;
}
.t .name {
  font-weight: 600;
  color: var(--navy-950);
  white-space: nowrap;
}
.t .sub {
  font-size: 12.5px;
  color: var(--muted);
}
.num {
  font-variant-numeric: tabular-nums;
}
.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}
.empty .icon {
  width: 34px;
  height: 34px;
  color: var(--gray-300);
  margin-bottom: 8px;
}

.prog {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 110px;
}
.prog .bar {
  flex: 1;
  height: 7px;
  background: var(--gray-100);
  border-radius: 99px;
  overflow: hidden;
}
.prog .bar span {
  display: block;
  height: 100%;
  background: var(--green-600);
  border-radius: 99px;
}
.prog .bar span.partial {
  background: var(--blue-500);
}
.prog .txt {
  font-size: 12.5px;
  color: var(--gray-600);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.exp {
  font-size: 13px;
  white-space: nowrap;
}
.exp.expired {
  color: var(--red-600);
  font-weight: 600;
}
.exp.soon {
  color: var(--amber-600);
  font-weight: 600;
}

/* dropdown menu */
.menu-wrap {
  position: relative;
  display: inline-block;
}
.menu {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 4px);
  min-width: 210px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
}
.menu button,
.menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  text-align: start;
  font-size: 14px;
  color: var(--gray-900);
  text-decoration: none;
}
.menu button:hover,
.menu a:hover {
  background: var(--gray-100);
}
.menu .danger {
  color: var(--red-600);
}
.menu hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

/* employee file */
.back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--gray-600);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 10px;
}
.back:hover {
  color: var(--navy-800);
}
.emp-head {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 20px;
  margin-bottom: 16px;
}
.emp-id {
  display: flex;
  gap: 14px;
  align-items: center;
  min-width: 0;
}
.avatar {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: var(--navy-800);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 20px;
  flex: none;
}
.emp-id h1 {
  font-size: 22px;
}
.emp-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 6px;
  font-size: 14px;
  color: var(--gray-600);
}
.emp-meta a {
  color: inherit;
}
.ring {
  --p: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: conic-gradient(var(--green-600) calc(var(--p) * 1%), var(--gray-100) 0);
  display: grid;
  place-items: center;
  flex: none;
}
.ring span {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--navy-950);
  font-variant-numeric: tabular-nums;
}
.emp-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.emp-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr);
  gap: 16px;
  align-items: start;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 {
  font-size: 16px;
}
.panel-body {
  padding: 16px 18px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.doc-row td {
  vertical-align: top;
}
.files {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  font-size: 12.5px;
  cursor: pointer;
  color: var(--navy-800);
  max-width: 170px;
}
.chip:hover {
  border-color: var(--blue-500);
  background: var(--blue-50);
}
.chip .icon {
  width: 14px;
  height: 14px;
}
.chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reason {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--red-600);
}
.row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  white-space: nowrap;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  color: var(--gray-600);
}
.icon-btn:hover {
  background: var(--gray-100);
  color: var(--navy-900);
}
.icon-btn.ok:hover {
  background: var(--green-50);
  color: var(--green-600);
}
.icon-btn.no:hover {
  background: var(--red-50);
  color: var(--red-600);
}
.icon-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 520px;
  overflow: auto;
}
.timeline li {
  position: relative;
  padding: 0 22px 14px 0;
  font-size: 13.5px;
}
.timeline li::before {
  content: '';
  position: absolute;
  inset-inline-start: 5px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gray-300);
}
.timeline li::after {
  content: '';
  position: absolute;
  inset-inline-start: 9px;
  top: 18px;
  bottom: 0;
  width: 1px;
  background: var(--gray-200);
}
.timeline li:last-child::after {
  display: none;
}
.timeline li.employee::before {
  background: var(--blue-500);
}
.timeline li.admin::before {
  background: var(--navy-800);
}
.timeline .when {
  font-size: 12px;
  color: var(--muted);
}

.preview-frame {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.preview-img {
  max-width: 100%;
  max-height: 70vh;
  display: block;
  margin: 0 auto;
  border-radius: var(--r-sm);
}

/* settings */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tabs button {
  border: 0;
  background: none;
  padding: 10px 14px;
  font-weight: 500;
  color: var(--gray-600);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.tabs button.active {
  color: var(--navy-900);
  border-bottom-color: var(--navy-800);
}
.tmpl {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
}
.tmpl:last-child {
  border-bottom: 0;
}
.kv {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 8px 16px;
  font-size: 14px;
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
}

/* login */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  background: linear-gradient(160deg, var(--navy-950), var(--navy-800));
}
.login-card {
  width: 100%;
  max-width: 380px;
  padding: 30px 26px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  align-self: center;
}
.login-card h1 {
  text-align: center;
  font-size: 20px;
}

.qr {
  width: 220px;
  height: 220px;
  display: block;
  margin: 0 auto;
}
.ro-only {
  display: none;
}
body.ro .ro-only {
  display: initial;
}
body.ro .w-only {
  display: none !important;
}

@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .emp-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 820px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .side {
    position: static;
    height: auto;
  }
  .nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 6px 10px;
  }
  .nav a {
    white-space: nowrap;
  }
  .side {
    position: relative;
  }
  /* on phones: keep only the logout button, in the brand row */
  .side-foot {
    position: absolute;
    top: 12px;
    inset-inline-end: 10px;
    padding: 0;
    border: 0;
  }
  .side-foot .who {
    display: none;
  }
  .brand {
    padding: 12px 16px;
  }
  .content {
    padding: 18px 16px 60px;
  }
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kv {
    grid-template-columns: 1fr;
  }
}

/* document table on the employee file: item names wrap so the action buttons stay visible */
.doc-row .name {
  white-space: normal;
  min-width: 140px;
}
.doc-row .files {
  max-width: 190px;
}
