/* Author: Sachjot */

:root {
  --ink: #17202a;
  --muted: #64748b;
  --line: #d7dee8;
  --surface: #ffffff;
  --brand: #155e63;
  --brand-dark: #0f4c50;
  --paper: #f7f9fc;
  --danger: #b3261e;
  --success: #1f8a4d;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

/* Several containers below set their own `display` (grid/flex) for layout,
   which would otherwise out-specificity the UA `[hidden] { display: none }`
   rule since author styles always win over UA styles. Force it here so
   toggling the `hidden` attribute from JS always works. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

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

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #0f4c50 0%, #155e63 45%, #1c7a80 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(15, 76, 80, 0.35);
  display: grid;
  gap: 10px;
}

.login-brand {
  color: var(--brand);
  font-size: 15px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 22px;
}

.login-card p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
}

.login-card label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.login-card input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
}

.login-card button {
  margin-top: 6px;
  min-height: 44px;
  border: none;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.login-card button:hover {
  background: var(--brand-dark);
}

.login-card button:disabled {
  opacity: 0.7;
  cursor: default;
}

.form-error {
  margin: 0;
  padding: 8px 10px;
  background: #fdecea;
  color: var(--danger);
  border-radius: 6px;
  font-size: 13px;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: 100vh;
}

aside {
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

aside > strong {
  display: block;
  color: var(--brand);
  font-size: 20px;
}

.admin-subtitle {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 18px;
}

nav {
  display: grid;
  gap: 4px;
}

.nav-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 6px;
  border: none;
  background: none;
  color: #334155;
  cursor: pointer;
}

.nav-link.active,
.nav-link:hover {
  color: #ffffff;
  background: var(--brand);
}

.logout-button {
  margin-top: auto;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  color: #475569;
}

.logout-button:hover {
  border-color: var(--danger);
  color: var(--danger);
}

main {
  min-width: 0;
}

.tab-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

h1 {
  margin: 0;
  font-size: 24px;
}

.tab-panel header p {
  margin: 4px 0 0;
  color: var(--muted);
  max-width: 640px;
}

.tools {
  display: grid;
  grid-template-columns: 1fr 200px 180px;
  gap: 10px;
  padding: 18px 28px;
}

.tools input,
.tools select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
}

.table-wrap {
  margin: 0 28px 28px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: #475569;
  font-size: 12px;
  text-transform: uppercase;
  background: #fbfcfe;
}

.item-name {
  font-weight: 700;
  color: #0f4c5c;
  margin-right: 6px;
}

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 32px 16px;
}

.pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e8f3f4;
  color: #155e63;
  font-size: 11px;
  font-weight: 600;
}

.pill-combo {
  background: #fdf0dc;
  color: #9a5b0a;
}

.pill-edited {
  background: #e7f6ec;
  color: var(--success);
}

.pill-custom {
  background: #e6eefc;
  color: #1e40af;
}

.pill-removed {
  background: #fdecea;
  color: #b42318;
}

.thumb {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  background: #eef2f6;
}

.thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-weight: 700;
  font-size: 16px;
}

.avail-toggle {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
}

.avail-toggle.is-available {
  color: var(--success);
  border-color: #bfe6cd;
  background: #f1fbf4;
}

.avail-toggle.is-hidden {
  color: var(--danger);
  border-color: #f3c8c4;
  background: #fdf2f1;
}

.btn-edit {
  border: 1px solid var(--brand);
  color: var(--brand);
  background: #fff;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
}

.btn-edit:hover {
  background: var(--brand);
  color: #fff;
}

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

.btn-danger-soft {
  border: 1px solid #f3c8c4;
  color: var(--danger);
  background: #fff;
  border-radius: 6px;
  padding: 8px 14px;
  cursor: pointer;
}

.btn-danger-soft:hover {
  background: #fdf2f1;
}

tr.row-removed {
  opacity: 0.6;
}

.category-card.row-removed {
  opacity: 0.7;
}

.category-card-badges {
  display: flex;
  gap: 6px;
  min-height: 20px;
}

.size-name,
.size-price {
  width: 100%;
}

/* ---------------------------------------------------------------------- */
/* Report tabs -- KPI cards, panel cards, bar lists, filter toolbars        */
/* ---------------------------------------------------------------------- */

.header-actions {
  display: flex;
  gap: 10px;
}

.filter-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  grid-template-columns: none;
}

.filter-field {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
}

.filter-field input,
.filter-field select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  text-transform: none;
  font-weight: 400;
  font-size: 14px;
  color: var(--ink);
}

.filter-field-search {
  flex: 1;
  min-width: 200px;
}

.filter-toolbar .btn-primary {
  align-self: end;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  padding: 0 28px 20px;
}

.kpi-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: grid;
  gap: 6px;
}

.kpi-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: #0f4c5c;
}

/* Compact KPI row nested inside a panel card (e.g. Tax Summary). */
.kpi-grid-compact {
  padding: 14px 20px 4px;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.kpi-grid-compact .kpi-card {
  padding: 12px 14px;
}

.kpi-grid-compact .kpi-value {
  font-size: 20px;
}

.field-hint {
  display: block;
  margin: -4px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.dash-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  padding: 0 28px 20px;
}

.panel-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.panel-card h2 {
  margin: 0 0 14px;
  font-size: 15px;
  color: #334155;
}

.panel-card.table-card {
  margin: 0 28px 20px;
  padding: 0;
  overflow: hidden;
}

.panel-card.table-card h2 {
  margin: 0;
  padding: 18px 20px 0;
}

.panel-card.table-card .table-wrap {
  margin: 14px 0 0;
  border: none;
  border-radius: 0;
}

.panel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 0;
}

