/* =====================================================
   Kelani Cables PLC — SPO Claim System
   Shared stylesheet — brand colors from logo:
   Blue #2b3990  Green #00a651
   ===================================================== */

:root{
  --blue: #2b3990;
  --blue-dark: #1e2766;
  --green: #00a651;
  --green-dark: #008a44;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e9f2;
  --danger: #d64545;
  --radius: 12px;
  --shadow: 0 4px 18px rgba(43,57,144,0.08);
}

*{box-sizing:border-box;}
body{
  margin:0;
  font-family: 'Segoe UI', -apple-system, Roboto, Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
}
a{color:var(--blue); text-decoration:none;}
a:hover{text-decoration:underline;}

/* ---------- Layout ---------- */
.app-shell{display:flex; min-height:100vh;}

.sidebar{
  width:250px;
  background:linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%);
  color:#fff;
  display:flex;
  flex-direction:column;
  flex-shrink:0;
}
.sidebar .brand{
  display:flex; align-items:center; gap:10px;
  padding:22px 20px;
  border-bottom:1px solid rgba(255,255,255,0.12);
}
.sidebar .brand img{height:34px; background:#fff; border-radius:6px; padding:3px;}
.sidebar .brand span{font-weight:600; font-size:14px; line-height:1.3;}
.sidebar nav{flex:1; padding:14px 0;}
.sidebar nav a{
  display:flex; align-items:center; gap:10px;
  color:rgba(255,255,255,0.85);
  padding:12px 22px;
  font-size:14.5px;
  border-left:3px solid transparent;
}
.sidebar nav a:hover{background:rgba(255,255,255,0.08); text-decoration:none;}
.sidebar nav a.active{
  background:rgba(255,255,255,0.12);
  border-left:3px solid var(--green);
  color:#fff;
  font-weight:600;
}
.sidebar .user-box{
  padding:16px 20px;
  border-top:1px solid rgba(255,255,255,0.12);
  font-size:13px;
}
.sidebar .user-box .role-badge{
  display:inline-block;
  background:var(--green);
  color:#fff;
  font-size:11px;
  padding:2px 8px;
  border-radius:20px;
  margin-top:4px;
  text-transform:uppercase;
  letter-spacing:.4px;
}
.sidebar .logout-link{
  display:block; margin-top:10px; color:#ffd3d3; font-size:13px;
}

.main{flex:1; padding:28px 32px; min-width:0;}
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  margin-bottom:24px;
}
.topbar h1{font-size:22px; margin:0; color:var(--blue);}
.topbar p{margin:2px 0 0; color:var(--text-muted); font-size:13.5px;}

/* ---------- Cards ---------- */
.card{
  background:var(--card);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:24px;
  margin-bottom:22px;
  border:1px solid var(--border);
}
.card h2{font-size:16px; margin:0 0 18px; color:var(--blue-dark);}

.grid{display:grid; gap:16px;}
.grid-2{grid-template-columns:repeat(2,1fr);}
.grid-3{grid-template-columns:repeat(3,1fr);}
.grid-4{grid-template-columns:repeat(4,1fr);}
@media(max-width:900px){.grid-2,.grid-3,.grid-4{grid-template-columns:1fr 1fr;}}
@media(max-width:600px){.grid-2,.grid-3,.grid-4{grid-template-columns:1fr;}}

/* ---------- Stat tiles ---------- */
.stat-tile{
  background:var(--card);
  border-radius:var(--radius);
  padding:18px 20px;
  box-shadow:var(--shadow);
  border:1px solid var(--border);
  border-top:4px solid var(--green);
}
.stat-tile .label{font-size:12.5px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.4px;}
.stat-tile .value{font-size:26px; font-weight:700; color:var(--blue); margin-top:6px;}

