﻿:root {
  --bg: #f3f6f9;
  --panel: #ffffff;
  --ink: #0b1c2c;
  --muted: #5c6b7a;
  --accent: #1f6f8b;
  --border: #d6e0ea;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Tahoma", "Arial", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  flex-direction: column;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand .sub {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.nav {
  display: flex;
  gap: 16px;
  font-weight: 600;
  flex-wrap: wrap;
}

.nav a {
  padding: 8px 10px;
  border-radius: 6px;
}

.nav a:hover {
  background: #e7f1f6;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.balance {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #eaf2f7;
}

.balance .label {
  font-size: 11px;
  color: var(--muted);
}

.balance .value {
  font-weight: 700;
}

.calc-mini {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--panel);
}

.calc-mini .label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.calc-row {
  display: grid;
  grid-template-columns: repeat(4, 70px);
  gap: 6px;
}

.calc-row input {
  width: 100%;
  padding: 6px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  object-fit: cover;
}

.user-name {
  font-weight: 600;
}

.user .logout {
  font-size: 12px;
  color: var(--accent);
}

.app-main {
  padding: 28px;
}

.page-header h2 {
  margin: 0 0 6px 0;
}

.page-header-actions {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-actions .field {
  min-width: 220px;
}

.muted {
  color: var(--muted);
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.car-thumb {
  width: 92px;
  height: 54px;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: cover;
  cursor: zoom-in;
}

.no-scroll {
  overflow: hidden;
}

.gallery-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 18, 20, 0.8);
  z-index: 1000;
}

.gallery-overlay.is-open {
  display: flex;
}

.gallery-modal {
  width: min(900px, 96vw);
  background: #ffffff;
  border-radius: 16px;
  padding: 18px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}

.gallery-image {
  width: 100%;
  height: min(70vh, 520px);
  border-radius: 12px;
  background: #f5f2ec;
  object-fit: contain;
}

.gallery-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.gallery-count {
  font-weight: 600;
  color: var(--muted);
}

.gallery-nav {
  display: flex;
  gap: 8px;
}

.gallery-btn,
.gallery-close {
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
}

.gallery-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status--green {
  background: #e8f5e9;
  color: #1b5e20;
}

.status--amber {
  background: #fff4e5;
  color: #8a4b00;
}

.status--blue {
  background: #e7f0ff;
  color: #0d47a1;
}

.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field.is-hidden {
  display: none;
}

.is-hidden {
  display: none !important;
}

.input-select {
  display: block;
}

.select-mobile {
  display: none;
}

.select-search-mobile {
  display: none;
}

.field input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
}

.field select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: #fff;
}

