@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --brand-blue: #0072CE;
  --brand-blue-dark: #0057A3;
  --brand-blue-deep: #0B3A66;
  --brand-red: #E31C24;
  --brand-red-dark: #C4161D;
  --ink: #0F2744;
  --muted: #5B6B7C;
  --line: #D7E4F2;
  --surface: #EEF4FB;
  --card: #FFFFFF;
  --shadow: 0 12px 32px rgba(11, 58, 102, .08);
  --shadow-lg: 0 18px 48px rgba(0, 87, 163, .16);
  --radius: 18px;
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

img, video, canvas, svg {
  max-width: 100%;
  height: auto;
}

.table-responsive {
  -webkit-overflow-scrolling: touch;
}

.navbar {
  padding-top: max(.4rem, env(safe-area-inset-top));
}

.navbar .container-fluid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.navbar-brand {
  white-space: nowrap;
  font-size: 1rem !important;
}

.navbar .nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.navbar .nav a {
  display: inline-block;
  padding: 6px 0;
  min-height: 36px;
}

.form-control, .form-select, .btn, input, select, textarea {
  font-size: 16px !important;
}

.btn, .more-btn {
  min-height: 40px;
}

.grid-mobile { display: none; }

/* ========== After-login shell ========== */
.app-shell {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 420px at 8% -10%, rgba(0, 114, 206, .16), transparent 60%),
    radial-gradient(900px 380px at 100% 0%, rgba(227, 28, 36, .10), transparent 55%),
    linear-gradient(180deg, #f7fbff 0%, var(--surface) 38%, #eaf2fa 100%);
  min-height: 100vh;
}

.app-shell h1, .app-shell h2, .app-shell h3, .app-shell h4, .app-shell h5 {
  font-family: var(--font);
  color: var(--ink);
  letter-spacing: -.03em;
}

.app-shell > .container-fluid {
  padding-left: 0;
  padding-right: 0;
}

.app-shell .app-main,
.app-shell .container.app-main {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.app-shell .container.app-main {
  max-width: 1240px;
}

/* Header */
.app-shell .navbar.app-header,
.app-shell .navbar.navbar-dark.bg-primary {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: linear-gradient(135deg, #0072CE 0%, #0060B8 55%, #0B3A66 100%) !important;
  box-shadow: 0 10px 28px rgba(11, 58, 102, .22), inset 0 -3px 0 var(--brand-red);
  padding: max(10px, env(safe-area-inset-top)) 18px 12px;
  min-height: 72px;
}

.app-shell .app-header-inner,
.app-shell .navbar .container-fluid {
  max-width: 1240px;
  margin: 0 auto;
  width: 100%;
}

.app-shell .navbar-brand,
.app-shell .app-brand {
  display: flex !important;
  align-items: center;
  gap: 12px;
  float: none !important;
  height: auto !important;
  padding: 0 !important;
  line-height: 1.15 !important;
  white-space: nowrap;
  text-decoration: none !important;
}

.app-shell .app-brand-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 13px;
  background: #fff;
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
}

.app-shell .navbar-nav {
  float: none !important;
  margin: 0 !important;
}

.app-shell .navbar-nav > li {
  float: none !important;
}

.app-shell .nav > li > a:hover,
.app-shell .nav > li > a:focus {
  background-color: rgba(255,255,255,.22);
}

.app-shell .navbar-brand:hover,
.app-shell .navbar-brand:focus {
  color: #fff !important;
}

.app-shell .app-brand-mark img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  background: #fff;
}

.app-shell .app-brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-shell .app-brand-name {
  font-size: 1.02rem;
  font-weight: 800;
  color: #fff !important;
  letter-spacing: -.02em;
}

.app-shell .app-brand-tag {
  font-size: .68rem;
  font-weight: 600;
  color: rgba(255,255,255,.78) !important;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.app-shell .app-nav {
  align-items: center;
  gap: 8px !important;
}

.app-shell .app-nav > li { list-style: none; }

.app-shell .app-nav-link,
.app-shell .navbar .nav a {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  min-height: 38px !important;
  padding: 6px 14px !important;
  border-radius: 999px;
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 600;
  font-size: .86rem !important;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.16);
  transition: background .2s ease, transform .2s ease;
}

.app-shell .app-nav-link:hover,
.app-shell .navbar .nav a:hover,
.app-shell .navbar-nav > li > a:hover,
.app-shell .navbar-nav > li > a:focus {
  background: rgba(255,255,255,.22) !important;
  transform: translateY(-1px);
}

.app-shell .app-nav-logout {
  background: var(--brand-red) !important;
  border-color: transparent !important;
}

