:root {
  --bg: #f6efd5;
  --panel: #f2e2bf;
  --panel-2: #f9f3df;
  --border: #d9bf93;
  --text: #1a1a1a;
  --muted: #4b5563;
  --link: #7a3b20;
  --btn: #e58a4b;
  --btn-text: #1a1a1a;
  --focus: #e58a4b;
  --radius: 14px;
  --btn-radius: 999px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.10);
  --stripe-1: #f4e3b8;
  --stripe-2: #f2b06b;
  --stripe-3: #e58a4b;
  --stripe-4: #b86a55;
  --stripe-5: #6b4a2b;
  --board-gap: clamp(6px, 1.4vmin, 12px);
  --board-tile-radius: 18px;
  --board-tile-scroll-min: 92px;
  --board-tile-scroll-ideal: 14vmin;
  --board-tile-scroll-max: 240px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1 {
  margin: 0;
  font-size: 28px;
}

h2 {
  margin: 0 0 12px 0;
  font-size: 20px;
}

.container {
  width: calc(100% - 40px);
  margin: 0 auto;
  padding: 20px 0 40px 0;
}

.pagePadding {
  padding: 20px;
}

.stripeBand {
  height: 10px;
  background: repeating-linear-gradient(
    135deg,
    var(--stripe-1) 0 42px,
    var(--stripe-2) 42px 84px,
    var(--stripe-3) 84px 126px,
    var(--stripe-4) 126px 168px,
    var(--stripe-5) 168px 210px
  );
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 2px solid var(--border);
  background: var(--panel-2);
}

.toolbar-wrap {
  flex-wrap: wrap;
}

.appBar {
  position: sticky;
  top: 0;
  z-index: 100;
}

.pageHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin: 10px 0 18px 0;
}

.pageHeaderTitle {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pageHeaderTitleRow {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pageSubtitle {
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid rgba(148, 163, 184, 0.40);
  background: rgba(148, 163, 184, 0.18);
  color: #334155;
}

.chipDot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #94a3b8;
  display: inline-block;
}

.chipSuccess {
  border: 1px solid rgba(16,185,129,0.35);
  background: rgba(16,185,129,0.10);
  color: #065f46;
}

.chipSuccess .chipDot {
  background: #10b981;
}

.chipWarning {
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.10);
  color: #92400e;
}

.chipWarning .chipDot {
  background: #f59e0b;
}

.chipError {
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.10);
  color: #7f1d1d;
}

.chipError .chipDot {
  background: #ef4444;
}

.chipStatusOpen {
  border: 1px solid rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.10);
  color: #7f1d1d;
}

.chipStatusOpen .chipDot {
  background: #ef4444;
}

.chipStatusClosed {
  border: 1px solid rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.10);
  color: #166534;
}

.chipStatusClosed .chipDot {
  background: #22c55e;
}

.chipStatusInProgress {
  border: 1px solid rgba(120, 53, 15, 0.35);
  background: rgba(120, 53, 15, 0.10);
  color: #78350f;
}

.chipStatusInProgress .chipDot {
  background: #78350f;
}

.chipStatusWaitingOnCustomer {
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.10);
  color: #1e3a8a;
}

.chipStatusWaitingOnCustomer .chipDot {
  background: #2563eb;
}

.chipStatusResolved {
  border: 1px solid rgba(107, 114, 128, 0.35);
  background: rgba(107, 114, 128, 0.10);
  color: #374151;
}

.chipStatusResolved .chipDot {
  background: #6b7280;
}

