/* ==========================================================================
   Oak Hall staff portal
   ========================================================================== */

/* ---------- Login ---------- */

.login {
  display: flex;
  min-height: 100svh;
}

.login-visual {
  position: relative;
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px clamp(28px, 5vw, 72px) 56px;
  color: var(--paper);
  background: var(--ink);
  overflow: hidden;
  isolation: isolate;
}

.login-visual > img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(0deg, rgba(12, 29, 26, 0.92) 10%, rgba(12, 29, 26, 0.2) 60%, rgba(12, 29, 26, 0.5));
}

.login-greeting {
  font-family: var(--font-display);
  font-size: var(--step-4);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 18px;
  max-width: 10ch;
}

.login-form-wrap {
  flex: 1 1 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px var(--gutter);
  position: relative;
}

.back-link {
  position: absolute;
  top: 36px;
  right: var(--gutter);
  font-size: 0.9rem;
}

.login-form {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sso-btn {
  justify-content: center;
  color: var(--ink);
  border-color: var(--line);
}

.sso-btn svg {
  width: 18px;
  height: 18px;
}

.pw-wrap {
  position: relative;
}

.pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: var(--paper-2);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
}

.demo-note {
  font-size: 0.84rem;
  color: var(--muted);
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--paper-2);
  line-height: 1.5;
}

.demo-note code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--white);
  padding: 2px 6px;
  border-radius: 6px;
}

/* ---------- App shell ---------- */

.app-page {
  background: var(--paper);
}

.app {
  display: flex;
  min-height: 100svh;
}

.app-side {
  position: sticky;
  top: 0;
  height: 100svh;
  flex: 0 0 272px;
  background: var(--ink);
  color: var(--paper);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  z-index: 60;
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.app-nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--muted-light);
  font-weight: 500;
  transition: background 0.3s, color 0.3s;
}

.app-nav a svg {
  width: 20px;
  height: 20px;
}

.app-nav a:hover {
  background: rgba(244, 239, 230, 0.06);
  color: var(--paper);
}

.app-nav a.is-active {
  background: rgba(63, 208, 186, 0.14);
  color: var(--teal);
}

.app-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(244, 239, 230, 0.06);
}

.app-user > div {
  flex: 1;
  min-width: 0;
}

.app-user strong {
  display: block;
  font-size: 0.92rem;
}

.app-user small {
  display: block;
  font-size: 0.76rem;
  color: var(--muted-light);
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--teal);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.86rem;
  flex-shrink: 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.3s;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  background: color-mix(in srgb, currentColor 10%, transparent);
}

.app-side .icon-btn {
  border-color: var(--line-light);
}

.app-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px clamp(20px, 3vw, 44px);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.app-top > div {
  flex: 1;
}

.app-top .mono {
  color: var(--muted);
}

.app-menu {
  display: none;
}

.proto-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(242, 165, 65, 0.18);
  color: #8a5513;
}

.app-main {
  padding: clamp(20px, 3vw, 44px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.view {
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: viewIn 0.5s var(--ease);
}

.view[hidden] {
  display: none;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.hello {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-block: 10px 6px;
}

/* ---------- Tiles & panels ---------- */

.tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.tile {
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--white);
  border: 1px solid var(--line);
  transition: transform 0.4s var(--ease), box-shadow 0.4s;
}

a.tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(12, 29, 26, 0.08);
}

.tile--plain {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.tile--plain .tile-s,
.tile--plain .tile-k {
  color: var(--muted-light);
}

.tile b {
  display: block;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 2.6rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.tile .tile-date {
  font-size: 1.9rem;
  color: var(--teal);
}

.tile-k {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.tile-s {
  font-size: 0.86rem;
  color: var(--muted);
}

.ring {
  width: 84px;
  height: 84px;
  flex-shrink: 0;
  transform: rotate(-90deg);
}

.ring circle {
  fill: none;
  stroke: var(--paper-2);
  stroke-width: 12;
}

.ring .ring-val {
  stroke: var(--teal-deep);
  stroke-linecap: round;
  stroke-dasharray: 314.16;
  stroke-dashoffset: 314.16;
  transition: stroke-dashoffset 1.2s var(--ease);
}

.ring .ring-amber {
  stroke: var(--amber);
}

.panels {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

.panels > .panel {
  flex: 1 1 380px;
}

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.panel-head h3 {
  font-size: 1.4rem;
}

.feed,
.people-out,
.history,
.doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.feed li {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.feed p {
  color: var(--muted);
  font-size: 0.92rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--teal-deep);
  margin-top: 8px;
  flex-shrink: 0;
}

.dot--amber {
  background: var(--amber);
}

.people-out li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.people-out img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
}

.people-out div {
  flex: 1;
}

.people-out small {
  display: block;
  color: var(--muted);
}

.people-out .when {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--paper-2);
  white-space: nowrap;
}

/* ---------- Timesheet ---------- */

.week-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.week-nav h3 {
  min-width: 13ch;
  text-align: center;
}

.status-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--paper-2);
}

.status-pill.is-submitted,
.status-pill.is-approved {
  background: rgba(63, 208, 186, 0.2);
  color: var(--teal-deep);
}

.status-pill.is-pending {
  background: rgba(242, 165, 65, 0.2);
  color: #8a5513;
}

.ts-scroll {
  overflow-x: auto;
  margin-inline: -8px;
}

.ts-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 8px 6px;
  min-width: 760px;
}