/* ---------- Forms ---------- */
label{
  display:block; font-size:12.5px; font-weight:600; color:var(--text-muted);
  margin-bottom:5px; text-transform:uppercase; letter-spacing:.3px;
}
.field{margin-bottom:14px;}
input[type=text], input[type=number], input[type=password], input[type=date],
select, textarea{
  width:100%;
  padding:10px 12px;
  border:1.5px solid var(--border);
  border-radius:8px;
  font-size:14px;
  background:#fbfcfe;
  color:var(--text);
  transition:border-color .15s;
}
input:focus, select:focus, textarea:focus{
  outline:none; border-color:var(--blue); background:#fff;
}
input:read-only{background:#eef0f6; color:var(--text-muted);}

.btn{
  display:inline-flex; align-items:center; gap:8px;
  padding:10px 20px;
  border-radius:8px;
  font-size:14px; font-weight:600;
  border:none; cursor:pointer;
  transition:transform .05s, box-shadow .15s;
}
.btn:active{transform:translateY(1px);}
.btn-primary{background:var(--blue); color:#fff;}
.btn-primary:hover{background:var(--blue-dark);}
.btn-green{background:var(--green); color:#fff;}
.btn-green:hover{background:var(--green-dark);}
.btn-outline{background:#fff; color:var(--blue); border:1.5px solid var(--blue);}
.btn-outline:hover{background:#eef1fb;}
.btn-danger{background:#fff; color:var(--danger); border:1.5px solid var(--danger);}
.btn-danger:hover{background:#fdeeee;}
.btn-sm{padding:6px 12px; font-size:12.5px;}

/* ---------- Tables ---------- */
/* Full grid: horizontal lines between rows AND vertical lines between columns,
   with a solid outer border around the whole table. */
table{width:100%; border-collapse:collapse; font-size:13.5px; border:1px solid var(--border);}
thead th{
  text-align:left; padding:10px 12px;
  background:#eef1fb; color:var(--blue-dark);
  font-size:12px; text-transform:uppercase; letter-spacing:.3px;
  border:1px solid var(--border);
}
tbody td{padding:10px 12px; border:1px solid var(--border);}
tfoot td{padding:10px 12px; border:1px solid var(--border);}
tbody tr:hover{background:#f7f9fd;}
.table-wrap{overflow-x:auto;}
.scroll-top{overflow-x:auto; overflow-y:hidden; height:16px; margin-bottom:2px;}
.scroll-top > div{height:1px;}

/* ---------- Badges ---------- */
.badge{padding:3px 10px; border-radius:20px; font-size:11.5px; font-weight:600; text-transform:uppercase;}
.badge-green{background:#e3f7ec; color:var(--green-dark);}
.badge-blue{background:#e7eafd; color:var(--blue);}
.badge-gray{background:#eef0f4; color:var(--text-muted);}
.badge-red{background:#fdeaea; color:var(--danger);}

/* ---------- Totals summary strip ---------- */
.totals-strip{
  display:grid; grid-template-columns:repeat(4,1fr); gap:14px;
  background:linear-gradient(90deg, var(--blue), var(--blue-dark));
  border-radius:var(--radius);
  padding:20px 24px;
  color:#fff;
  margin-top:6px;
}
.totals-strip div .t-label{font-size:11.5px; opacity:.75; text-transform:uppercase; letter-spacing:.4px;}
.totals-strip div .t-value{font-size:22px; font-weight:700; margin-top:4px;}
@media(max-width:700px){.totals-strip{grid-template-columns:1fr 1fr;}}

/* ---------- Login page ---------- */
.login-wrap{
  min-height:100vh; display:flex; align-items:center; justify-content:center;
  background: radial-gradient(circle at 20% 20%, #35409e, #1a2263 70%);
  padding:20px;
}
.login-card{
  background:#fff; border-radius:16px; padding:40px 36px;
  width:100%; max-width:380px; box-shadow:0 20px 50px rgba(0,0,0,.3);
  text-align:center;
}
.login-card img{height:64px; margin-bottom:14px;}
.login-card h1{font-size:17px; color:var(--blue); margin:0 0 4px;}
.login-card p.sub{color:var(--text-muted); font-size:12.5px; margin:0 0 24px;}
.login-card .field{text-align:left;}
.login-card .btn{width:100%; justify-content:center; margin-top:6px;}
.error-msg{
  background:#fdeaea; color:var(--danger); border:1px solid #f3c1c1;
  padding:10px 14px; border-radius:8px; font-size:13px; margin-bottom:16px;
}
.demo-hint{
  margin-top:18px; font-size:11.5px; color:var(--text-muted);
  background:#f4f6fb; border-radius:8px; padding:10px 12px; text-align:left;
}

/* ---------- Misc ---------- */
.flex-between{display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;}
.muted{color:var(--text-muted); font-size:13px;}
.mt-0{margin-top:0;} .mb-0{margin-bottom:0;}
.tag-input-hint{font-size:11.5px; color:var(--text-muted); margin-top:4px;}

/* ---------- Searchable employee combobox ---------- */
.searchable-select{position:relative;}
.employee-search-input{width:100%;}
.employee-search-input:disabled{background:#eef0f6; color:var(--text-muted);}
.employee-dropdown{
  display:none; position:absolute; z-index:50; top:calc(100% + 4px); left:0; right:0;
  max-height:260px; overflow-y:auto;
  background:#fff; border:1.5px solid var(--border); border-radius:8px;
  box-shadow:0 8px 24px rgba(0,0,0,.12);
}
.employee-dropdown-item{padding:9px 12px; font-size:13.5px; cursor:pointer;}
.employee-dropdown-item:hover{background:#eef1fb;}
.employee-dropdown-empty{padding:9px 12px; font-size:13px; color:var(--text-muted);}

@media print{
  .sidebar, .no-print{display:none !important;}
  .main{padding:0;}
  body{background:#fff;}
  @page{ margin: 14mm 12mm; }
  /* Full grid on every printed table: one consistent border color/weight,
     drawn on every side of every header and body cell (horizontal AND
     vertical lines), collapsed into single crisp rules. */
  table{border-collapse:collapse; border:1px solid #7c85a3;}
  thead th{background:#eef1fb !important; -webkit-print-color-adjust:exact; print-color-adjust:exact;
    border:1px solid #7c85a3;}
  tbody td, tfoot td{border:1px solid #7c85a3;}
  tr{page-break-inside:avoid;}
  .totals-strip{-webkit-print-color-adjust:exact; print-color-adjust:exact; border:1px solid var(--blue-dark);}
  .table-wrap{overflow:visible !important;} /* don't let the screen scroll-container clip columns off the printed page */
}

/* ---------- Printable report chrome (shared by includes/print_header.php) ---------- */
.print-doc-no{font-size:11px; color:var(--text-muted); text-align:right;}
.claim-form{border:1.5px solid var(--border); border-radius:var(--radius); overflow:hidden; margin-bottom:20px;}
.claim-form-section-title{
  background:#eef1fb; color:var(--blue-dark); font-size:12px; font-weight:700;
  text-transform:uppercase; letter-spacing:.4px; padding:9px 16px; border-top:1px solid var(--border);
}
.claim-form-section-title:first-child{border-top:none;}
.claim-form-grid{display:grid; grid-template-columns:repeat(4,1fr); gap:0;}
.claim-form-grid .cf-cell{padding:12px 16px; border-top:1px solid var(--border); border-left:1px solid var(--border);}
.claim-form-grid .cf-cell:nth-child(4n+1){border-left:none;}
.cf-cell .cf-label{font-size:11px; text-transform:uppercase; letter-spacing:.3px; color:var(--text-muted);}
.cf-cell .cf-value{font-size:14.5px; font-weight:600; color:var(--text); margin-top:3px;}
@media(max-width:700px){
  .claim-form-grid{grid-template-columns:repeat(2,1fr);}
  .claim-form-grid .cf-cell:nth-child(4n+1){border-left:1px solid var(--border);}
  .claim-form-grid .cf-cell:nth-child(2n+1){border-left:none;}
}
@media print{
  .claim-form{border:1px solid #b9c0d4;}
  .claim-form-section-title{background:#eef1fb !important; -webkit-print-color-adjust:exact; print-color-adjust:exact; border-top:1px solid #b9c0d4;}
  .claim-form-grid .cf-cell{border-top:1px solid #d7dbe8; border-left:1px solid #d7dbe8;}
}