.app-shell .app-nav-logout:hover {
  background: var(--brand-red-dark) !important;
}

.app-shell .app-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 7px 14px 7px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--brand-blue);
  text-decoration: none;
  font-weight: 700;
  font-size: .88rem;
  box-shadow: 0 4px 12px rgba(11, 58, 102, .06);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.app-shell .app-back:hover {
  color: var(--brand-blue-dark);
  background: #e8f3fc;
  transform: translateX(-2px);
  box-shadow: 0 8px 16px rgba(0, 114, 206, .12);
}

.app-shell .app-back-icon {
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 400;
}

/* Page headings */
.app-shell .page-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 6px 0 22px;
  padding: 22px 24px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.92), rgba(255,255,255,.78)),
    linear-gradient(135deg, rgba(0,114,206,.08), rgba(227,28,36,.06));
  border: 1px solid rgba(215, 228, 242, .9);
  border-radius: 22px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.app-shell .page-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -50px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(227, 28, 36, .16), transparent 70%);
  pointer-events: none;
}

.app-shell .page-kicker {
  margin: 0 0 4px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--brand-blue);
}

.app-shell .page-hero h2,
.app-shell h2 {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0 0 4px;
}

.app-shell .page-sub,
.app-shell .page-hero .text-muted,
.app-shell p.text-muted {
  color: var(--muted) !important;
  margin: 0;
  font-weight: 500;
}

.app-shell hr { display: none; }

.app-shell .page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