.ts-table th {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  text-align: center;
  padding-bottom: 4px;
}

.ts-table th:first-child {
  text-align: left;
}

.ts-table th small {
  display: block;
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

.ts-table th.is-today small {
  color: var(--teal-deep);
  font-weight: 700;
}

.ts-table th.is-weekend,
.ts-table td.is-weekend input {
  opacity: 0.55;
}

.ts-table select,
.ts-table input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 0.92rem;
}

.ts-table input {
  text-align: center;
  min-width: 60px;
}

.ts-table input:focus,
.ts-table select:focus {
  outline: none;
  border-color: var(--teal-deep);
  box-shadow: 0 0 0 3px rgba(63, 208, 186, 0.2);
}

.ts-table td.total,
.ts-table tfoot td {
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ts-table tfoot td {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.ts-table tfoot td:first-child {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.ts-table .row-del {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.2rem;
  padding: 4px 8px;
}

.ts-table.is-locked input,
.ts-table.is-locked select {
  background: var(--paper-2);
  pointer-events: none;
}

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

.ts-actions .btn--ghost {
  color: var(--ink);
}

.file-btn {
  position: relative;
  cursor: pointer;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.ts-file {
  font-size: 0.84rem;
  color: var(--teal-deep);
}

.history li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.history li > div {
  flex: 1;
}

.history small {
  display: block;
  color: var(--muted);
}

.history .empty {
  color: var(--muted);
  font-size: 0.92rem;
}

.history .cancel {
  border: 0;
  background: none;
  color: #b3412b;
  font-size: 0.84rem;
  font-weight: 600;
}

/* ---------- Leave ---------- */

.leave-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
}

.leave-form {
  flex: 1 1 340px;
  max-width: 460px;
  position: sticky;
  top: 110px;
}

.leave-right {
  flex: 1 1 460px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.leave-calc {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--paper-2);
  font-size: 0.92rem;
}

.leave-calc b {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.5rem;
}

.legend {
  display: flex;
  gap: 14px;
  font-size: 0.8rem;
  color: var(--muted);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.lg-leave {
  background: var(--teal);
}

.lg-hol {
  background: var(--amber);
}

.cal {
  display: flex;
  flex-wrap: wrap;
}

.cal span {
  width: calc(100% / 7);
  aspect-ratio: 1.3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  border-radius: 12px;
  position: relative;
  font-variant-numeric: tabular-nums;
}

.cal .dow {
  aspect-ratio: auto;
  padding-bottom: 8px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.cal .wknd {
  color: var(--muted);
}

.cal .today {
  font-weight: 800;
  box-shadow: inset 0 0 0 1.5px var(--ink);
}

.cal .hol {
  background: rgba(242, 165, 65, 0.25);
}

.cal .lv {
  background: var(--teal);
  color: var(--ink);
  font-weight: 700;
}

.cal .lv.pending {
  background: rgba(63, 208, 186, 0.35);
}

/* ---------- Documents ---------- */

.doc-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.doc-list li > div {
  flex: 1;
  min-width: 0;
}

.doc-list strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-list small {
  color: var(--muted);
}

.doc-ic {
  width: 44px;
  height: 52px;
  border-radius: 10px;
  background: var(--paper-2);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--teal-deep);
  flex-shrink: 0;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 200;
  transform: translate(-50%, 140%);
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.92rem;
  box-shadow: 0 20px 50px rgba(12, 29, 26, 0.3);
  transition: transform 0.5s var(--ease);
  max-width: calc(100% - 40px);
}

.toast.is-visible {
  transform: translate(-50%, 0);
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .login {
    flex-direction: column;
  }

  .login-visual {
    min-height: 300px;
    flex: 0 0 auto;
  }

  .login-greeting {
    font-size: var(--step-3);
  }

  .login-form-wrap {
    padding-top: 80px;
  }

  .app-side {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.5s var(--ease);
    box-shadow: 30px 0 60px rgba(0, 0, 0, 0.25);
  }

  .app-side.is-open {
    transform: none;
  }

  .app-menu {
    display: grid;
  }

  .leave-form {
    position: relative;
    top: 0;
    max-width: none;
  }
}
