/* =====================================================================
   Giao diện kiểu 1Office: khung 56px, menu ứng dụng dạng lưới,
   tab có đếm số, bảng dày, trang chi tiết 2 cột, form nhãn nổi.
   ===================================================================== */
:root { --pink: #ec407a; --pink-600: #d81b60; --pink-50: #fff0f5; --pink-100: #ffd6e5; --bg: #edf1f8; --line: #e6e9f0; --line-2: #f0f2f6; --ink: #1f2937; --ink-2: #4b5563; --ink-3: #8a94a6; --r: 6px; --r-sm: 6px; --shadow: none; --top: 48px; font-size: 13.5px; }
body { background: var(--bg); }
.btn { height: 32px; border-radius: 6px; font-weight: 500; }
.btn.primary { background: var(--pink); border-color: var(--pink); }
.btn.primary:hover { background: var(--pink-600); }
.card { border-radius: 6px; box-shadow: none; }
.input, select.input, textarea.input { border-radius: 6px; height: 36px; }
.input:focus { border-color: var(--pink); box-shadow: 0 0 0 3px var(--pink-50); }
.tabs .active { color: var(--pink); border-bottom-color: var(--pink); }
.page { padding: 14px 14px 40px; }
.chat { height: calc(100vh - 48px); }

.o-shell { display: grid; grid-template-columns: 56px 1fr; grid-template-rows: 48px 1fr; height: 100vh; }
.o-corner { grid-row: 1; grid-column: 1; display: grid; place-items: center; background: #fff; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.o-top { grid-row: 1; grid-column: 2; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 16px 0 14px; position: relative; z-index: 30; }
.o-plus { width: 22px; height: 22px; border: 1.5px solid var(--pink); color: var(--pink); border-radius: 5px; display: grid; place-items: center; background: #fff; cursor: pointer; flex-shrink: 0; padding: 0; }
.o-plus:hover { background: var(--pink); color: #fff; }
.o-plus svg { width: 14px; height: 14px; }
.o-title { min-width: 0; }
.o-title h1 { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-title .sub { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.o-search { margin-left: auto; position: relative; width: 220px; }
.o-search input { width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px 0 30px; background: #fff; font-size: 13px; }
.o-search input:focus { outline: none; border-color: var(--pink); }
.o-search > svg { position: absolute; left: 9px; top: 8px; width: 15px; height: 15px; color: var(--ink-3); }
.o-search .search-pop { width: 440px; right: 0; left: auto; top: 38px; }
.o-icons { display: flex; align-items: center; gap: 2px; }
.o-icons .icon-btn { width: 34px; height: 34px; color: var(--ink-2); }
.o-icons .icon-btn svg { width: 19px; height: 19px; }
.o-icons .badge.dot { position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; font-size: 10px; }
.o-rail { grid-row: 2; grid-column: 1; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 10px 0; overflow-y: auto; gap: 4px; }
.o-rail a { width: 50px; padding: 7px 0 5px; border-radius: 8px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--ink-2); font-size: 10.5px; text-align: center; line-height: 1.2; text-decoration: none !important; position: relative; }
.o-rail a svg { width: 19px; height: 19px; }
.o-rail a:hover { background: var(--bg); }
.o-rail a.active { color: var(--pink); background: var(--pink-50); }
.o-rail .sep { width: 30px; height: 1px; background: var(--line); margin: 6px 0; flex-shrink: 0; }
.o-rail .badge { position: absolute; top: 2px; right: 4px; min-width: 15px; height: 15px; font-size: 9.5px; }
.o-main { grid-row: 2; grid-column: 2; overflow: auto; position: relative; }

/* menu ứng dụng */
.launcher-wrap { position: fixed; inset: 0; z-index: 120; background: rgba(15, 23, 42, .25); animation: fade .15s; }
.launcher { position: absolute; left: 0; top: 0; bottom: 0; width: 380px; max-width: 92vw; background: #fff; display: flex; flex-direction: column; box-shadow: 8px 0 30px rgba(0,0,0,.12); animation: slideL .18s; }
@keyframes slideL { from { transform: translateX(-30px); opacity: 0; } }
.launcher-h { height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 16px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.launcher-h .lg { font-weight: 800; font-size: 17px; color: var(--ink); }
.launcher-h .lg b { color: var(--pink); }
.launcher-h input { margin-left: auto; height: 30px; width: 150px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px; }
.launcher-b { overflow-y: auto; padding: 4px 18px 24px; }
.launcher-b h5 { font-size: 13px; font-weight: 700; margin: 18px 4px 12px; color: var(--ink); letter-spacing: .02em; }
.apps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 4px; }
.app { display: flex; flex-direction: column; align-items: center; gap: 7px; text-decoration: none !important; color: var(--ink); font-size: 12.5px; text-align: center; padding: 6px 0; border-radius: 8px; }
.app:hover { background: var(--bg); }
.app .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.app .ic svg { width: 20px; height: 20px; }
.app.off { opacity: .35; pointer-events: none; }

/* tab + thanh công cụ */
.o-tabs { background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 4px; padding: 0 14px; height: 42px; overflow-x: auto; position: sticky; top: 0; z-index: 10; }
.o-tabs .ham { color: var(--ink-3); margin-right: 6px; display: grid; place-items: center; flex-shrink: 0; }
.o-tabs a, .o-tabs button.t { white-space: nowrap; padding: 0 8px; height: 42px; display: flex; align-items: center; border: none; background: none; cursor: pointer; color: var(--ink-2); font-size: 13.5px; border-bottom: 2px solid transparent; text-decoration: none !important; flex-shrink: 0; }
.o-tabs .active { color: var(--pink); border-bottom-color: var(--pink); }
.o-tabs .rt { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.o-tool { background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 14px; min-height: 40px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.o-tool .tb, .o-tabs .tb { border: none; background: none; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); padding: 5px 6px; border-radius: 6px; font-size: 13px; text-decoration: none !important; }
.o-tool .tb:hover, .o-tabs .tb:hover { background: var(--bg); color: var(--ink); }
.o-tool .tb svg, .o-tabs .tb svg { width: 15px; height: 15px; }
.o-tool .tb[disabled] { opacity: .4; cursor: default; }
.o-tool select.pg { border: none; background: none; color: var(--ink-2); font-size: 13px; cursor: pointer; }
.o-tool .rt { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.o-filter { background: #fafbfd; border-bottom: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.o-filter .input { width: auto; min-width: 150px; height: 32px; font-size: 13px; }
.o-body { padding: 12px 12px 30px; }
.o-table { background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: auto; }
.o-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.o-table th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 12.5px; padding: 11px 12px; border-bottom: 1px solid var(--line); background: #fff; white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.o-table td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.o-table tr.click { cursor: pointer; }
.o-table tr.click:hover td { background: #f7f9fd; }
.o-table tr.grp td { background: #f6f8fc; color: var(--pink); font-weight: 600; }
.o-table input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--pink); }
.o-table .c { text-align: center; }
.o-table .r { text-align: right; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 4px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.pill.red { background: #fde8ea; color: #e5384e; } .pill.green { background: #e3f6ec; color: #18a058; } .pill.gray { background: #eef0f4; color: #6b7280; }
.pill.blue { background: #e6efff; color: #2f6fed; } .pill.amber { background: #fff3dc; color: #c27c0e; } .pill.pink { background: var(--pink-50); color: var(--pink-600); }
.ybar { display: flex; align-items: center; gap: 6px; min-width: 130px; }
.ybar .b { flex: 1; height: 7px; border-radius: 99px; background: #f5c242; position: relative; overflow: hidden; }
.ybar .b i { position: absolute; left: 0; top: 0; bottom: 0; background: #2f6fed; }
.ybar .dot { width: 18px; height: 18px; border-radius: 50%; background: #2f6fed; color: #fff; font-size: 9.5px; display: grid; place-items: center; flex-shrink: 0; }

/* trang chi tiết */
.o-detail { display: grid; grid-template-columns: minmax(0, 1fr) 450px; gap: 12px; padding: 12px; align-items: start; }
.o-card { background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.o-card + .o-card { margin-top: 12px; }
.o-card > .h { display: flex; align-items: center; gap: 8px; padding: 13px 14px; border-bottom: 1px solid var(--line-2); }
.o-card > .h h3 { font-size: 14.5px; font-weight: 600; }
.o-card > .b { padding: 14px; }
.o-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.o-fields .f .l { color: var(--ink-3); font-size: 12.5px; margin-bottom: 4px; }
.o-fields .f .v { color: var(--ink); min-height: 18px; word-break: break-word; }
.o-fields .full { grid-column: 1 / -1; }
.o-subtabs { display: flex; gap: 16px; padding: 0 14px; border-bottom: 1px solid var(--line-2); }
.o-subtabs button { border: none; background: none; padding: 12px 0; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; font-size: 14px; }
.o-subtabs .active { color: var(--pink); border-bottom-color: var(--pink); }

/* form kiểu 1Office */
.o-form { background: #fff; border: 1px solid var(--line); border-radius: 6px; margin: 12px 12px 0; padding: 6px 18px 24px; }
.o-form .sec { color: var(--pink); font-weight: 600; display: flex; align-items: center; gap: 6px; margin: 14px 0 16px; }
.o-form .sec svg { width: 14px; height: 14px; }
.grid-f { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 12px; max-width: 1000px; }
.grid-f .w2 { grid-column: span 2; }
.grid-f .wf { grid-column: 1 / -1; }
.fl { position: relative; }
.fl > label { position: absolute; top: -8px; left: 9px; background: #fff; padding: 0 4px; font-size: 11.5px; color: var(--ink-3); z-index: 2; line-height: 1.3; }
.fl > label .req, .req { color: #e5384e; }
.fl .input { height: 42px; border-color: #dfe3ea; }
.fl textarea.input { height: auto; min-height: 120px; padding-top: 14px; }
.fl .picker .chips { min-height: 42px; padding: 7px 8px; border-color: #dfe3ea; }
.o-formbar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 8px; z-index: 5; margin-top: 12px; }
.o-formbar .btn { text-transform: uppercase; height: 34px; }
.drop-zone { border: 1px dashed #cfd5df; border-radius: 6px; padding: 16px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

/* trang chủ */
.o-home { display: grid; grid-template-columns: minmax(0, 1fr) 470px; gap: 12px; padding: 12px; align-items: start; }
.o-home > div { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.o-wg { background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.o-wg > .h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); font-weight: 600; font-size: 14.5px; }
.o-wg > .h .ctl { margin-left: auto; display: flex; gap: 6px; align-items: center; font-weight: 400; font-size: 12.5px; }
.o-wg > .h select { height: 26px; font-size: 12px; border: 1px solid var(--line); border-radius: 5px; padding: 0 6px; background: #fff; }
.o-empty { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 22px; color: var(--ink-3); font-size: 13px; }
.o-empty svg { width: 34px; height: 34px; color: #c8cfda; }
.o-li { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); color: var(--ink); text-decoration: none !important; }
.o-li:last-child { border-bottom: none; }
.o-li:hover { background: #f7f9fd; }
.att-cards { display: grid; grid-template-columns: 1fr 1fr 84px; gap: 8px; padding: 12px 14px; }
.att-c { border-radius: 6px; padding: 10px 12px; background: #fde8ea; }
.att-c.ok { background: #e3f6ec; }
.att-c .t { font-size: 12.5px; color: var(--ink-2); }
.att-c .v { font-size: 18px; font-weight: 600; color: #e5384e; margin: 4px 0; }
.att-c.ok .v { color: #18a058; }
.att-c .s { font-size: 11.5px; color: #e5384e; }
.att-c.ok .s { color: #18a058; }
.att-w { background: #e6efff; border-radius: 6px; text-align: center; padding: 10px 4px; font-size: 12.5px; }
.att-w .v { font-size: 22px; font-weight: 700; color: #2f6fed; }
.ev-row { display: flex; gap: 14px; padding: 12px 14px; color: var(--ink); text-decoration: none !important; }
.ev-row:hover { background: #f7f9fd; }
.ev-row .d { width: 72px; flex-shrink: 0; font-size: 12.5px; }
.ev-row .d small { display: block; color: var(--ink-3); font-size: 11px; }
.ev-row .x { border-left: 2px solid #c62828; padding-left: 12px; min-width: 0; }

/* bảng công */
.tk-grid th, .tk-grid td { text-align: center !important; padding: 7px 3px !important; border-right: 1px solid var(--line-2); min-width: 34px; }
.tk-grid th.l, .tk-grid td.l { text-align: left !important; padding: 7px 10px !important; min-width: 0; white-space: nowrap; }
.tk-grid .we { background: #f3f4f7 !important; }
.tk-grid .miss { color: #e5384e; }
.tk-grid .off { color: var(--ink-3); }
.tk-grid .leave { color: #2f6fed; font-weight: 600; }
.tk-grid .warn { color: #c27c0e; font-weight: 600; }
.tk-grid .test { color: #c27c0e; font-style: italic; }

/* quy trình dạng sơ đồ */
.flow { background-color: #fff; background-image: radial-gradient(#dfe3ea 1px, transparent 1px); background-size: 14px 14px; border: 1px solid var(--line); border-radius: 6px; padding: 28px 24px; overflow-x: auto; display: flex; align-items: center; min-height: 190px; }
.fnode { min-width: 160px; max-width: 220px; border-radius: 6px; background: #2a7aa8; color: #fff; padding: 10px 12px; font-size: 12px; box-shadow: 0 2px 6px rgba(0,0,0,.12); flex-shrink: 0; }
.fnode.start { background: #18a058; min-width: 110px; }
.fnode.end { background: #f5a623; min-width: 110px; }
.fnode.done { background: #18a058; } .fnode.cur { background: var(--pink); } .fnode.skip { background: #9aa3b2; } .fnode.rej { background: #e5384e; }
.fnode b { display: block; font-size: 13px; margin-bottom: 4px; }
.farrow { width: 44px; height: 2px; background: #2f8f4e; position: relative; flex-shrink: 0; }
.farrow::after { content: ""; position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left-color: #2f8f4e; border-right: 0; }

@media (max-width: 1100px) { .o-detail, .o-home { grid-template-columns: 1fr; } .grid-f { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .o-shell { grid-template-columns: 1fr; grid-template-rows: 48px 1fr 58px; }
  .o-corner { display: none; }
  .o-top { grid-column: 1; padding: 0 8px; gap: 8px; }
  .o-rail { grid-row: 3; grid-column: 1; flex-direction: row; justify-content: flex-start; padding: 3px 4px; border-right: none; border-top: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; }
  .o-rail a { flex-shrink: 0; width: 60px; }
  .o-rail .sep { display: none; }
  .o-main { grid-column: 1; }
  .o-search { width: 34px; }
  .o-search input { padding: 0; opacity: 0; cursor: pointer; }
  .o-search input:focus { position: fixed; left: 8px; right: 8px; top: 8px; width: auto; opacity: 1; padding: 0 12px; z-index: 50; height: 34px; }
  .o-search .search-pop { position: fixed; left: 8px; right: 8px; top: 46px; width: auto; }
  .o-fields { grid-template-columns: 1fr; }
  .grid-f { grid-template-columns: 1fr; }
  .grid-f .w2 { grid-column: auto; }
  .att-cards { grid-template-columns: 1fr 1fr; }
  .o-icons .hide-m { display: none; }
  .chat { height: calc(100vh - 106px); }
}