.panel-card-header h2 {
  padding: 0;
}

.dash-columns .panel-card.table-card {
  margin: 0;
}

.bar-list {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar-label {
  color: #334155;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  height: 8px;
  border-radius: 999px;
  background: #eef2f6;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--brand);
}

.bar-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.on-clock-list {
  display: grid;
  gap: 10px;
}

.on-clock-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.on-clock-row:last-child {
  border-bottom: none;
}

.on-clock-name {
  font-weight: 700;
  color: #0f4c5c;
}

.on-clock-role {
  grid-column: 2;
  grid-row: 1;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.on-clock-time {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: #f7fbfb;
}

.pill-web {
  background: #e8f3f4;
  color: #155e63;
}

.pill-pos {
  background: #eef0fb;
  color: #4338ca;
}

.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}

.status-active {
  background: #e7f6ec;
  color: var(--success);
}

.status-pending {
  background: #fdf0dc;
  color: #9a5b0a;
}

.status-inactive {
  background: #fdecea;
  color: var(--danger);
}

.btn-sm {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 12px;
}

.staff-actions {
  display: flex;
  gap: 8px;
}

.staff-table-wrap {
  margin: 0 28px 28px;
}

.order-detail-items {
  margin: 12px 0 0;
}

.order-totals {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.order-totals > div {
  display: flex;
  justify-content: space-between;
  color: #475569;
}

.order-total-grand {
  font-weight: 700;
  font-size: 16px;
  color: #0f4c5c;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

/* ---------------------------------------------------------------------- */
/* Category grid                                                           */
/* ---------------------------------------------------------------------- */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  padding: 0 28px 28px;
}

.category-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  display: grid;
  gap: 8px;
}

.category-card-preview {
  height: 120px;
  border-radius: 8px;
  overflow: hidden;
  background: #eef2f6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.category-card label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
}

.category-title-input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.category-actions {
  display: flex;
  gap: 8px;
}

.category-actions button {
  flex: 1;
}

/* ---------------------------------------------------------------------- */
/* Buttons (shared)                                                        */
/* ---------------------------------------------------------------------- */

.btn-primary,
.btn-secondary,
.btn-danger {
  min-height: 40px;
  border-radius: 6px;
  padding: 8px 16px;
  cursor: pointer;
  border: 1px solid transparent;
  font-weight: 600;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-dark);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: default;
}

.btn-secondary {
  background: #fff;
  border-color: var(--line);
  color: #334155;
}

.btn-secondary:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #8f1d17;
}

/* ---------------------------------------------------------------------- */
/* Modal                                                                    */
/* ---------------------------------------------------------------------- */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
}

.modal {
  position: relative;
  background: #fff;
  border-radius: 12px;
  padding: 26px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.35);
}

.confirm-modal {
  max-width: 380px;
}

.modal:has(.order-detail-items) {
  max-width: 640px;
}

.modal h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.modal-subtitle {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.modal-hint {
  margin: 0 0 16px;
  color: #9a5b0a;
  background: #fdf0dc;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
}

.modal form {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.modal label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-top: 10px;
}

.modal input[type="text"],
.modal input[type="number"],
.modal input[type="password"],
.modal textarea {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 12px;
  width: 100%;
}

.modal textarea {
  min-height: 80px;
  resize: vertical;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

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

.confirm-message {
  margin: 0 0 4px;
  font-size: 15px;
}

/* ---------------------------------------------------------------------- */
/* Image editor                                                            */
/* ---------------------------------------------------------------------- */

.image-editor {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  align-items: stretch;
}

.image-preview {
  width: 100px;
  height: 100px;
  border-radius: 8px;
  background: #eef2f6;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-empty {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 6px;
}

.image-drop {
  border: 2px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 6px;
  place-items: center;
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.image-drop p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.image-drop small {
  color: #94a3b8;
  font-size: 11px;
}

.image-drop.drag-over {
  border-color: var(--brand);
  background: #f1fbfb;
}

/* ---------------------------------------------------------------------- */
/* Included counts editor                                                  */
/* ---------------------------------------------------------------------- */

#includedCountsRows {
  display: grid;
  gap: 8px;
}

.included-count-row {
  display: grid;
  grid-template-columns: 1fr 90px 32px;
  gap: 8px;
}

.included-count-row input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
}

.btn-remove-row {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  color: var(--danger);
  font-size: 16px;
  line-height: 1;
}

.btn-add-row {
  margin-top: 8px;
  width: fit-content;
}

.empty-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* ---------------------------------------------------------------------- */
/* Toasts                                                                   */
/* ---------------------------------------------------------------------- */

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  display: grid;
  gap: 10px;
}

.toast {
  min-width: 220px;
  max-width: 340px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #1e293b;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
}

.toast-in {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: var(--success);
}

.toast-error {
  background: var(--danger);
}

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

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

  aside {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .admin-subtitle {
    display: none;
  }

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

  .logout-button {
    margin-top: 0;
  }

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

  .image-editor {
    grid-template-columns: 1fr;
  }
}

/* My Profile ------------------------------------------------------------- */

.profile-card {
  margin: 0 28px 20px;
  max-width: 460px;
}

.stacked-form {
  display: grid;
  gap: 4px;
}

.stacked-form label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-top: 8px;
}

.stacked-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  box-sizing: border-box;
}

.stacked-form input:focus {
  outline: none;
  border-color: #0f7c86;
  box-shadow: 0 0 0 3px rgba(15, 124, 134, 0.12);
}

.form-actions {
  margin-top: 16px;
}
