/* APW Warranty portal */
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/lato-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 700; font-display: swap; src: url('/assets/fonts/lato-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 900; font-display: swap; src: url('/assets/fonts/lato-latin-900-normal.woff2') format('woff2'); }
:root {
  --red: #c1392b; --red-dark: #a5281b; --ink: #1f2430; --muted: #7a808c;
  --bg: #f4f5f7; --line: #e8eaee; --card: #fff; --ok: #1a7a45; --ok-bg: #eafaf1; --bad: #b3261e; --bad-bg: #fdecea;
  --warn: #8a5a00; --warn-bg: #fff6e0; --info: #1b5fa8; --info-bg: #eef6ff;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Lato', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--red); }
h1, h2, h3, p { margin-top: 0; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
:focus-visible { outline: 3px solid rgba(193, 57, 43, .35); outline-offset: 2px; }
.muted { color: var(--muted); font-size: 13px; }
.nowrap { white-space: nowrap; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Logo */
.logo-badge { width: 40px; height: 40px; border-radius: 10px; background: #fff; color: var(--red); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 18px; flex-shrink: 0; }
.logo-badge.sm { width: 30px; height: 30px; font-size: 15px; border-radius: 8px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid transparent; border-radius: 8px; padding: 11px 22px; font-weight: 700; cursor: pointer; text-decoration: none; line-height: 1.2; transition: background .15s, color .15s, border-color .15s; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-outline { background: #fff; color: var(--red); border-color: var(--red); }
.btn-outline:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-width: 1px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

/* Notices */
.notice { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; border: 1px solid; }
.notice-success { background: var(--ok-bg); color: var(--ok); border-color: #b7e4c7; }
.notice-error { background: var(--bad-bg); color: var(--bad); border-color: #f5c6c2; }
.notice-info { background: var(--info-bg); color: var(--info); border-color: #bcd9f7; }

/* Forms */
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 6px; }
.field label i { color: var(--red); font-style: normal; }
.field small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
  width: 100%; padding: 11px 14px; border: 1px solid #d9dce2; border-radius: 10px; background: #fff; color: var(--ink); appearance: none; -webkit-appearance: none; min-height: 46px;
}
select { background-image: linear-gradient(45deg, transparent 50%, #777 50%), linear-gradient(135deg, #777 50%, transparent 50%); background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(193, 57, 43, .12); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.checks { display: flex; flex-direction: column; gap: 4px; padding: 10px 14px; background: #fff; border: 1px solid #d9dce2; border-radius: 10px; }
.check { display: flex !important; align-items: center; gap: 10px; font-weight: 400 !important; font-size: 15px !important; margin: 0 !important; padding: 6px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--red); margin: 0; }

/* Auth pages */
.auth-body { background: var(--bg); }
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 430px; background: #fff; border-radius: 16px; padding: 32px 30px; box-shadow: 0 6px 30px rgba(31, 36, 48, .08); border: 1px solid var(--line); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand .logo-badge { background: var(--red); color: #fff; }
.auth-brand strong { display: block; font-size: 17px; font-weight: 900; line-height: 1.15; }
.auth-brand span { font-size: 12px; color: var(--muted); }
.auth-card h1 { font-size: 24px; font-weight: 900; margin-bottom: 6px; }
.auth-sub { color: var(--muted); margin-bottom: 22px; font-size: 14px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 14px; flex-wrap: wrap; }
.auth-foot { text-align: center; margin: 22px 0 0; font-size: 14px; color: var(--muted); }

/* App shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 250px; flex-shrink: 0; background: var(--red); color: #fff; display: flex; flex-direction: column; padding: 24px 0 18px; position: sticky; top: 0; height: 100vh; }
.sb-logo { display: flex; align-items: center; gap: 12px; padding: 0 20px 22px; }
.sb-logo strong { display: block; font-size: 17px; font-weight: 900; line-height: 1.15; }
.sb-logo span { font-size: 12px; opacity: .85; }
.sb-label { padding: 6px 24px 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .75; }
.sb-nav { flex: 1; overflow-y: auto; }
.sb-nav a { display: flex; align-items: center; gap: 12px; margin: 0 12px 4px; padding: 13px 16px; border-radius: 12px; color: #fff; text-decoration: none; font-weight: 700; transition: background .15s; }
.sb-nav a:hover { background: rgba(255, 255, 255, .15); }
.sb-nav a.active { background: #fff; color: var(--red); }
.sb-foot { padding: 16px 20px 0; border-top: 1px solid rgba(255, 255, 255, .25); }
.sb-user { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; min-width: 0; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: #fff; color: var(--red); display: flex; align-items: center; justify-content: center; font-weight: 900; flex-shrink: 0; }
.sb-user-text { min-width: 0; line-height: 1.3; }
.sb-user-text strong, .sb-user-text span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-text span { font-size: 12px; opacity: .85; }
.sb-logout { display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; color: #fff; font-weight: 700; padding: 6px 0; cursor: pointer; }
.sb-logout:hover { text-decoration: underline; }
.mobile-bar { display: none; }
.main { flex: 1; min-width: 0; }
.main-inner { max-width: 1400px; padding: 36px 40px 60px; }
.page-title { font-size: 28px; font-weight: 900; margin-bottom: 4px; line-height: 1.2; }
.page-sub { color: var(--muted); margin-bottom: 24px; }
.section-title { font-size: 18px; font-weight: 900; margin: 28px 0 12px; }
.more { margin-top: 12px; }

/* Cards, stats */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 26px 28px; margin-bottom: 20px; }
.card.narrow { max-width: 520px; }
.card-title { font-size: 17px; font-weight: 900; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.card.empty { text-align: center; color: var(--muted); padding: 44px 20px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stats.four { grid-template-columns: repeat(4, 1fr); }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; min-width: 0; }
.stat-label { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.stat-value { font-size: 30px; font-weight: 900; color: var(--red); line-height: 1.1; margin: 0; }
.stat-value.dark { color: var(--ink); }
.stat-value small { font-size: 13px; font-weight: 400; color: var(--muted); }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 700; word-break: break-word; }

/* Upload */
.dropzone { border: 2px dashed #d3d6dd; border-radius: 12px; padding: 22px; text-align: center; background: #fff; color: var(--muted); transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--red); background: #fff7f6; }
.dropzone p { margin: 8px 0 0; }
.file-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; font-size: 14px; border: 1px solid #b7e4c7; background: var(--ok-bg); color: var(--ok); }
.file-item.busy { border-color: #bcd9f7; background: var(--info-bg); color: var(--info); }
.file-item.err { border-color: #f5c6c2; background: var(--bad-bg); color: var(--bad); }
.file-item .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .fsize { font-size: 12px; opacity: .8; }
.file-item .rm { background: none; border: 0; color: inherit; cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px; opacity: .7; }
.file-item .rm:hover { opacity: 1; }

/* Tables */
.table-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; padding: 13px 12px; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: #6b7280; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fff; }
table.data td { padding: 12px 12px; border-bottom: 1px solid #f0f1f4; vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fafbfc; }
td.notes { max-width: 200px; font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.file-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; text-decoration: none; margin-right: 8px; }
.file-link:hover { text-decoration: underline; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: #eef0f3; color: #4b5563; }
.badge-ok { background: var(--ok-bg); color: var(--ok); } .badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-bad { background: var(--bad-bg); color: var(--bad); } .badge-dark { background: var(--ink); color: #fff; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; color: var(--muted); }
.filters { display: grid; grid-template-columns: 2fr 2fr 1fr 1fr; gap: 0 16px; align-items: end; }
.filters .field { margin-bottom: 0; }
.filter-actions { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.filters-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; padding: 20px 24px; }
.inline-filters { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.inline-filters .filter-actions { grid-column: auto; margin-top: 0; }
.inline-filters .field { min-width: 200px; }
form.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Mobile */
@media (max-width: 860px) {
  .sidebar { display: none; }
  .shell { display: block; }
  .mobile-bar { display: block; background: var(--red); color: #fff; position: sticky; top: 0; z-index: 20; }
  .mb-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px 6px; }
  .mb-top strong { flex: 1; font-weight: 900; }
  .mb-top form { margin: 0; }
  .mb-logout { background: rgba(255, 255, 255, .18); color: #fff; border: 0; border-radius: 8px; padding: 6px 12px; font-weight: 700; cursor: pointer; }
  .mb-nav { display: flex; overflow-x: auto; scrollbar-width: none; padding: 0 8px; }
  .mb-nav::-webkit-scrollbar { display: none; }
  .mb-nav a { color: rgba(255, 255, 255, .8); text-decoration: none; font-weight: 700; padding: 10px 14px; border-bottom: 3px solid transparent; white-space: nowrap; }
  .mb-nav a.active { color: #fff; border-bottom-color: #fff; }
  .main-inner { padding: 22px 16px 50px; }
  .page-title { font-size: 23px; }
  .card { padding: 18px; }
  .grid-2 { grid-template-columns: 1fr; }
  .stats { gap: 10px; } .stats.four { grid-template-columns: 1fr 1fr; }
  .stat { padding: 12px 14px; } .stat-value { font-size: 21px; }
  .filters { grid-template-columns: 1fr 1fr; gap: 14px 12px; }
  .filters .field:nth-child(1), .filters .field:nth-child(2) { grid-column: 1 / -1; }
  .inline-filters .field { min-width: 0; width: 100%; }
  .table-card { overflow: visible; background: none; border: 0; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 12px; padding: 6px 4px; }
  table.stack td { border: 0; padding: 7px 14px; display: flex; justify-content: space-between; gap: 16px; text-align: right; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-weight: 700; font-size: 12px; text-align: left; flex-shrink: 0; }
  table.stack td .actions { justify-content: flex-end; }
  td.notes { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Logo */
.auth-logo { display: block; text-align: center; margin: 0 0 22px; }
.auth-logo img { width: 190px; max-width: 70%; height: auto; }
.sb-logo { padding: 0 16px 20px; }
.sb-logo-img { display: block; background: #fff; border-radius: 14px; padding: 12px 14px; }
.sb-logo-img img { display: block; width: 100%; max-width: 170px; height: auto; margin: 0 auto; }
.sb-role { display: block; margin-top: 10px; text-align: center; font-size: 12px; letter-spacing: .04em; opacity: .9; }
.mb-logo { display: block; background: #fff; border-radius: 8px; padding: 4px 8px; line-height: 0; }
.mb-logo img { height: 28px; width: auto; display: block; }
.mb-spacer { flex: 1; }

/* Very small phones (320px) */
.field { min-width: 0; }
@media (max-width: 860px) {
  .filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  table.stack td { flex-wrap: wrap; overflow-wrap: anywhere; min-width: 0; }
  table.stack td > * { min-width: 0; }
}
@media (max-width: 400px) {
  .filters { grid-template-columns: minmax(0, 1fr); }
  .auth-card { padding: 26px 20px; }
}
.sb-logo { display: block; }

/* ===== Mobile flyout menu ===== */
.mb-menu, .sb-close, .drawer-backdrop { display: none; }
@media (max-width: 860px) {
  .mobile-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--red); position: sticky; top: 0; z-index: 30; }
  .mb-menu { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .16); color: #fff; cursor: pointer; }
  .mb-menu:hover { background: rgba(255, 255, 255, .26); }
  .mb-nav, .mb-top, .mb-logout { display: none; }

  .sidebar {
    display: flex; position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; height: 100dvh;
    width: min(300px, 86vw); z-index: 60; overflow-y: auto; overscroll-behavior: contain;
    transform: translateX(-102%); visibility: hidden;
    transition: transform .26s ease, visibility 0s linear .26s; box-shadow: none;
  }
  .sidebar.open { transform: none; visibility: visible; transition: transform .26s ease, visibility 0s; box-shadow: 8px 0 30px rgba(0, 0, 0, .25); }
  .sb-nav { overflow: visible; }
  .sb-close { display: flex; align-items: center; justify-content: center; position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .16); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; z-index: 2; }
  .sb-close:hover { background: rgba(255, 255, 255, .28); }
  .sb-logo { padding-top: 44px; }

  .drawer-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(20, 24, 34, .5); opacity: 0; transition: opacity .26s ease; }
  .drawer-backdrop:not([hidden]) { display: block; }
  .drawer-backdrop.show { opacity: 1; }
  body.menu-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .sidebar, .sidebar.open, .drawer-backdrop { transition: none !important; }
}
.badge{white-space:nowrap}

/* New logo: white artwork sits directly on the red sidebar / top bar */
.sb-logo-img { background: none; border-radius: 0; padding: 4px 6px 0; }
.sb-logo-img img { max-width: 200px; }
.mb-logo { background: none; border-radius: 0; padding: 0; }
.mb-logo img { height: 30px; width: auto; }
.auth-logo img { width: 230px; }

/* Others text box, declaration modal, danger button */
.other-field { margin: 10px 0 0 !important; }
.other-field[hidden] { display: none; }
.btn-danger { background: #fff; color: #b42318; border: 1.5px solid #b42318; }
.btn-danger:hover { background: #b42318; color: #fff; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 22, 30, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal-backdrop[hidden] { display: none; }
.modal { background: #fff; border-radius: 16px; padding: 26px 24px 22px; max-width: 440px; width: 100%; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal h2 { margin: 0 0 10px; font-size: 20px; }
.modal p { margin: 0 0 20px; line-height: 1.55; color: #3a3f4b; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
/* keep the admin submissions table compact even with long "Others" text */
.table-card td[data-label="Service Type"] { max-width: 200px; overflow-wrap: anywhere; }
.table-card td[data-label="Workshop"], .table-card td[data-label="Notes"] { overflow-wrap: anywhere; }
@media (min-width: 861px) {
  .table-card td[data-label="Service Type"] { max-width: 150px; }
  .table-card td[data-label="Workshop"] { max-width: 120px; }
  .table-card td[data-label="Notes"] { max-width: 110px; }
  .table-card td[data-label="Policy No."] { max-width: 110px; overflow-wrap: anywhere; }
  .table-card td[data-label="Submitted"] { white-space: normal; max-width: 110px; }
}
@media (min-width: 861px) { .table-card table.data th, .table-card table.data td { padding-left: 10px; padding-right: 10px; } }

/* ---- Light-grey sidebar and top bar with the full-colour (black + red) logo ---- */
:root { --side: #e8eaee; }
.sidebar { background: var(--side); color: var(--ink); border-right: 1px solid #dcdfe5; }
.sb-logo-img { padding: 4px 8px 0; }
.sb-role { color: var(--muted); opacity: 1; font-weight: 700; }
.sb-label { color: var(--muted); opacity: 1; }
.sb-nav a { color: #2b303b; }
.sb-nav a:hover { background: rgba(0, 0, 0, .06); }
.sb-nav a.active { background: var(--red); color: #fff; }
.sb-foot { border-top: 1px solid #d3d6dd; }
.avatar { background: var(--red); color: #fff; }
.sb-user-text span { color: var(--muted); opacity: 1; }
.sb-logout { color: #2b303b; }
.sb-logout:hover { color: var(--red); }
.mobile-bar { background: var(--side) !important; border-bottom: 1px solid #dcdfe5; color: var(--ink); }
.mb-menu { background: rgba(0, 0, 0, .07); color: var(--ink); }
.mb-menu:hover { background: rgba(0, 0, 0, .13); }
.sb-close { background: rgba(0, 0, 0, .07); color: var(--ink); }
.sb-close:hover { background: rgba(0, 0, 0, .14); }
.mb-logo img { height: 32px; }