/* Buttons */
.app-shell .btn {
  border-radius: 12px;
  font-weight: 700;
  letter-spacing: -.01em;
  padding: 8px 16px;
  box-shadow: none;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.app-shell .btn-primary {
  background: linear-gradient(180deg, #1a86de 0%, var(--brand-blue) 100%) !important;
  border: 0 !important;
  box-shadow: 0 8px 18px rgba(0, 114, 206, .28);
}

.app-shell .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(0, 87, 163, .32);
}

.app-shell .btn-outline-secondary {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

.app-shell .btn-sm {
  border-radius: 10px;
  padding: 6px 12px;
}

/* Forms */
.app-shell .form-control,
.app-shell .form-select,
.app-shell input.form-control,
.app-shell select.form-select,
.app-shell textarea.form-control {
  border-radius: 12px !important;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-height: 44px;
  box-shadow: 0 1px 2px rgba(15, 39, 68, .04);
}

.app-shell .form-label {
  font-weight: 700;
  color: var(--ink);
  font-size: .86rem;
}

/* Cards / grids */
.app-shell .grid-card,
.app-shell .form-card,
.app-shell .cal-wrap,
.app-shell .att-card {
  background: var(--card);
  border: 1px solid rgba(215, 228, 242, .95);
  border-radius: 20px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.app-shell .grid-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eef3f8;
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.app-shell .grid-toolbar h4 {
  margin: 0;
  font-weight: 800;
  color: var(--ink);
}

.app-shell .count-pill {
  background: #e7f2fc;
  color: var(--brand-blue);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: .8rem;
  font-weight: 800;
}

/* Tables */
.app-shell table.table,
.app-shell .sms-grid {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0;
  margin: 0;
  background: #fff;
}

.app-shell table.table tr.bg-danger th,
.app-shell .table .bg-danger th,
.app-shell .sms-grid thead th {
  background: linear-gradient(135deg, #0072CE 0%, #0057A3 100%) !important;
  color: #fff !important;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .5px;
  text-transform: uppercase;
  padding: 14px 16px;
  border: none !important;
  white-space: nowrap;
  box-shadow: inset 0 -3px 0 var(--brand-red);
}

.app-shell table.table td,
.app-shell .sms-grid tbody td {
  padding: 14px 16px;
  border-color: #eef3f8 !important;
  vertical-align: middle;
  color: #334155;
  background: #fff;
}

.app-shell table.table tbody tr:nth-child(even) td,
.app-shell .sms-grid tbody tr:nth-child(even) td { background: #f7fbff; }

.app-shell table.table tbody tr:hover td,
.app-shell .sms-grid tbody tr:hover td { background: #eaf4fd; }

.app-shell .more-btn {
  min-width: 44px;
  height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--brand-blue);
  background: var(--brand-blue);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.app-shell .more-btn:hover,
.app-shell .more-btn.open {
  background: var(--brand-blue-dark);
  color: #fff;
}

/* Admin tiles */
.app-shell .admin-tile {
  display: block;
  background: #fff;
  border: 1px solid #e3eef8;
  border-radius: 20px;
  padding: 26px 18px 22px;
  text-align: left;
  text-decoration: none;
  color: var(--ink);
  height: 100%;
  position: relative;
  overflow: hidden;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
  box-shadow: var(--shadow);
}

.app-shell .admin-tile::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--brand-blue), var(--brand-red));
}

.app-shell .admin-tile:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  color: var(--brand-blue-deep);
  border-color: #c5def4;
}

.app-shell .admin-tile i {
  width: 52px;
  height: 52px;
  margin: 0 0 14px !important;
  border-radius: 16px;
  background: linear-gradient(180deg, #e8f3fc, #d7ebfa);
  color: var(--brand-blue);
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem !important;
}

.app-shell .admin-tile h5 {
  font-weight: 800;
  margin: 0;
  font-size: 1.02rem;
}

.app-shell .admin-tile p {
  color: var(--muted);
  font-size: .84rem;
  margin: 8px 0 0;
  line-height: 1.4;
}

#tile-jobpost .admin-tile i { background: #e8f3fc; color: #0072CE; }
#tile-gallerypost .admin-tile i { background: #fde8ea; color: #E31C24; }
#tile-empcode .admin-tile i { background: #eaf4ff; color: #0057A3; }
#tile-usertable .admin-tile i { background: #e8f3fc; color: #0072CE; }
#tile-adduser .admin-tile i { background: #fde8ea; color: #E31C24; }
#tile-enquiry .admin-tile i { background: #eaf4ff; color: #0057A3; }
#tile-attendance .admin-tile i { background: #e8f3fc; color: #0072CE; }
#tile-client .admin-tile i { background: #fde8ea; color: #E31C24; }
#tile-bill .admin-tile i { background: #eaf4ff; color: #0057A3; }
#tile-viewjob .admin-tile i { background: #e8f3fc; color: #0072CE; }

/* Gallery */
.app-shell .gallery-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  height: 100%;
}

.app-shell .gallery-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 0;
}

/* Modals */
.app-shell .modal-content {
  border: none;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.app-shell .modal-footer {
  border-top: 1px solid #eef3f8;
  background: #f8fbff;
}

.app-shell #userFormModal .modal-header,
.app-shell #billFormModal .modal-header,
.app-shell #enqFormModal .modal-header,
.app-shell #clientFormModal .modal-header,
.app-shell #jobFormModal .modal-header,
.app-shell #galleryFormModal .modal-header,
.app-shell #empCodeFormModal .modal-header {
  background: linear-gradient(135deg, #0072CE 0%, #0057A3 100%) !important;
  border-bottom: 3px solid var(--brand-red);
}

/* Attendance */
.app-shell .month-bar {
  background: linear-gradient(135deg, #0072CE 0%, #0B3A66 100%) !important;
  box-shadow: inset 0 -3px 0 var(--brand-red);
}

.app-shell .cal-table th {
  background: var(--brand-blue) !important;
  color: #fff !important;
}

.app-shell .accordion-button:not(.collapsed) {
  background: #e8f3fc !important;
  color: var(--brand-blue-dark) !important;
  box-shadow: none;
}

.app-shell .accordion-button:focus {
  box-shadow: 0 0 0 .2rem rgba(0, 114, 206, .18);
}

.app-shell #accEmployeeBtn:not(.collapsed) { color: var(--brand-red) !important; }

/* Enquiry cards */
.app-shell .enq-list { background: #f6faff; }
.app-shell .enq-card {
  border-color: var(--line);
  box-shadow: var(--shadow);
}
.app-shell .enq-avatar-fallback {
  background: #e8f3fc;
  color: var(--brand-blue);
}
.app-shell .enq-card .more-btn:hover,
.app-shell .enq-card .more-btn.open {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
}

/* Mobile cards already used by JS */
.app-card {
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

.app-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.app-card-main { min-width: 0; flex: 1; }

.app-card-title {
  font-weight: 700;
  font-size: .98rem;
  color: #0f172a;
  margin: 0;
  line-height: 1.3;
  word-break: break-word;
}

.app-card-sub {
  color: #64748b;
  font-size: .82rem;
  margin-top: 3px;
  line-height: 1.35;
}

.app-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
  font-size: .8rem;
  color: #64748b;
}

.app-card-meta b { color: #0f172a; font-weight: 700; }

.app-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.app-card-actions .btn {
  border-radius: 10px;
  font-size: .8rem !important;
  padding: 6px 10px;
  min-height: 36px;
}

.app-card .more-btn {
  flex: 0 0 auto;
  min-width: 40px;
  height: 40px;
  border-radius: 12px;
}

.app-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  object-fit: cover;
  background: #eef2ff;
  flex: 0 0 auto;
}

.app-avatar-fallback {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #e8f1ff;
  color: #0072CE;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex: 0 0 auto;
}

@media (max-width: 767.98px) {
  .app-shell {
    background: #eef4fb;
  }

  .app-shell .navbar.app-header,
  .app-shell .navbar.navbar-dark.bg-primary {
    min-height: 64px;
    padding: max(8px, env(safe-area-inset-top)) 12px 10px;
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
  }

  .app-shell .app-brand-tag { display: none; }
  .app-shell .app-brand-name { font-size: .92rem; }
  .app-shell .app-brand-mark { width: 38px; height: 38px; flex-basis: 38px; border-radius: 11px; }
  .app-shell .app-brand-mark img { width: 30px; height: 30px; }

  .app-shell .app-nav-link,
  .app-shell .navbar .nav a {
    min-height: 34px !important;
    padding: 5px 11px !important;
    font-size: .78rem !important;
  }

  .app-shell .app-main,
  .app-shell .container.app-main {
    width: calc(100% - 20px);
    padding: 16px 0 40px;
  }

  .app-shell .page-hero {
    padding: 16px;
    border-radius: 18px;
    margin-bottom: 14px;
  }

  .app-shell h2,
  .app-shell .page-hero h2 {
    font-size: 1.38rem !important;
  }

  .app-shell .grid-card,
  .app-shell .form-card {
    border: none;
    border-radius: 18px;
  }

  .app-shell .grid-toolbar {
    padding: 12px 12px 10px;
    background: transparent;
    border-bottom: none;
  }

  .app-shell .page-hero .btn {
    width: 100%;
  }

  .app-shell .admin-tile {
    padding: 16px 12px !important;
    border-radius: 18px !important;
    text-align: center;
  }

  .app-shell .admin-tile::before { display: none; }

  .app-shell .admin-tile i {
    width: 46px;
    height: 46px;
    margin: 0 auto 8px !important;
    border-radius: 13px;
  }

  .app-shell .admin-tile h5 { font-size: .88rem !important; }
  .app-shell .admin-tile p { display: none; }

  .app-shell .admin-tile:hover,
  .app-shell .admin-tile:active {
    transform: scale(.98);
  }

  .app-shell .grid-desktop { display: none !important; }

  .app-shell .grid-mobile {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 12px 20px;
  }

  .app-shell .grid-toolbar .form-control,
  .app-shell .grid-toolbar .form-select {
    width: 100% !important;
    min-width: 0;
  }

  .app-shell .page-toolbar .btn,
  .app-shell .grid-toolbar .btn {
    width: 100%;
  }

  .app-shell .cal-day { height: 54px !important; padding: 4px !important; }
  .app-shell .cal-day .status-label { font-size: .65rem !important; margin-top: 2px !important; }
  .app-shell .cal-table th { font-size: .72rem; padding: 6px 0 !important; }

  .table-responsive:has(.grid-mobile) {
    overflow: visible;
  }

  .app-shell .modal-dialog { margin: 10px; }
}

@media (max-width: 575.98px) {
  .navbar-brand { font-size: .92rem !important; }
}

@media (min-width: 768px) {
  .app-shell .grid-mobile { display: none !important; }
  .app-shell .grid-desktop { display: block; }
}

.app-shell .app-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 16px 16px;
  border-top: 1px solid #eef3f8;
  background: linear-gradient(180deg, #fff, #f8fbff);
}

.app-shell .app-pager-btn {
  min-width: 92px;
}

.app-shell .app-pager-info {
  font-size: .86rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
  flex: 1 1 auto;
}

@media (max-width: 767.98px) {
  .app-shell .app-pager {
    padding: 12px;
    background: #fff;
  }
  .app-shell .app-pager-btn {
    min-width: 84px;
    width: auto !important;
  }
}

@media (display-mode: standalone) {
  body { user-select: none; }
  input, textarea, select { user-select: text; }
}

.app-footer {
  display: block !important;
  width: 100%;
  text-align: center;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: #fff;
  background: #E31C24;
  border-top: 0;
  padding: 12px 16px;
  margin: 0;
  z-index: 1040;
}
.app-footer .ft-since { display: none; }
@media (max-width: 991.98px) {
  .app-footer .ft-from { display: none; }
  .app-footer .ft-since { display: inline; }
}

@media (max-width: 991.98px) {
  .app-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    box-shadow: 0 -6px 18px rgba(11, 58, 102, .06);
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }
  body.has-app-footer,
  body {
    padding-bottom: calc(56px + env(safe-area-inset-bottom));
  }
  .app-shell .app-main,
  .app-shell .container.app-main {
    padding-bottom: 72px;
  }
}
