:root {
  --ink: #1f2528;
  --muted: #687176;
  --line: #dde2df;
  --paper: #f8faf7;
  --panel: #ffffff;
  --brand: #1f7a5a;
  --brand-dark: #13543d;
  --accent: #c1462f;
  --gold: #d69a2d;
  --shadow: 0 18px 40px rgba(31, 37, 40, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, #f4f8f4 0%, #eef3f0 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.auth-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 430px));
  gap: 18px;
  width: min(100%, 920px);
}

.auth-screen.single-auth .auth-layout {
  grid-template-columns: minmax(280px, 430px);
  justify-content: center;
}

.auth-title {
  grid-column: 1 / -1;
}

.auth-title h1 {
  font-size: clamp(30px, 5vw, 46px);
}

.auth-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.auth-window {
  display: grid;
  align-content: start;
}

.auth-window .login-form,
.auth-window .admin-hint {
  margin: 18px;
}

.auth-card h1 {
  font-size: clamp(30px, 7vw, 42px);
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.attendance-login-form {
  margin-top: 18px;
}

.login-form button,
.secondary-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.login-form button {
  color: #fff;
  background: var(--brand);
}

.admin-hint {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f7faf7;
}

.admin-hint span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px clamp(16px, 4vw, 42px) 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.user-badge {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.secondary-button {
  border: 1px solid var(--line);
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
}

.secondary-button:hover {
  border-color: rgba(31, 122, 90, 0.35);
  color: var(--brand-dark);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
}

h2 {
  font-size: 20px;
}

.today-card {
  min-width: 190px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  text-align: right;
}

.today-card span,
.today-card strong {
  display: block;
}

.today-card span {
  color: var(--muted);
  font-size: 13px;
}

.today-card strong {
  margin-top: 2px;
  font-size: 19px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 18px;
  padding: 0 clamp(16px, 4vw, 42px) 34px;
}

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

.sidebar,
.workspace {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.sidebar {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-size: 24px;
  line-height: 1;
}

.employee-form {
  display: grid;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
}

input:focus,
select:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(31, 122, 90, 0.15);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.employee-form button,
.primary-action {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
}

.employee-form .notice {
  margin: 0;
}

.employee-form button:hover,
.primary-action:hover,
.login-form button:hover,
.icon-button:hover {
  background: var(--brand-dark);
}

.employee-list {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.employee-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px;
  background: transparent;
  text-align: left;
}

.employee-item:hover,
.employee-item.active {
  border-color: rgba(31, 122, 90, 0.28);
  background: #eef7f1;
}

.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 900;
}

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

.employee-meta {
  margin-top: 2px;
  color: var(--muted);
}

.workspace {
  min-width: 0;
  overflow: hidden;
}

.windows-board {
  display: grid;
  grid-template-columns: minmax(420px, 1.15fr) minmax(360px, 0.85fr);
  gap: 18px;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.windows-board.single-window {
  grid-template-columns: 1fr;
}

.app-window {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.window-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  background: #f9fbf8;
}

.window-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #f9fbf8;
}

.tab {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.tab.active {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

.view {
  display: none;
  padding: 18px;
}

.view.active {
  display: block;
}

.app-window.active {
  display: block;
}

.embedded-section {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.billing-shell {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(340px, 440px);
  gap: 18px;
}

.catalog-panel,
.cart-panel,
.manager-grid > section,
.invoice-layout > section,
.receipt-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--panel);
}

.catalog-panel .panel-head {
  align-items: end;
}

.catalog-panel .panel-head input {
  max-width: 280px;
}

.category-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
}

.pill {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  background: #fff;
  font-weight: 800;
  white-space: nowrap;
}

.pill.active {
  border-color: rgba(31, 122, 90, 0.35);
  color: var(--brand-dark);
  background: #eef7f1;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.product-tile {
  display: grid;
  gap: 6px;
  min-height: 142px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfcfb;
  color: var(--ink);
  text-align: left;
}

.product-tile:hover {
  border-color: rgba(31, 122, 90, 0.35);
  box-shadow: 0 12px 24px rgba(31, 37, 40, 0.07);
}

.product-tile span,
.product-tile small,
.cart-line span,
.invoice-item small,
.receipt-head small,
.receipt-head span {
  color: var(--muted);
}

.product-tile span {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.product-tile strong {
  font-size: 16px;
}

.product-tile b {
  align-self: end;
  color: var(--brand-dark);
  font-size: 19px;
}

.customer-grid,
.bill-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.bill-controls {
  grid-template-columns: 1fr 1fr 1fr;
  margin-top: 12px;
}

.cart-lines {
  display: grid;
  gap: 9px;
  min-height: 170px;
  margin-top: 14px;
}

.cart-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fbfcfb;
}

.cart-line b {
  justify-self: end;
}

.qty-controls {
  display: flex;
  grid-column: 1 / -1;
  gap: 6px;
  align-items: center;
}

.qty-controls button,
.table-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.qty-controls input {
  width: 72px;
  min-height: 34px;
  text-align: center;
}

.totals-box {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.totals-box div,
.receipt-totals {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 12px;
}

.totals-box span,
.receipt-totals span,
.receipt-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.totals-box div:nth-last-child(2) strong,
.receipt-totals strong:nth-last-child(5) {
  font-size: 20px;
}

.manager-grid {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 18px;
}

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

.product-form button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding-top: 22px;
}

.check-label input {
  width: 18px;
  min-height: 18px;
}

.compact-table table {
  min-width: 760px;
}

.invoice-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(320px, 420px);
  gap: 18px;
}

.invoice-filters {
  display: grid;
  grid-template-columns: minmax(180px, 260px) 170px;
  gap: 10px;
}

.invoice-list {
  display: grid;
  gap: 8px;
}

.invoice-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.invoice-item:hover,
.invoice-item.active {
  border-color: rgba(31, 122, 90, 0.35);
  background: #eef7f1;
}

.invoice-item span,
.invoice-item small {
  display: block;
}

.receipt-panel {
  align-self: start;
  position: sticky;
  top: 12px;
}

.receipt-empty {
  min-height: 260px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.receipt {
  display: grid;
  gap: 14px;
}

.receipt-head {
  display: grid;
  gap: 3px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
  text-align: center;
}

.receipt-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
}

.receipt-table {
  min-width: 0;
  font-size: 14px;
}

.receipt-table th,
.receipt-table td {
  white-space: normal;
}

.print-button {
  margin-top: 4px;
}

.attendance-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.camera-area {
  position: relative;
  min-height: 460px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #202827;
}

video {
  width: 100%;
  height: 100%;
  min-height: 460px;
  object-fit: cover;
}

.windows-board.single-window .attendance-shell {
  grid-template-columns: minmax(280px, 1.25fr) minmax(260px, 0.75fr);
}

.camera-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 24px;
  color: #edf5ef;
  background: linear-gradient(135deg, #25302d, #42504b);
  text-align: center;
}

.camera-empty span {
  color: #c8d6cf;
}

.mark-panel {
  align-self: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--panel);
}

.upload-control {
  margin-bottom: 12px;
}

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

.status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 24px 0;
}