.auth-body {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: linear-gradient(120deg, #e9f2f7, #f6f9fc);
}

.auth-main {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.login-card h1 {
  margin-top: 0;
}

.error {
  margin: 12px 0;
  color: #b42318;
  font-size: 13px;
}

.btn-primary {
  margin-top: 12px;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.invoice-open-btn {
  margin-top: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f7fbff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.invoice-open-btn:hover {
  background: #e9f3fb;
}

.invoice-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(11, 28, 44, 0.55);
  z-index: 1001;
}

.invoice-overlay.is-open {
  display: flex;
}

.invoice-modal {
  width: min(980px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 18px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}

.invoice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.invoice-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.invoice-side-logo {
  width: 140px;
  height: auto;
  display: block;
}

.invoice-close-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.invoice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.invoice-grid-wide {
  margin-top: 6px;
}

.invoice-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #fbfdff;
}

.invoice-block h4 {
  margin: 0 0 8px 0;
}

.invoice-block-full {
  grid-column: 1 / -1;
}

.invoice-pre {
  margin: 0;
  white-space: pre-line;
  font-family: "Segoe UI", "Tahoma", "Arial", sans-serif;
  font-size: 13px;
}

.invoice-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
  position: sticky;
  bottom: 0;
  background: #fff;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.invoice-approval {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 4px 0;
}

.invoice-stamp-wrap,
.invoice-signature-wrap {
  flex: 1;
  display: flex;
}

.invoice-stamp-wrap {
  justify-content: flex-start;
}

.invoice-signature-wrap {
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
}

.invoice-signature-wrap::before {
  content: "Signature:";
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.invoice-stamp {
  width: 160px;
  height: auto;
  display: block;
}

.invoice-signature {
  width: 180px;
  height: auto;
  display: block;
}

.invoice-download-btn {
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 1100px) {
  .header-right {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .calc-row {
    grid-template-columns: repeat(2, 70px);
  }
}

@media (max-width: 900px) {
  .app-header {
    padding: 12px 16px;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    padding-bottom: 6px;
  }

  .calc-mini {
    display: none;
  }
}

@media (max-width: 800px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 12px;
  }

  .page-header-actions {
    align-items: flex-start;
  }

  .header-right {
    width: 100%;
    align-items: flex-start;
    gap: 10px;
  }

  .input-select {
    display: none;
  }

  .select-search-mobile {
    display: block;
  }

  .select-mobile {
    display: block;
  }

  .calc-mini {
    width: 100%;
  }

  .app-main {
    padding: 20px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .invoice-grid {
    grid-template-columns: 1fr;
  }

  .invoice-modal {
    width: 100%;
    max-height: 100dvh;
    min-height: 100dvh;
    border-radius: 0;
    border: none;
    padding: 12px;
  }

  .invoice-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .invoice-header-right {
    width: 100%;
    justify-content: space-between;
  }

  .invoice-side-logo {
    width: 120px;
  }

  .invoice-overlay {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }

  .invoice-modal .field input,
  .invoice-modal .field select {
    font-size: 16px;
  }

  .invoice-download-btn {
    width: 100%;
  }

  .invoice-approval {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .invoice-stamp-wrap,
  .invoice-signature-wrap {
    justify-content: center;
  }

  .invoice-stamp,
  .invoice-signature {
    width: min(180px, 60vw);
  }
}

@media (max-width: 700px) {
  .table-stack thead {
    display: none;
  }

  .table-stack tbody tr {
    display: block;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
  }

  .table-stack tbody td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px dashed var(--border);
    padding: 8px 0;
  }

  .table-stack tbody td:last-child {
    border-bottom: none;
  }

  .table-stack tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 600;
  }

  .table-stack .car-cell {
    justify-content: flex-start;
  }

  .table-stack .car-cell::before {
    content: "Car";
  }

  .gallery-modal {
    padding: 12px;
  }

  .gallery-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .gallery-nav {
    justify-content: space-between;
  }
}


/* ===== Header icon group (like screenshot) ===== */
.hdr-icons {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 10px;
    border-left: 1px solid rgba(0,0,0,.08);
    margin-left: 12px;
}

.hdr-icon {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7f8aa3; /* soft gray-blue */
    text-decoration: none;
    transition: background .12s ease, color .12s ease;
}

    .hdr-icon:hover {
        background: rgba(127, 138, 163, 0.10);
        color: #2d3a55;
    }

.hdr-svg {
    width: 22px;
    height: 22px;
}

/* Red numeric badge */
.hdr-badge {
    position: absolute;
    top: -4px; 
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: #ff3b30;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

/* ===== Compact Profile Dropdown ===== */

.profile {
    position: relative;
    margin-left: 10px;
}

/* Button (header area) */
.profile-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: transparent;
    border: 0;
    padding: 4px 6px;
    cursor: pointer;
}

/* Name area */
.profile-text {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.1;
}

.profile-name {
    font-weight: 700;
    font-size: 16px;
    color: #0f172a;
}

.profile-role {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #8a94ad;
    font-weight: 600;
    font-size: 13px;
}

.profile-caret {
    width: 14px;
    height: 14px;
}

/* Avatar */
.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    object-fit: cover;
}

.profile-online {
    position: absolute;
    right: 2px;
    bottom: 2px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #22c55e;
    border: 2px solid #fff;
}

/* Dropdown */
.profile-menu {
    position: absolute;
    right: 0;
    top: 48px; 
    width: 260px;
    background: #fff;
    border: 1px solid rgba(15,23,42,.08);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(15,23,42,.12);
    padding: 10px;
    display: none;
    z-index: 1000;
}

    .profile-menu.open {
        display: block;
    }

/* Header inside dropdown */
.profile-menu-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 4px 8px 4px;
}

.profile-menu-avatar {
    width: 42px; 
    height: 42px;
    border-radius: 999px;
    object-fit: cover;
}

.profile-menu-name {
    font-weight: 700;
    font-size: 16px; 
    color: #0f172a;
}

.profile-menu-email {
    font-size: 13px; 
    color: #8a94ad;
    font-weight: 500;
}

/* Divider */
.profile-menu-sep {
    height: 1px;
    background: rgba(15,23,42,.08);
    margin: 8px 0;
}

/* Menu Items */
.profile-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 8px;
    border-radius: 8px;
    text-decoration: none;
    color: #8a94ad;
    font-size: 14px; 
    font-weight: 600;
}

    .profile-item:hover {
        background: rgba(127,138,163,.10);
        color: #2d3a55;
    }

.pi-ico {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .pi-ico svg {
        width: 18px;
        height: 18px;
    }

/* Logout */
.profile-logout {
    color: #ef4444;
}

    .profile-logout:hover {
        background: rgba(239,68,68,.08);
    }

    .profile-logout .pi-ico {
        color: #ef4444;
    }