/* Pureology CRM - subtle blue theme */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: #f4f7fb; color: #1f2937; font-size: 14px; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #e0ecfb 0%, #c7dcf5 100%); }
.login-box { background: #fff; padding: 40px 36px; border-radius: 10px; box-shadow: 0 10px 40px rgba(37,99,235,0.15); width: 380px; }
.login-box h1 { color: #1d4ed8; margin-bottom: 6px; font-size: 26px; }
.login-box p.sub { color: #6b7280; margin-bottom: 24px; font-size: 13px; }

/* Layout (Salesforce-like) */
.layout { display: flex; min-height: 100vh; background: #f4f6f9; }
.sidebar { width: 264px; background: linear-gradient(180deg, #032d60 0%, #0b4f9c 100%); color: #fff; padding: 0; position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; box-shadow: 6px 0 20px rgba(1,26,56,0.28); }
.sidebar .brand { padding: 20px 18px; font-size: 17px; font-weight: 700; border-bottom: 1px solid rgba(255,255,255,0.16); color: #fff; }
.sidebar .brand small { display: block; font-size: 11px; font-weight: 500; color: #c4ddff; margin-top: 3px; letter-spacing: .02em; }
.brand-top { display: flex; align-items: center; gap: 10px; }
.app-launcher { width: 28px; height: 28px; border: 1px solid rgba(255,255,255,0.3); border-radius: 7px; background: rgba(255,255,255,0.12); display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 5px; cursor: pointer; }
.app-launcher span { width: 100%; height: 100%; background: #fff; border-radius: 2px; opacity: .92; }
.app-launcher:hover { background: rgba(255,255,255,0.22); }
.sidebar nav { padding: 12px 10px 20px; }
.sidebar nav > a { display: block; color: #eef4ff; padding: 10px 12px; margin: 0 2px 10px; font-size: 13.5px; border-radius: 8px; border-left: 0; background: rgba(255,255,255,0.12); font-weight: 500; }
.sidebar nav > a:hover, .sidebar nav > a.active { background: #ffffff; color: #032d60; text-decoration: none; }
.menu-section { margin-bottom: 10px; border-radius: 10px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.14); overflow: hidden; }
.menu-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; background: transparent; border: 0; color: #dcecff; text-transform: uppercase; letter-spacing: .8px; font-size: 11px; font-weight: 700; padding: 10px 12px; cursor: pointer; }
.menu-toggle:hover { background: rgba(255,255,255,0.14); color: #fff; }
.menu-toggle .arrow { transition: transform .2s ease; font-size: 12px; opacity: .95; }
.menu-section.open .menu-toggle .arrow { transform: rotate(180deg); }
.menu-items { display: none; padding: 0 8px 10px; }
.menu-section.open .menu-items { display: block; }
.menu-items a { display: block; color: #ecf4ff; padding: 8px 10px; font-size: 13px; border-radius: 7px; margin-top: 4px; border-left: 0; }
.menu-items a:hover, .menu-items a.active { background: #ffffff; color: #032d60; text-decoration: none; font-weight: 600; }

.main { margin-left: 264px; flex: 1; }
body.sidebar-collapsed .sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .main { margin-left: 0; }
.utility-bar { background: #edf4ff; border-bottom: 1px solid #d6e5fb; color: #0b4f9c; font-size: 12px; padding: 6px 20px; display: flex; justify-content: space-between; align-items: center; }
.utility-left { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.utility-left .dot { width: 7px; height: 7px; border-radius: 999px; background: #2e844a; box-shadow: 0 0 0 3px rgba(46,132,74,0.14); }
.topbar { background: #ffffff; padding: 12px 22px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #dde3ea; box-shadow: 0 2px 6px rgba(17,26,39,0.06); }
.topbar h2 { font-size: 18px; color: #032d60; font-weight: 700; letter-spacing: .01em; }
.topbar .user { color: #5f6b7a; font-size: 13px; }
.topbar .user .role { background: #edf4ff; color: #0b5cab; padding: 2px 8px; border-radius: 999px; font-size: 10px; margin: 0 8px; text-transform: uppercase; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.density-btn { border: 1px solid #cfd8e3; background: #fff; color: #032d60; border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.density-btn:hover { background: #f2f6fb; }

.notif-wrap { position: relative; }
.notif-btn { border: 1px solid #e2e8f0; background: #fff; border-radius: 8px; padding: 6px 9px; cursor: pointer; position: relative; box-shadow: 0 1px 2px rgba(15,23,42,0.05); }
.notif-btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.notif-icon { font-size: 14px; line-height: 1; display: inline-block; }
.notif-count { position: absolute; top: -5px; right: -5px; background: #ef4444; color: #fff; border-radius: 999px; font-size: 9px; padding: 1px 5px; font-weight: 700; }
.notif-dropdown { position: absolute; right: 0; top: 38px; width: 290px; max-height: 300px; overflow: auto; background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 12px 26px rgba(2,6,23,0.14); z-index: 1000; }
.notif-head { padding: 8px 10px; font-weight: 700; font-size: 12px; color: #1e3a8a; border-bottom: 1px solid #eef2f7; }
.notif-empty { padding: 11px 10px; color: #6b7280; font-size: 12px; }
.notif-item { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; transition: background .15s ease; }
.notif-item:hover { background: #f8fafc; }
.notif-item:last-child { border-bottom: none; }
.notif-title { font-size: 10px; color: #64748b; margin-bottom: 2px; letter-spacing: .01em; }
.notif-msg { font-size: 11.5px; color: #0f172a; line-height: 1.3; word-break: break-word; }

.content { padding: 22px; max-width: 1460px; margin: 0 auto; }

/* Cards & Tables */
.card { background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 2px 8px rgba(15,23,42,0.07); margin-bottom: 18px; border: 1px solid #e3e8ef; }
.card h3 { font-size: 15px; color: #032d60; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid #e5eaf0; letter-spacing: .01em; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; padding: 18px; border-radius: 8px; border-left: 4px solid #3b82f6; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.stat .label { font-size: 12px; color: #6b7280; text-transform: uppercase; letter-spacing: .5px; }
.stat .value { font-size: 22px; color: #1e3a8a; font-weight: 600; margin-top: 6px; }
.stat.warn { border-left-color: #f59e0b; }
.stat.green { border-left-color: #10b981; }
.stat.red { border-left-color: #ef4444; }

table { width: 100%; border-collapse: collapse; background: #fff; }
table th, table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid #eef2f7; font-size: 13px; vertical-align: middle; }
.card table { font-size: 13px; }
.card { overflow-x: auto; }
table th { background: #f7f9fb; color: #032d60; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .45px; }
table tr:hover { background: #f7fbff; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* Forms */
.form-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; margin-bottom: 14px; }
.form-row > div { min-width: 0; }
@media (max-width: 900px) { .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .form-row { grid-template-columns: 1fr; } }
label { display: block; font-size: 12px; color: #4b5563; margin-bottom: 5px; font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #c9d3de; border-radius: 6px; font-size: 13.5px; background: #fff; font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #0176d3; box-shadow: 0 0 0 3px rgba(1,118,211,0.16); }
textarea { min-height: 70px; resize: vertical; }

.btn { display: inline-block; padding: 9px 18px; background: #0176d3; color: #fff; border: none; border-radius: 6px; cursor: pointer; font-size: 13.5px; font-weight: 600; text-decoration: none; }
.btn:visited { color: #fff; }
.btn:hover { background: #025cb1; text-decoration: none; color: #fff; }
.btn.secondary { background: #6b7280; color: #fff; }
.btn.secondary:hover { background: #4b5563; color: #fff; }
.btn.danger { background: #ef4444; }
.btn.success { background: #10b981; }
.btn.sm { padding: 5px 11px; font-size: 12px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.badge.green { background: #d1fae5; color: #065f46; }
.badge.yellow { background: #fef3c7; color: #92400e; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.gray { background: #e5e7eb; color: #374151; }

.flash { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 13.5px; }
.flash.success { background: #d1fae5; color: #065f46; border-left: 4px solid #10b981; }
.flash.error { background: #fee2e2; color: #991b1b; border-left: 4px solid #ef4444; }

.page-head { display:flex; justify-content:space-between; align-items:center; margin-bottom: 16px; }
.page-head h2 { font-size: 20px; color: #032d60; font-weight: 700; }

/* Density modes */
body[data-density="compact"] .content { padding: 14px; }
body[data-density="compact"] .card { padding: 12px; border-radius: 10px; }
body[data-density="compact"] .form-row { gap: 10px 12px; margin-bottom: 10px; }
body[data-density="compact"] input[type=text],
body[data-density="compact"] input[type=email],
body[data-density="compact"] input[type=password],
body[data-density="compact"] input[type=number],
body[data-density="compact"] input[type=date],
body[data-density="compact"] input[type=file],
body[data-density="compact"] select,
body[data-density="compact"] textarea { padding: 7px 9px; font-size: 12.5px; }
body[data-density="compact"] table th,
body[data-density="compact"] table td { padding: 6px 9px; font-size: 12px; }
body[data-density="compact"] .btn { padding: 7px 12px; font-size: 12.5px; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; }

/* Hamburger + mobile sidebar overlay */
.hamburger { display: none; background: transparent; border: 0; font-size: 22px; cursor: pointer; padding: 4px 10px; color: #032d60; margin-right: 8px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 998; }
.sidebar-overlay.open { display: block; }
/* Mobile breakpoints */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; z-index: 999; box-shadow: 2px 0 12px rgba(0,0,0,0.2); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0 !important; }
  .hamburger { display: inline-block; }
  .topbar { padding: 10px 14px; }
  .utility-bar { padding: 6px 12px; font-size: 11px; }
  .topbar h2 { font-size: 15px; flex: 1; }
  .topbar .user { font-size: 12px; }
  .topbar .user .user-name { display: none; }
  .topbar .user .role { font-size: 10px; padding: 1px 6px; }
  .notif-dropdown { width: 88vw; right: -8px; max-width: 320px; }
  .content { padding: 12px; }
  .card { padding: 14px; border-radius: 6px; }
  .stats { gap: 8px; }
  .stat { padding: 12px; }
  .stat .value { font-size: 18px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-head h2 { font-size: 17px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar input, .toolbar select { width: 100% !important; }

  /* Tables: horizontal scroll within card */
  .card { overflow-x: auto; }
  table { min-width: 560px; }
  table th, table td { padding: 8px 10px; font-size: 12.5px; }

  /* Buttons full-width on small */
  .page-head .btn { width: 100%; text-align: center; }
}

@media (max-width: 560px) {
  .login-box { width: 92%; padding: 28px 22px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .topbar h2 { font-size: 14px; }
  .topbar .user .role { display: none; }
}

/* Print — hide chrome, show only document content, preserve colors */
@media print {
  /* Preserve colors / backgrounds for ALL elements */
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  .sidebar, .topbar, .page-head a, .btn, .toolbar, nav, .flash, .hamburger, .sidebar-overlay { display: none !important; }
  .layout { display: block !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; max-width: none !important; margin: 0 !important; }
  .card { box-shadow: none !important; padding: 12px !important; margin: 0 0 12px 0 !important; page-break-inside: avoid; }
  body { font-size: 12px; }
  /* Keep table headers + badges + payslip headers in color */
  table th, .badge, .stat, .doc-page .header-band, .payslip .head, .payslip h3, .payslip .net, .payslip .total-row td {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  a { text-decoration: none !important; }
  .no-print { display: none !important; }
}

/* Force color preservation as a global rule that some print engines respect outside @media print */
html { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