.status-grid div,
.summary-card,
.record-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfcfb;
}

.status-grid span,
.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.status-grid strong,
.summary-card strong {
  display: block;
  margin-top: 4px;
}

.primary-action {
  width: 100%;
}

.primary-action:disabled {
  cursor: not-allowed;
  background: #9ba7a0;
}

.notice {
  min-height: 22px;
  color: var(--muted);
  font-weight: 700;
}

.salary-head {
  align-items: end;
}

.salary-head input {
  max-width: 180px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
  background: #fff;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #f7faf7;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.record-card {
  display: grid;
  gap: 10px;
}

.record-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 7px;
  object-fit: cover;
  background: #eef1ee;
}

.record-meta {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 13px;
}

.late {
  color: var(--accent);
}

.on-time {
  color: var(--brand);
}

@media (max-width: 940px) {
  .layout,
  .windows-board,
  .attendance-shell,
  .billing-shell,
  .manager-grid,
  .invoice-layout {
    grid-template-columns: 1fr;
  }

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

  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .today-card {
    text-align: left;
  }
}

@media (max-width: 760px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .tabs {
    overflow-x: auto;
  }

  .summary-strip,
  .form-grid,
  .customer-grid,
  .bill-controls,
  .invoice-filters {
    grid-template-columns: 1fr;
  }

  .camera-area,
  video {
    min-height: 340px;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  #printReceipt,
  #printReceipt * {
    visibility: visible;
  }

  #printReceipt {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    padding: 18px;
    background: #fff;
  }

  .print-button {
    display: none;
  }
}
