/* AdminLTE look, matching the office DMS. */
:root {
  --primary: #007bff; --success: #28a745; --warning: #ffc107; --danger: #dc3545; --info: #17a2b8; --secondary: #6c757d;
  --dark: #343a40; --side-text: #c2c7d0; --bg: #f4f6f9; --card: #fff; --line: #dee2e6; --text: #212529; --muted: #6c757d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.6 'Siemreap', 'Khmer OS Siemreap', 'Noto Sans Khmer', system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }
a { color: var(--primary); text-decoration: none; }
.spacer { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }
.err { background: #f8d7da; color: #721c24; border-radius: 4px; padding: 8px 10px; margin: 8px 0; }
.warn { background: #fff3cd; color: #856404; border-radius: 4px; padding: 8px 10px; margin: 8px 0; }

/* login */
#login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { background: #fff; width: 100%; max-width: 380px; padding: 28px; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.login-logo { display: block; width: 110px; height: 110px; margin: 0 auto 10px; }
.login-sub { text-align: center; color: var(--muted); margin-bottom: 16px; }
.login-box label { display: block; margin-top: 10px; font-size: 13px; color: #495057; }
.login-box input { width: 100%; padding: 9px 10px; border: 1px solid #ced4da; border-radius: 4px; }
.login-box .btn { margin-top: 16px; }

/* layout */
#shell { display: flex; min-height: 100%; }
/* Sidebar copied from the DMS: plain brand, grouped menu with » sub-items. */
#side { width: 225px; flex: none; background: var(--dark); color: var(--side-text); font-size: 14px; }
#side .brand { display: flex; align-items: center; gap: 10px; color: #c2c7d0; font-size: 19px; padding: 9px 12px; border-bottom: 1px solid #4b545c; font-weight: 300; }
#side .brand img { width: 38px; height: 38px; }
#menu { padding: 6px 7px; }
#menu a, #menu .grp { display: flex; gap: 10px; align-items: center; color: var(--side-text); padding: 7px 12px; margin: 2px 0; border-radius: 3px; }
#menu a:hover { background: rgba(255,255,255,.08); color: #fff; }
#menu a.on { background: rgba(255,255,255,.12); color: #fff; }
#menu .grp { cursor: pointer; user-select: none; }
#menu .grp:hover { background: rgba(255,255,255,.08); color: #fff; }
#menu .grp.here { background: var(--primary); color: #fff; }
#menu .arrow { margin-left: auto; font-size: 13px; transition: transform .2s; }
#menu .tree.open .arrow { transform: rotate(-90deg); }
#menu .subs { display: none; }
#menu .tree.open .subs { display: block; }
#menu .sub { padding-left: 30px; }
#menu .ico { width: 20px; text-align: center; }
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#top { background: var(--primary); color: #fff; display: flex; align-items: center; gap: 12px; padding: 8px 16px; position: sticky; top: 0; z-index: 5; }
#top #pageTitle { font-weight: bold; font-size: 15px; }
#burger { background: none; border: 0; color: #fff; font-size: 17px; cursor: pointer; padding: 0 4px; }
.user { position: relative; display: flex; align-items: center; gap: 7px; cursor: pointer; }
.user .avatar { width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--primary); display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.user-menu { position: absolute; right: 0; top: 38px; background: #fff; border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,.18); min-width: 190px; overflow: hidden; }
.user-menu a { display: flex; gap: 8px; align-items: center; color: var(--text); padding: 9px 14px; }
.user-menu a:hover { background: #f1f3f5; }
#view { padding: 10px 14px; flex: 1; }
footer { display: flex; padding: 10px 16px; border-top: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 13px; }
footer a { color: var(--primary); }
#shell.collapsed #side { display: none; }

/* DMS list page: plain filter panel, blue list title, Show/Search bar, square action buttons. */
.panel { background: #fff; border-radius: 3px; box-shadow: 0 0 1px rgba(0,0,0,.13), 0 1px 3px rgba(0,0,0,.2); padding: 12px 16px; margin-bottom: 14px; }
.list-title { color: var(--primary); font-size: 20px; margin: 4px 0 8px; font-weight: normal; }
.dt-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; flex-wrap: wrap; }
.dt-bar select { padding: 2px 4px; border: 1px solid #ced4da; border-radius: 3px; }
.dt-bar input { padding: 4px 8px; border: 1px solid #ced4da; border-radius: 3px; width: 160px; }
table.dt { font-size: 13px; }
table.dt th, table.dt td { padding: 5px 7px; }
/* events list: give the text columns room so they wrap less, keep the rest tight */
table.ev td { padding: 8px 9px; line-height: 1.55; }
table.ev .w-title { min-width: 170px; }
table.ev .w-place { min-width: 110px; }
table.ev .w-issuer { min-width: 110px; }
table.ev .w-content { min-width: 120px; max-width: 200px; }
table.ev td .muted { font-size: 12.5px; }
table.ev td:last-child { width: 1%; }
.act { display: inline-flex; width: 25px; height: 25px; align-items: center; justify-content: center; border-radius: 3px; color: #fff; border: 0; cursor: pointer; font-size: 12px; margin-right: 2px; }
.act.blue { background: var(--primary); } .act.cyan { background: var(--info); } .act.green { background: var(--success); } .act.red { background: var(--danger); }
@media (max-width: 860px) {
  #side { position: fixed; z-index: 10; height: 100%; left: -250px; transition: left .2s; }
  #shell.open #side { left: 0; }
  #shell.collapsed #side { display: block; }
  #who { display: none; }
}

/* cards, boxes, tables */
.card { background: var(--card); border-radius: 4px; box-shadow: 0 0 1px rgba(0,0,0,.13), 0 1px 3px rgba(0,0,0,.2); margin-bottom: 16px; }
.card-h { padding: 10px 16px; border-bottom: 1px solid rgba(0,0,0,.125); display: flex; align-items: center; gap: 8px; font-weight: bold; }
.card-b { padding: 14px 16px; }
.boxes { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.box { color: #fff; border-radius: 4px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.box b { display: block; font-size: 30px; line-height: 1.2; }
.box.info { background: var(--info); } .box.success { background: var(--success); }
.box.warning { background: var(--warning); color: #1f2d3d; } .box.danger { background: var(--danger); }
.box.primary { background: var(--primary); } .box.secondary { background: var(--secondary); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border: 1px solid var(--line); padding: 7px 9px; vertical-align: top; text-align: left; }
th { background: #f8f9fa; font-weight: bold; white-space: nowrap; }
tbody tr:nth-child(odd) { background: rgba(0,0,0,.02); }
td.num, th.num { text-align: center; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; }

.badge { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 10px; color: #fff; background: var(--secondary); white-space: nowrap; margin: 1px 2px 1px 0; }
.b-success { background: var(--success); } .b-warning { background: var(--warning); color: #222; }
.b-danger { background: var(--danger); } .b-info { background: var(--info); } .b-primary { background: var(--primary); }

.btn { border: 0; border-radius: 4px; padding: 7px 13px; background: var(--primary); color: #fff; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.btn.sm { padding: 3px 8px; font-size: 13px; }
.btn.success { background: var(--success); } .btn.danger { background: var(--danger); } .btn.warning { background: var(--warning); color: #222; }
.btn.info { background: var(--info); } .btn.light { background: #e9ecef; color: #333; } .btn.secondary { background: var(--secondary); }
.btn.block { width: 100%; justify-content: center; padding: 10px; }
.btn:disabled { opacity: .55; cursor: default; }
.btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* forms */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; }
.f label { display: block; font-size: 13px; color: #495057; margin-bottom: 3px; }
.in { width: 100%; padding: 7px 9px; border: 1px solid #ced4da; border-radius: 4px; background: #fff; color: var(--text); }
textarea.in { min-height: 60px; resize: vertical; }
textarea.in.big { min-height: 160px; }
.hint { color: var(--danger); font-size: 13px; margin: -4px 0 12px; }
.req { color: var(--danger); }
.frow { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px 14px; margin-bottom: 12px; }
.frow .wide { grid-column: span 2; }
@media (max-width: 1100px) { .frow { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 600px) { .frow { grid-template-columns: 1fr; } .frow .wide { grid-column: auto; } }
form .f, .panel > .f { margin-bottom: 12px; }
.dd { position: relative; }
.dd-btn { text-align: left; cursor: pointer; padding-right: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23333'/%3E%3C/svg%3E") no-repeat right 10px center; }
.dd-menu { position: absolute; right: 0; top: 100%; z-index: 30; width: 420px; max-width: 90vw; max-height: 420px; overflow-y: auto;
  background: #fff; border: 1px solid #ced4da; border-radius: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.18); padding: 8px; margin-top: 2px; }
.dd-team { background: #f1f3f5; font-weight: bold; font-size: 13px; padding: 4px 8px; margin-top: 6px; border-radius: 3px; }
.dd-item { display: grid; grid-template-columns: 1fr 150px; gap: 8px; align-items: center; padding: 4px 8px; border-bottom: 1px solid #f1f3f5; font-size: 13.5px; }
.dd-item select.in { padding: 4px 6px; }
/* report (DMS document style) */
.rep-head { text-align: center; margin: 18px 0 12px; line-height: 1.9; }
.rep-t1, .rep-t2 { font-family: 'Moul', 'Khmer OS Muol Light', serif; font-size: 17px; }
.rep-t3 { font-size: 14px; }
.rep-sub { font-family: 'Moul', 'Khmer OS Muol Light', serif; font-size: 15px; margin: 22px 0 8px; }
table.rep { border-collapse: collapse; width: 100%; font-size: 13.5px; }
table.rep th, table.rep td { border: 1px solid #adb5bd; padding: 5px 6px; vertical-align: top; }
table.rep th { background: #f1f3f5; text-align: center; vertical-align: middle; font-weight: bold; }
table.rep .c { text-align: center; }
table.rep .tot td { background: #f8f9fa; font-weight: bold; }
.urgent-txt { color: var(--danger); }
.u-ava { display: inline-flex; width: 30px; height: 30px; border-radius: 50%; background: #dee2e6; color: #495057; align-items: center; justify-content: center; font-size: 14px; }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 6px 16px; }
.perm { display: flex; gap: 8px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 4px; cursor: pointer; }
.perm:hover { background: #f4f8ff; }
table.rep .pre { white-space: pre-wrap; }
.rep-total { margin-top: 10px; line-height: 2; white-space: pre-wrap; break-inside: avoid; }
.snip { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; font-size: 13px; margin-bottom: 3px; }
.content-link { font-size: 12.5px; white-space: nowrap; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; }
.modal-box { background: #fff; border-radius: 4px; width: 100%; max-width: 760px; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.modal-h { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: bold; }
.modal-h .x { background: none; border: 0; cursor: pointer; font-size: 16px; color: #666; }
.modal-b { padding: 14px 16px; }
.modal-b textarea.in.big { min-height: 260px; }
.modal-f { display: flex; gap: 6px; padding: 10px 16px; border-top: 1px solid var(--line); }
@media print {
  #side, #top, footer, .no-print, #toast { display: none !important; }
  #main { margin: 0 !important; } #view { padding: 0; }
  .panel { box-shadow: none; padding: 0; }
  .table-wrap { overflow: visible; }
  table.rep { font-size: 11px; } table.rep th, table.rep td { border-color: #000; }
}
.picked { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 1px 10px; font-size: 12.5px; cursor: pointer; max-width: 320px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip:hover { background: #e9f2ff; }

.busy { color: #b45309; font-size: 12px; }
.team-row td { background: #e3f2fd; font-weight: bold; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 104px; padding: 4px; font-size: 12.5px; background: #fff; }
.cal .dow { min-height: 0; background: #f8f9fa; font-weight: bold; text-align: center; }
.cal .other { background: #fafafa; color: #aaa; }
.cal .today { background: #fffbe6; }
.cal .d { font-weight: bold; }
.cal .ev { display: block; background: var(--primary); color: #fff; border-radius: 3px; padding: 1px 4px; margin-top: 3px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.cal .ev.urgent { background: var(--danger); }

.bar { height: 16px; background: var(--info); border-radius: 3px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; }
.kv > span:nth-child(odd) { color: #495057; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; } .kv > span:nth-child(odd) { font-weight: bold; } }

#toast { position: fixed; right: 18px; bottom: 18px; background: rgba(33,37,41,.94); color: #fff; padding: 10px 16px; border-radius: 4px; z-index: 50; }
