/* BEO System - stylesheet (tanpa dependensi eksternal) */
:root {
  --bg: #f4f5f2; --panel: #ffffff; --ink: #1f2a24; --muted: #6b7570; --line: #e1e4de;
  --brand: #2f6b45; --brand-2: #e8f1eb; --accent: #c98a1b;
  --grey: #8a918c; --amber: #b7791f; --blue: #2563a8; --purple: #6b46c1; --green: #2f855a; --red: #c53030;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 2px 8px rgba(0,0,0,.04);
  font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
       color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.45rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 0 0 .5rem; }
small, .muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }

/* layout */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; background: linear-gradient(to right, #17271e 232px, transparent 232px); }
.sidebar { background: #17271e; color: #d7e2da; padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 10px; }
.brand img { max-height: 40px; max-width: 120px; background: #fff; border-radius: 6px; padding: 3px; }
.brand .t1 { font-weight: 700; color: #fff; font-size: 1rem; }
.brand .t2 { font-size: .75rem; color: #9fb3a6; }
.nav-sec { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #7f978a; margin: 14px 10px 4px; }
.sidebar a { display: flex; align-items: center; gap: 8px; color: #d7e2da; padding: 7px 10px; border-radius: 7px; }
.sidebar a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.sidebar a.active { background: var(--brand); color: #fff; }
.sidebar .count { margin-left: auto; background: var(--accent); color: #fff; font-size: .7rem; border-radius: 10px; padding: 0 7px; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--panel);
          border-bottom: 1px solid var(--line); padding: 10px 24px; position: sticky; top: 0; z-index: 5; }
.topbar .user { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.content { padding: 20px 24px 60px; max-width: 1500px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .sub { color: var(--muted); margin-top: 2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* panels & grid */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .grid > div > .card:first-child { margin-top: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-main { grid-template-columns: minmax(0, 2.2fr) minmax(300px, 1fr); }
@media (max-width: 1100px) { .g-main, .g3, .g4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 800px) { .layout { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; }
  .g2, .g3, .g4, .g-main { grid-template-columns: 1fr; } .content { padding: 14px; } }

.kpi { padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: .8rem; }
.kpi .value { font-size: 1.55rem; font-weight: 700; margin-top: 2px; }
.kpi .foot { font-size: .78rem; color: var(--muted); }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink);
       padding: 7px 13px; border-radius: 8px; cursor: pointer; font: inherit; font-weight: 500; white-space: nowrap; }
.btn:hover { background: #f3f5f2; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #255a39; }
.btn.danger { color: var(--red); border-color: #f0c9c9; }
.btn.danger:hover { background: #fdf2f2; }
.btn.warn { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.sm { padding: 3px 9px; font-size: .82rem; }
.btn.link { border: none; background: none; color: var(--brand); padding: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbf9; font-weight: 600; }
tr:hover td { background: #fbfcfa; }
td.r, th.r { text-align: right; }
td.c, th.c { text-align: center; }
tfoot td { font-weight: 600; background: #fafbf9; }
.table-wrap { overflow-x: auto; }

/* badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge.grey { background: #eceeec; color: #555d58; }
.badge.amber { background: #fdf3dc; color: #8a5a0c; }
.badge.blue { background: #e3edf8; color: #1d4e85; }
.badge.purple { background: #ede7fa; color: #553098; }
.badge.green { background: #e2f3e8; color: #22663f; }
.badge.red { background: #fbe5e5; color: #9b2424; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }

/* forms */
label { display: block; font-size: .8rem; font-weight: 600; color: #3d4741; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel],
input[type=datetime-local], input[type=time], input[type=search], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid #cfd5cf; border-radius: 7px; font: inherit; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc6aa; border-color: var(--brand); }
textarea { min-height: 70px; resize: vertical; }
.field { margin-bottom: 12px; }
.req::after { content: " *"; color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 0 14px; }
.form-grid .span2 { grid-column: span 2; } .form-grid .span3 { grid-column: span 3; } .form-grid .span4 { grid-column: span 4; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .span4, .form-grid .span3 { grid-column: span 2; } }
.check { display: flex; gap: 6px; align-items: center; font-weight: 500; }
.check input { width: auto; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin: 0; min-width: 140px; }
.filters input, .filters select { padding: 6px 8px; }

/* line tables in form */
.lines input, .lines select { padding: 5px 6px; font-size: .85rem; }
.lines td { padding: 4px; }
.lines .w-qty { width: 80px; } .lines .w-uom { width: 70px; } .lines .w-price { width: 120px; } .lines .w-time { width: 95px; }
.lines .amt { white-space: nowrap; text-align: right; padding-top: 10px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 8px; }
.section-title h2 { margin: 0; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 500; }
.tabs a.active { color: var(--brand); border-color: var(--brand); text-decoration: none; }
.tab-pane { display: none; } .tab-pane.active { display: block; }

/* key-value */
dl.kv { display: grid; grid-template-columns: 115px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; font-weight: 500; }

/* flash */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; border: 1px solid; }
.flash.ok { background: #eaf6ee; border-color: #b9dfc6; color: #1f5d37; }
.flash.err { background: #fdeeee; border-color: #f2c4c4; color: #8f1f1f; }
.alert { padding: 10px 14px; border-radius: 8px; background: #fff7e6; border: 1px solid #f3dca5; color: #7a5208; margin-bottom: 12px; }

/* workflow stepper */
.stepper { display: flex; gap: 0; margin: 4px 0 16px; flex-wrap: wrap; }
.stepper .s { padding: 6px 16px 6px 22px; background: #eceeec; color: #6b7570; font-size: .8rem; font-weight: 600;
              clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); margin-right: -4px; }
.stepper .s:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); padding-left: 14px; }
.stepper .s.done { background: #cfe5d6; color: #22663f; }
.stepper .s.cur { background: var(--brand); color: #fff; }
.stepper .s.bad { background: #f6d2d2; color: #9b2424; }

/* kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: #eaece8; border-radius: var(--radius); padding: 10px; min-height: 200px; }
.kcol-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; margin: 0 2px 8px; }
.kcol-head small { font-weight: 500; }
.kcard { background: #fff; border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; border-left: 4px solid var(--brand); box-shadow: var(--shadow); }
.kcard .t { font-weight: 600; }
.kcard .meta { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.kcard .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 6px; }

/* event type tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; border-top: 4px solid; box-shadow: var(--shadow); }
.tile .n { font-size: 1.6rem; font-weight: 700; }
.tile:hover { text-decoration: none; background: #fbfcfa; }

/* bar chart */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 170px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar .b { width: 100%; max-width: 40px; background: #9cc6aa; border-radius: 5px 5px 0 0; min-height: 2px; }
.bar.cur .b { background: var(--brand); }
.bar .l { font-size: .7rem; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.bar .v { font-size: .7rem; color: var(--ink); margin-bottom: 2px; }

/* calendar */
.cal { width: 100%; table-layout: fixed; }
.cal th { text-align: center; }
.cal td { height: 120px; padding: 4px; vertical-align: top; }
.cal td.other { background: #f7f8f6; color: #aab1ac; }
.cal td.today { background: #f0f7f2; }
.cal .dn { font-size: .8rem; font-weight: 700; margin-bottom: 3px; }
.cal .ev { display: block; font-size: .72rem; padding: 2px 5px; border-radius: 4px; margin-bottom: 2px; color: #fff; overflow: hidden;
           white-space: nowrap; text-overflow: ellipsis; }
.cal .ev.draft { opacity: .55; border: 1px dashed rgba(0,0,0,.4); }
.cal .ev:hover { text-decoration: none; filter: brightness(1.1); }

/* timeline / chatter */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0 8px 14px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: #b7c2bb; }
.timeline li.comment::before { background: var(--accent); }
.timeline .when { font-size: .75rem; color: var(--muted); }

.progress { height: 8px; background: #e6e9e5; border-radius: 6px; overflow: hidden; }
.progress > div { height: 100%; background: var(--brand); }

.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #17271e, #2f6b45); }
.login-card { width: 360px; background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.login-card img { max-height: 64px; display: block; margin: 0 auto 10px; }

.empty { text-align: center; color: var(--muted); padding: 24px; }
.right { text-align: right; } .nowrap { white-space: nowrap; }
.mt { margin-top: 16px; } .mb0 { margin-bottom: 0; }
dialog { border: none; border-radius: 12px; padding: 20px; width: min(460px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(0,0,0,.35); }

/* kalender interaktif */
.cal .dn { display: flex; justify-content: space-between; align-items: center; }
.cal .dn .add { visibility: hidden; border: 1px solid var(--brand); background: #fff; color: var(--brand); border-radius: 6px;
                width: 22px; height: 22px; line-height: 18px; padding: 0; font-weight: 700; cursor: pointer; }
.cal-interactive td:not(.past) { cursor: pointer; }
.cal-interactive td:not(.past):hover { background: #f3f8f4; }
.cal-interactive td:not(.past):hover .add { visibility: visible; }
.cal td.past { background-image: repeating-linear-gradient(135deg, transparent 0 8px, rgba(0,0,0,.018) 8px 16px); }
.cal .ev.drag { cursor: grab; }
.cal.dragging td.drop { outline: 2px dashed var(--brand); outline-offset: -3px; background: #e6f2ea; }
dialog.wide { width: min(940px, 96vw); }
.qd-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.qd-head h2 { margin: 0; }
.qd-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr); gap: 18px; }
@media (max-width: 760px) { .qd-grid { grid-template-columns: 1fr; } }
.qd-side { background: #f7f8f6; border-radius: 10px; padding: 12px; max-height: 470px; overflow-y: auto; }
.qd-status { padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: .9rem; }
.qd-status.good { background: #eaf6ee; border-color: #b9dfc6; color: #1f5d37; }
.qd-status.warn { background: #fff7e6; border-color: #f3dca5; color: #7a5208; }
.qd-status.bad { background: #fdeeee; border-color: #f2c4c4; color: #8f1f1f; }
.qd-list { list-style: none; margin: 0; padding: 0; }
.qd-list li { padding: 6px 8px; border-bottom: 1px solid var(--line); font-size: .85rem; }
.qd-list li.hl { background: #fdeeee; border-radius: 6px; }
.btn[disabled] { pointer-events: none; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1f5d37; color: #fff; padding: 10px 16px;
         border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.25); z-index: 50; max-width: 90vw; }
.toast.bad { background: #9b2424; }

/* ---------- Riwayat perubahan (audit) ---------- */
.audit { display: flex; flex-direction: column; gap: 10px; }
.audit-row { border: 1px solid var(--line, #e2e6e2); border-radius: 8px; padding: 8px 10px; background: #fff; }
.audit-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .85rem; }
.audit-rec { font-weight: 600; }
.audit-who { margin-left: auto; color: #4a5a50; }
.audit-tbl { width: 100%; margin-top: 6px; font-size: .84rem; border-collapse: collapse; }
.audit-tbl td { padding: 3px 6px; border-top: 1px dashed #e5e9e5; vertical-align: top; }
.audit-tbl td.f { width: 26%; color: #4a5a50; font-weight: 600; }
.audit-tbl td.o { color: #9a3b32; text-decoration: line-through; text-decoration-color: rgba(154,59,50,.4); width: 34%; word-break: break-word; }
.audit-tbl td.n { color: #1f6b3f; word-break: break-word; }
.audit-tbl .rm { color: #9a3b32; } .audit-tbl .ad { color: #1f6b3f; }
.audit-note { margin-top: 6px; font-size: .82rem; color: #6b5a2a; background: #fff8e6; padding: 4px 8px; border-radius: 4px; }
.settings-sec { scroll-margin-top: 16px; }
.settings-sec .hint { font-size: .78rem; color: var(--muted, #6b7a70); margin-top: 3px; }
.copybox { font-family: ui-monospace, Consolas, monospace; background: #f3f6f3; padding: 6px 8px; border-radius: 6px; word-break: break-all; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 10px; border: 1px solid #c9d1ca; border-radius: 8px; background: #fff; color: #1d2a22; font-weight: 600; text-decoration: none; }
.btn-google:hover { background: #f5f7f5; }
.login-sep { text-align: center; color: var(--muted, #6b7a70); font-size: .8rem; margin: 14px 0 8px; }

/* ---------- Pagination ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 2px; font-size: .88rem; }
.pager-links { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pager .btn.disabled { opacity: .45; pointer-events: none; }
.pager .gap { padding: 0 4px; color: var(--muted); }
@media print { .pager-links { display: none; } }
