/* MASL Tender MIS Dashboard — blue & white theme */
.masl-mis-dashboard {
  --mmd-blue-900: #0A2A66;
  --mmd-blue-800: #0D47A1;
  --mmd-blue-700: #1565C0;
  --mmd-blue-600: #1E88E5;
  --mmd-blue-100: #E3EDF9;
  --mmd-blue-50: #F3F8FE;
  --mmd-ink: #0F1E36;
  --mmd-muted: #5B6B82;
  --mmd-line: #DCE6F3;
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color: var(--mmd-ink);
  font-size: 14px;
  line-height: 1.45;
}
.masl-mis-dashboard *, .masl-mis-dashboard *::before, .masl-mis-dashboard *::after { box-sizing: border-box; }
.mmd-wrap { background: var(--mmd-blue-50); border-radius: 18px; padding: 0 0 22px; overflow: hidden; box-shadow: 0 10px 40px rgba(13, 71, 161, .10); }
.mmd-wrap:fullscreen { overflow: auto; border-radius: 0; padding-bottom: 40px; }

/* Header */
.mmd-top {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
  padding: 22px 26px; color: #fff;
  background: linear-gradient(120deg, #0A2A66 0%, #0D47A1 45%, #1E88E5 100%);
  position: relative;
}
.mmd-top::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 4px;
  background: linear-gradient(90deg, #00E5FF, #2979FF, #00C853, #FFD600);
}
.mmd-top h2 { margin: 0; font-size: 22px; font-weight: 700; color: #fff; letter-spacing: .2px; }
.mmd-top p { margin: 2px 0 0; opacity: .85; font-size: 13px; color: #fff; }
.mmd-brand { display: flex; align-items: center; gap: 14px; }
.mmd-brand img { height: 46px; width: auto; border-radius: 8px; background: #fff; padding: 4px; }
.mmd-logo { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 22px; color: var(--mmd-blue-800); background: #fff; }
.mmd-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Buttons */
.mmd-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; border: 0;
  font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; transition: transform .12s, box-shadow .12s, background .12s;
}
.mmd-btn:hover { transform: translateY(-1px); }
.mmd-btn[disabled] { opacity: .45; cursor: default; transform: none; }
.mmd-btn-white { background: #fff; color: var(--mmd-blue-800); box-shadow: 0 4px 14px rgba(0, 0, 0, .15); }
.mmd-btn-ghost { background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .4); }
.mmd-btn-light { background: #fff; color: var(--mmd-blue-700); border: 1px solid var(--mmd-line); }
.mmd-upload { display: inline-flex; gap: 8px; align-items: center; margin: 0; }
.mmd-upload-msg { font-size: 12px; color: #fff; }
.mmd-empty .mmd-upload-msg { color: var(--mmd-blue-800); }

.mmd-banner { margin: 16px 22px 0; padding: 10px 14px; border-radius: 10px; background: #FFF8E1; border: 1px solid #FFE082; color: #6D4C00; font-weight: 500; }

/* Filters */
.mmd-filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 22px 4px; }
.mmd-filters select, .mmd-filters input {
  font: inherit; padding: 9px 12px; border: 1px solid var(--mmd-line); border-radius: 10px; background: #fff; color: var(--mmd-ink); min-width: 150px;
}
.mmd-filters input { flex: 1 1 260px; }
.mmd-filters select:focus, .mmd-filters input:focus { outline: 2px solid var(--mmd-blue-600); outline-offset: 1px; }

.mmd-view { padding: 0 22px; }

/* KPI cards */
.mmd-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.mmd-card {
  background: #fff; border-radius: 14px; padding: 14px 16px; border: 1px solid var(--mmd-line); position: relative; overflow: hidden;
  box-shadow: 0 2px 10px rgba(13, 71, 161, .05);
}
.mmd-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--c, var(--mmd-blue-700)); }
.mmd-card span { display: block; font-size: 12px; color: var(--mmd-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.mmd-card b { display: block; font-size: 26px; font-weight: 800; color: var(--c, var(--mmd-blue-800)); margin: 4px 0 2px; }
.mmd-card small { color: var(--mmd-muted); font-size: 12px; }
.mmd-click { cursor: pointer; }
.mmd-card.mmd-click:hover { box-shadow: 0 6px 20px rgba(13, 71, 161, .16); transform: translateY(-1px); }

/* Panels */
.mmd-panel { background: #fff; border: 1px solid var(--mmd-line); border-radius: 16px; padding: 18px 20px; margin: 0 0 16px; box-shadow: 0 2px 12px rgba(13, 71, 161, .05); min-width: 0; }
.mmd-panel h3 { margin: 0 0 14px; font-size: 16px; font-weight: 700; color: var(--mmd-blue-900); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.mmd-panel h3 small { font-weight: 500; color: var(--mmd-muted); font-size: 12px; }
.mmd-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mmd-grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.mmd-grid2 > .mmd-panel, .mmd-grid3 > .mmd-panel { margin-bottom: 16px; }
@media (max-width: 980px) { .mmd-grid2, .mmd-grid3 { grid-template-columns: 1fr; gap: 0; } }

/* Donut */
.mmd-donut { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: center; }
.mmd-donut svg { flex: 0 0 auto; max-width: 100%; height: auto; }
.mmd-seg { transition: stroke-width .15s; cursor: pointer; }
.mmd-seg:hover { stroke-width: 32; }
.mmd-donut-num { font-size: 30px; font-weight: 800; fill: var(--mmd-blue-900); text-anchor: middle; }
.mmd-donut-lbl { font-size: 12px; fill: var(--mmd-muted); text-anchor: middle; }
.mmd-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; min-width: 170px; }
.mmd-legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.mmd-legend li b { margin-left: auto; color: var(--mmd-blue-900); }
.mmd-legend-inline { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 12px; }
.mmd-legend-inline li { font-size: 11.5px; color: var(--mmd-muted); }
.mmd-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }

/* Horizontal bars */
.mmd-hbars { display: grid; gap: 8px; }
.mmd-hrow { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 52px; align-items: center; gap: 10px; }
.mmd-hlabel { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mmd-htrack { height: 18px; background: var(--mmd-blue-50); border-radius: 6px; display: flex; overflow: hidden; }
.mmd-hseg { height: 100%; display: block; transition: filter .15s; }
.mmd-hseg:hover { filter: brightness(1.12); }
.mmd-hval { font-size: 13px; font-weight: 700; color: var(--mmd-blue-900); text-align: right; }

/* Column chart & radar */
.mmd-cols { width: 100%; height: auto; display: block; }
.mmd-grid { stroke: var(--mmd-blue-100); stroke-width: 1; }
.mmd-axis { font-size: 10.5px; fill: var(--mmd-muted); }
.mmd-radar { width: 100%; max-width: 380px; height: auto; display: block; margin: 0 auto; }
.mmd-radar-grid { fill: none; stroke: var(--mmd-blue-100); stroke-width: 1; }
.mmd-radar-val { fill: rgba(30, 136, 229, .28); stroke: var(--mmd-blue-700); stroke-width: 2; }
.mmd-radar-dot { fill: var(--mmd-blue-800); }

/* Clickable names */
a.mmd-name { color: var(--mmd-blue-700); font-weight: 700; text-decoration: none; border-bottom: 1px dashed rgba(21, 101, 192, .45); cursor: pointer; }
a.mmd-name:hover { color: var(--mmd-blue-900); border-bottom-style: solid; }
a.mmd-chip { display: inline-block; border: 1px solid var(--mmd-line); background: var(--mmd-blue-50); padding: 2px 9px; border-radius: 999px; font-size: 12px; margin: 1px 0; }
a.mmd-chip:hover { background: var(--mmd-blue-700); color: #fff; border-color: var(--mmd-blue-700); }
.mmd-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Tables */
.mmd-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.mmd-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.mmd-table th { text-align: left; background: var(--mmd-blue-800); color: #fff; font-weight: 600; padding: 10px 10px; white-space: nowrap; font-size: 12px; position: sticky; top: 0; }
.mmd-table th:first-child { border-top-left-radius: 10px; }
.mmd-table th:last-child { border-top-right-radius: 10px; }
.mmd-table td { padding: 9px 10px; border-bottom: 1px solid var(--mmd-line); vertical-align: top; }
.mmd-table tbody tr:nth-child(even) td { background: #FAFCFF; }
.mmd-table tbody tr:hover td { background: var(--mmd-blue-50); }
.mmd-table td small { display: block; color: var(--mmd-muted); font-size: 11.5px; margin-top: 2px; }
.mmd-reg td:nth-child(2) { min-width: 260px; max-width: 420px; }
.mmd-remark { color: var(--mmd-muted); min-width: 160px; max-width: 260px; }
.mmd-mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; min-width: 120px; }
.mmd-good { color: #2E7D32; font-weight: 700; }
.mmd-bad { color: #C62828; font-weight: 700; }
.mmd-score { min-width: 170px; }
.mmd-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 13%, white); border: 1px solid color-mix(in srgb, var(--c) 35%, white); white-space: nowrap; }
.mmd-pager { display: flex; gap: 12px; justify-content: flex-end; align-items: center; margin-top: 12px; color: var(--mmd-muted); }

/* Meter */
.mmd-meter { display: inline-block; vertical-align: middle; width: 90px; height: 9px; border-radius: 99px; background: var(--mmd-blue-100); overflow: hidden; }
.mmd-meter-bar { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #1E88E5, #0D47A1); }
.mmd-meter-bar.mmd-gA { background: linear-gradient(90deg, #43A047, #1B5E20); }
.mmd-meter-bar.mmd-gB { background: linear-gradient(90deg, #42A5F5, #1565C0); }
.mmd-meter-bar.mmd-gC { background: linear-gradient(90deg, #FFB74D, #EF6C00); }
.mmd-meter-bar.mmd-gD { background: linear-gradient(90deg, #EF5350, #B71C1C); }
.mmd-grade { margin-left: 8px; font-weight: 800; font-size: 12.5px; }
.mmd-grade.mmd-gA { color: #2E7D32; } .mmd-grade.mmd-gB { color: #1565C0; } .mmd-grade.mmd-gC { color: #EF6C00; } .mmd-grade.mmd-gD { color: #C62828; }

/* Upcoming list */
.mmd-upcoming { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mmd-upcoming li { display: flex; gap: 12px; align-items: flex-start; }
.mmd-upcoming b { display: block; font-size: 13px; }
.mmd-upcoming small { display: block; color: var(--mmd-muted); font-size: 12px; }
.mmd-due { flex: 0 0 auto; min-width: 48px; text-align: center; padding: 6px 8px; border-radius: 10px; background: var(--mmd-blue-100); color: var(--mmd-blue-800); font-weight: 800; }
.mmd-due-hot { background: #FFEBEE; color: #C62828; }

/* Allocation */
.mmd-alloc p { margin: 0 0 6px; }
.mmd-alloc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 10px; }
.mmd-alloc-grid span { background: var(--mmd-blue-50); border-radius: 10px; padding: 8px 12px; font-size: 12px; color: var(--mmd-muted); }
.mmd-alloc-grid b { display: block; color: var(--mmd-ink); font-size: 13.5px; margin-top: 2px; }

/* Employee view */
.mmd-emp-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin: 18px 0 4px; }
.mmd-emp-head h2 { margin: 0; font-size: 24px; color: var(--mmd-blue-900); }
.mmd-emp-head p { margin: 2px 0 0; color: var(--mmd-muted); }
.mmd-avatar { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 18px; background: linear-gradient(135deg, #1E88E5, #0A2A66); box-shadow: 0 6px 18px rgba(13, 71, 161, .3); }
.mmd-emp-score { margin-left: auto; text-align: right; }
.mmd-emp-score .mmd-meter { width: 160px; height: 12px; }
.mmd-emp-score small { display: block; color: var(--mmd-muted); }
.mmd-kra { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.mmd-kra li { display: grid; grid-template-columns: 1fr 110px 44px; gap: 10px; align-items: center; font-size: 13px; }
.mmd-kra .mmd-meter { width: 100%; }
.mmd-kra b { text-align: right; color: var(--mmd-blue-900); }
.mmd-group { border: 1px solid var(--mmd-line); border-radius: 12px; margin-bottom: 10px; padding: 0 12px; background: #fff; }
.mmd-group summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
.mmd-group[open] summary { border-bottom: 1px solid var(--mmd-line); margin-bottom: 8px; }
.mmd-group .mmd-table-wrap { padding-bottom: 10px; }

.mmd-note, .mmd-muted { color: var(--mmd-muted); font-size: 12.5px; }
.mmd-loading, .mmd-error, .mmd-empty { padding: 40px; text-align: center; background: #fff; border-radius: 16px; border: 1px solid var(--mmd-line); }
.mmd-error { color: #C62828; }
.mmd-empty { margin: 22px; }
.mmd-spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid var(--mmd-blue-100); border-top-color: var(--mmd-blue-700); border-radius: 50%; animation: mmdspin .8s linear infinite; vertical-align: -4px; margin-right: 10px; }
@keyframes mmdspin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .mmd-top { padding: 18px 16px; }
  .mmd-view, .mmd-filters { padding-left: 12px; padding-right: 12px; }
  .mmd-hrow { grid-template-columns: 92px 1fr 40px; }
  .mmd-emp-score { margin-left: 0; text-align: left; }
}

@media print {
  .mmd-actions, .mmd-filters, .mmd-pager, .mmd-banner { display: none !important; }
  .mmd-wrap { box-shadow: none; }
  .mmd-panel, .mmd-card { break-inside: avoid; }
  .mmd-top { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
