/* =========================================================================
   Attendance + Documents pages, appearance switch, shared bits.
   Measurements are from the reference pages (Nov 2026).
   ========================================================================= */

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

body.is-switching, body.is-switching * {
  transition-property: background-color, color, border-color, box-shadow, fill !important;
  transition-duration: .24s !important;
}

/* ---------- Appearance switch (profile menu) ---------- */
.appearance { padding: 2px 4px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--border-muted); }
.appearance__label { margin: 6px 4px 4px; font-size: .75rem; line-height: 1.0625rem; font-weight: 600; color: var(--text-muted); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 2px; border-radius: 8px; background: var(--gray-chip); }
.seg--3 { grid-template-columns: repeat(3, 1fr); }
.seg__btn {
  height: 28px; padding: 0 6px; border-radius: 6px;
  font-size: .75rem; font-weight: 500; color: var(--text-subtle);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background-color .16s var(--ease), color .16s var(--ease), box-shadow .16s var(--ease);
}
.seg__btn:hover { color: var(--text-normal); }
.seg__btn[aria-pressed="true"] { background: var(--popup-solid); color: var(--text-normal); box-shadow: var(--btn-ring); }

/* ---------- Blade-style buttons ---------- */
.bbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  height: 36px; padding: 0 16px;
  border-radius: 8px;
  font: 500 .875rem/1.25rem var(--font-text);
  white-space: nowrap;
  transition: background-color .16s var(--ease), box-shadow .16s var(--ease), transform .08s var(--ease), opacity .16s var(--ease);
}
.bbtn:active:not(:disabled) { transform: scale(.97); }
.bbtn:disabled { opacity: .45; cursor: not-allowed; }
.bbtn--lg { height: 44px; }
.bbtn--icon { width: 36px; padding: 0; }
.bbtn--primary { background: var(--primary); color: var(--on-primary, #fff); box-shadow: var(--btn-primary-shadow, none); }
.bbtn--primary:hover:not(:disabled) { background: var(--primary-hover); }
.bbtn--secondary { background: var(--bg-intense); color: var(--text-normal); box-shadow: var(--btn-ring); }
.bbtn--secondary:hover:not(:disabled) { box-shadow: var(--btn-ring-hover); }
.bbtn:focus-visible { outline: 4px solid var(--focus-ring); outline-offset: 1px; }
.bbtn[hidden] { display: none; }

/* ---------- Attendance ---------- */
.main--attendance { padding: 0; }
.att { display: flex; min-height: 100%; }
.att__col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 32px; padding: 32px; }
.att__side { width: 25%; flex: none; padding: 20px; background: var(--main-bg, var(--bg-moderate)); }
.att__side h2 { margin-top: 32px; font-family: var(--font-text); font-size: 1.25rem; line-height: 1.625rem; font-weight: 600; color: var(--text-normal); }
.bal { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.bal p { font-size: .875rem; line-height: 1.25rem; }
.bal__label { color: var(--text-muted); }
.bal__value { color: var(--text-subtle); }
.bal__cta { margin-top: 32px; }

.card {
  position: relative;
  padding: 24px;
  border-radius: 12px;
  background: var(--card-bg, var(--bg-intense));
  border-top: 1px solid var(--card-top-edge, var(--border-subtle));
  box-shadow: var(--card-shadow);
  -webkit-backdrop-filter: var(--card-blur, none); backdrop-filter: var(--card-blur, none);
}
.punch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; }
.punch h2 { font-size: 1.125rem; line-height: 1.5rem; font-weight: 600; color: var(--text-normal); }
.punch p { font-size: .875rem; line-height: 1.25rem; color: var(--text-normal); }

.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cal-bar__left { display: flex; gap: 12px; }
.bselect { position: relative; display: block; width: 125px; height: 36px; }
.bselect select {
  width: 100%; height: 36px;
  padding: 8px 36px 8px 12px;
  border: 0; border-radius: 8px;
  background: var(--bg-intense); color: var(--text-normal);
  box-shadow: var(--btn-ring);
  font: 400 .875rem/1.25rem var(--font-text);
  appearance: none; -webkit-appearance: none;
  cursor: pointer;
  transition: box-shadow .16s var(--ease);
}
.bselect select:hover { box-shadow: var(--btn-ring-hover); }
.bselect select:focus-visible { outline: 4px solid var(--focus-ring); outline-offset: 1px; }
.bselect .icon { position: absolute; right: 12px; top: 10px; color: var(--text-muted); pointer-events: none; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal__cell {
  min-height: 41px; padding: 12px;
  text-align: center;
  font-size: .75rem; line-height: 1.0625rem; font-weight: 600;
  color: var(--text-subtle);
}
.cal__head { color: var(--text-muted); }
.cal__day.is-muted { color: var(--text-muted); }
.cal__day.is-leave { color: var(--negative); }
.cal__day.is-today { outline: 1px solid var(--today-ring); outline-offset: -1px; }

.att__h2 { font-size: 1.125rem; line-height: 1.5rem; font-weight: 600; color: var(--text-normal); }
.att__sub { margin: 4px 0 12px; font-size: .875rem; line-height: 1.25rem; color: var(--text-normal); }

.table-card {
  border-radius: 12px; overflow: hidden;
  background: var(--card-bg, var(--bg-intense));
  border-left: 1px solid var(--table-edge);
  box-shadow: var(--card-shadow);
  -webkit-backdrop-filter: var(--card-blur, none); backdrop-filter: var(--card-blur, none);
}
.table-scroll { overflow-x: auto; }
.btable { width: 100%; min-width: 760px; border-collapse: collapse; table-layout: fixed; }
.btable th {
  height: 37px; padding: 0 12px;
  text-align: left;
  background: var(--table-head-bg);
  border-bottom: 1px solid var(--border-muted);
  font-size: .75rem; line-height: 1.0625rem; font-weight: 500;
  color: var(--text-muted);
}
.btable td { height: 48px; padding: 8px 12px; border-bottom: 1px solid var(--border-muted); vertical-align: middle; }
.btable tr:last-child td { border-bottom: 0; }
.cell-text { display: block; font-size: .875rem; line-height: 1.25rem; color: var(--text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-text--wrap { white-space: normal; }
.cell-text.is-muted { color: var(--text-muted); }
.dash { font-size: .875rem; color: var(--text-subtle); }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 4px; border-radius: 9999px; font-size: .75rem; line-height: 1.0625rem; font-weight: 500; }
.badge span { padding: 0 4px; }
.badge--neutral { background: var(--gray-chip); color: var(--text-subtle); }
.badge--negative { background: var(--badge-neg-bg); color: var(--negative); }
.badge--positive { background: var(--badge-pos-bg); color: var(--badge-pos-text); }
.edit-btn {
  display: inline-flex; padding: 4px; margin-left: -4px; border-radius: 6px;
  color: var(--link-icon, var(--primary));
  transition: background-color .12s var(--ease), color .12s var(--ease);
}
.edit-btn:hover { background: var(--gray-hover); color: var(--link-hover); }

/* ---------- Documents (server-rendered style form) ---------- */
.page-h1 { margin: 0 0 36px; font-family: var(--font-heading); font-size: 24px; line-height: 32px; font-weight: 600; color: var(--text-normal); }
.vform { max-width: 540px; }
.vform fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.vform label { display: block; margin-bottom: 6px; font-size: .75rem; line-height: 1.15; color: var(--text-subtle); }
.vform label.required::after { content: " *"; color: var(--negative); white-space: pre; }
.vform select, .vform input[type="text"] {
  display: block; width: 100%; height: 36px;
  margin-bottom: 24px; padding: 8px 12px;
  border: 0; border-radius: 4px;
  background: var(--bg-intense); color: var(--text-normal);
  box-shadow: var(--border-subtle) 0 0 0 1px;
  font: 400 .875rem var(--font-text);
  transition: box-shadow .16s var(--ease);
}
.vform select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 30px;
  background-image: url("../assets/select-chevron.svg");
  background-repeat: no-repeat; background-position: right 12px center;
}
.vform select:hover, .vform input[type="text"]:hover { box-shadow: var(--border-normal) 0 0 0 1px; }
.vform select:focus-visible, .vform input[type="text"]:focus-visible { outline: 4px solid var(--focus-ring); outline-offset: 1px; box-shadow: var(--primary) 0 0 0 1.5px; }
.inputfile { position: absolute; width: .1px; height: .1px; opacity: 0; overflow: hidden; z-index: -1; }
.vform .label--file {
  display: flex; width: 80%; max-width: 432px; height: 36px;
  margin-bottom: 28px; padding: 0;
  border-radius: 4px; overflow: hidden; cursor: pointer;
  background: var(--bg-intense);
  box-shadow: var(--border-subtle) 0 0 0 1px;
  font-size: 12.5px; font-weight: 600;
  transition: background-color .16s var(--ease);
}
.label--file span { width: 50%; padding: 11px 12.5px; color: var(--text-subtle); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label--file strong {
  width: 50%; display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: 0 12.5px;
  background: var(--file-btn-bg); color: var(--primary-text, var(--primary));
  font-weight: 700;
}
.label--file strong .icon { width: 13px; height: 13px; stroke-width: 2.2; }
.vform .label--file:hover { background: var(--gray-active); }
.inputfile:focus-visible + .label--file, .inputfile.has-focus + .label--file { box-shadow: var(--primary) 0 0 0 1.5px; outline: 4px solid var(--focus-ring); outline-offset: 1px; }
.vform input.btn { border: 0; cursor: pointer; font-family: var(--font-text); margin-bottom: 24px; }
.form-error { margin: -12px 0 16px; font-size: .875rem; line-height: 1.25rem; color: var(--negative); }

.doc-list h2 { margin-bottom: 12px; font-family: var(--font-heading); font-size: 16px; line-height: 24px; font-weight: 600; color: var(--text-normal); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border-subtle); border-radius: var(--card-radius, 8px); background: var(--card-bg, var(--bg-intense)); -webkit-backdrop-filter: var(--card-blur, none); backdrop-filter: var(--card-blur, none); }
.vtable { width: 100%; border-collapse: separate; border-spacing: 0; }
.vtable th { padding: 16px 8px 8px; text-align: left; background: var(--table-head-bg); border-bottom: 1px solid var(--border-subtle); color: var(--text-normal); font-size: 12px; line-height: 18px; font-weight: 600; }
.vtable th:first-child, .vtable td:first-child { padding-left: 16px; }
.vtable td { padding: 10px 8px; border-bottom: 1px solid var(--border-subtle); font-size: 14px; line-height: 20px; color: var(--text-subtle); vertical-align: middle; }
.vtable tr:last-child td { border-bottom: 0; }
.vtable td a { font-size: 14px; }
.file-cell { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.file-cell .icon { color: var(--text-muted); }
.file-cell small { font-size: 12px; color: var(--text-muted); }
.empty-row { text-align: center; color: var(--text-muted); padding: 24px 8px !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1275px) {
  .page-h1 { font-size: 18px; line-height: 24px; }
}
@media (max-width: 1024px) {
  .page-h1 { margin-bottom: 24px; }
  .main--documents .side-col:empty { display: none; }
  .att { flex-direction: column; }
  .att__side { width: auto; }
}
@media (max-width: 767px) {
  .punch { flex-direction: column; align-items: flex-start; }
  .cal-bar { flex-direction: column; align-items: flex-start; }
  .cal-bar__left { flex-wrap: wrap; }
  .att__side h2 { font-size: 1.125rem; line-height: 1.5rem; }
  .vform .label--file { width: 80%; }
  .vtable thead { display: none; }
  .vtable tr { display: block; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); }
  .vtable tr:last-child { border-bottom: 0; }
  .vtable td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 12px !important; border: 0; text-align: right; }
  .vtable td::before { content: attr(data-label); color: var(--text-muted); font-size: 12px; text-align: left; }
}
@media (max-width: 480px) {
  .cal__cell { padding: 12px 0; }
  .bselect { width: 118px; }
}

/* The attendance page is a newer screen in the reference: its root size stays 16px at every width,
   headings step down on phones and the large button becomes 36px. */
html:has(body[data-page="attendance"]) { font-size: 16px; }
@media (max-width: 767px) {
  .punch h2, .att__h2 { font-size: 16px; line-height: 22px; }
  .bbtn--lg { height: 36px; }
}
@media (max-width: 480px) {
  .cal-bar__left { flex-wrap: nowrap; width: 100%; }
  .cal-bar__left .bselect { width: auto; flex: 1; min-width: 0; }
  .cal-bar__left .bselect:first-of-type { flex: 1.4; }
  .cal-bar__left .bselect select { padding-right: 30px; }
  .cal-bar__left .bselect .icon { right: 10px; }
}