.actionBar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.actionBarLeft {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.actionLabel {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.menu {
  position: relative;
}

.menu > summary {
  list-style: none;
}

.menu > summary::-webkit-details-marker {
  display: none;
}

.menuPop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 220px;
  background: var(--panel-2);
  border: 2px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 200;
}

 .nav .menuPop {
   left: 0;
   right: auto;
 }

.menuItem {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px 10px;
  border-radius: 12px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.menuItem:hover {
  background: rgba(148, 163, 184, 0.18);
}

.menuItemLink {
  text-decoration: none;
}

.menuDivider {
  height: 1px;
  background: rgba(148, 163, 184, 0.35);
  margin: 6px 6px;
}

.menuItemDanger {
  color: #7f1d1d;
}

.menuItemDanger:hover {
  background: rgba(127, 29, 29, 0.10);
}

.toolbar-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.toolbar-spacer {
  margin-left: auto;
}

.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.navLink {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.navLink:hover {
  text-decoration: none;
  background: rgba(148, 163, 184, 0.18);
  color: var(--text);
}

.navLinkActive {
  background: var(--panel);
  color: var(--text);
  border-color: var(--border);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.card {
  background: var(--panel-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

button {
  font: inherit;
  padding: 10px 14px;
  border-radius: var(--btn-radius);
  border: 2px solid var(--border);
  background: var(--btn);
  color: var(--btn-text);
  cursor: pointer;
}

button:active {
  transform: scale(0.99);
}

.btn {
  padding: 10px 14px;
  border-radius: var(--btn-radius);
  border: 2px solid var(--border);
  background: var(--btn);
  color: var(--btn-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  text-decoration: none;
  filter: brightness(0.98);
}

.btn:active {
  transform: scale(0.99);
}

.btn-secondary {
  background: var(--panel);
  color: var(--text);
}

.btn-ghost {
  background: transparent;
}

.btn-primary {
  padding: 10px 14px;
  border-radius: var(--btn-radius);
  border: 2px solid var(--border);
  background: var(--btn);
  color: var(--btn-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary:hover {
  text-decoration: none;
  filter: brightness(0.98);
}

.btn-primary:active {
  transform: scale(0.99);
}

.row {
  display: flex;
  gap: 10px;
}

.row > * {
  flex: 1 1 0;
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
dialog:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.input,
select,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="file"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}

label {
  display: block;
  margin: 10px 0 6px 0;
}

.inline-fields {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
}

.inline-fields > div {
  flex: 1 1 220px;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 12px;
}

table thead th {
  text-align: left;
  font-weight: 700;
  color: var(--muted);
  background: var(--panel);
}

table th,
table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

table tbody tr {
  background: var(--panel-2);
}

.muted {
  color: var(--muted);
}

.required-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #7f1d1d;
  border: 1px solid #7f1d1d;
  background: rgba(127, 29, 29, 0.10);
}

.boardIconBox {
  width: 64px;
  height: 64px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.boardIconBox img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.board-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.tile-grid {
  --tile-size: clamp(64px, 22vw, 96px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tile-size), var(--tile-size)));
  gap: var(--board-gap);
  justify-content: start;
}

.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--board-tile-radius);
  user-select: none;
  font-size: clamp(12px, 2.2vmin, 20px);
  cursor: pointer;
  text-align: center;
  padding: 8px;
  position: relative;
  overflow: hidden;
}

.tile .tile-image {
  position: absolute;
  inset: clamp(6px, 1.6vmin, 10px);
  width: calc(100% - (2 * clamp(6px, 1.6vmin, 10px)));
  height: calc(100% - (2 * clamp(6px, 1.6vmin, 10px)));
  object-fit: contain;
  border-radius: 12px;
  pointer-events: none;
  background: transparent;
}

.tile .tile-label {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 0 8px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile[data-label-placement="top"] {
  align-items: flex-start;
}

.tile[data-label-placement="bottom"] {
  align-items: flex-end;
}

.tile[data-label-placement="none"] .tile-label {
  display: none;
}

.board-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}

.tile.has-image .tile-label {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: clamp(6px, 1.6vmin, 10px);
  display: inline-block;
  padding: clamp(4px, 1.2vmin, 6px) clamp(6px, 1.6vmin, 10px);
  font-size: clamp(12px, 2vmin, 18px);
  line-height: 1.1;
  background: rgba(0, 0, 0, 0.85);
  color: #ffffff;
  border-radius: 12px;
  max-width: calc(100% - 24px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile.has-image[data-label-placement="top"] .tile-label {
  top: 0;
  bottom: auto;
  margin-bottom: 0;
  margin-top: clamp(6px, 1.6vmin, 10px);
}

.my-buttons-grid {
  --tile-size: 96px;
}

.my-buttons-grid .my-button-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.my-buttons-grid .tile-caption {
  width: 100%;
  text-align: center;
  font-size: 12px;
  line-height: 1.1;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.my-buttons-grid .tile-no-image {
  font-size: 12px;
  line-height: 1.1;
  font-weight: 700;
  color: var(--muted);
  padding: 6px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#toast-root {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  max-width: min(420px, calc(100vw - 32px));
}

.toast {
  border: 2px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 1;
  transition: opacity 0.2s ease;
}

.toast-hide {
  opacity: 0;
}

.toast-success {
  border-color: #14532d;
}

.toast-error {
  border-color: #7f1d1d;
}

.toast-info {
  border-color: var(--border);
}

dialog {
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  background: var(--panel-2);
  color: var(--text);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}
