/* =========================================================
   Trang Tien ich (hub + cong cu) - design system
   ========================================================= */
:root {
    --ti-primary: #1f6fb2;
    --ti-primary-dark: #17588f;
    --ti-primary-soft: #eaf3fb;
    --ti-ink: #17324d;
    --ti-text: #3a4652;
    --ti-muted: #6a7480;
    --ti-faint: #97a1ac;
    --ti-border: #e4e8ee;
    --ti-border-soft: #eef1f5;
    --ti-bg: #fff;
    --ti-bg-soft: #f7f9fc;
    --ti-ok-bg: #e6f5ea; --ti-ok-fg: #2e7d32;
    --ti-warn-bg: #fff2df; --ti-warn-fg: #b26a00;
    --ti-r: 12px;
    --ti-r-sm: 8px;
    --ti-shadow: 0 2px 10px rgba(20,45,80,.06);
    --ti-shadow-hover: 0 12px 28px rgba(20,96,168,.15);
    --ti-focus: 0 0 0 3px rgba(31,111,178,.16);
}

.tienich-wrap { max-width: 980px; margin: 0 auto; padding: 14px 14px 48px; color: var(--ti-text); font-size: 15px; line-height: 1.6; }
.tienich-wrap h1 { font-size: 28px; line-height: 1.28; margin: 6px 0 8px; color: var(--ti-ink); font-weight: 800; letter-spacing: -.2px; }
.tienich-intro { color: var(--ti-muted); font-size: 15.5px; margin: 0 0 20px; max-width: 760px; }
.tienich-wrap h2 { font-size: 21px; margin: 34px 0 14px; padding-left: 12px; color: var(--ti-ink); font-weight: 700; border-left: 4px solid var(--ti-primary); line-height: 1.35; }
.tienich-wrap h3 { font-size: 16px; margin: 18px 0 6px; color: var(--ti-ink); }
.tienich-wrap p { margin: 0 0 12px; }
.tienich-wrap ul:not(.ti-breadcrumb) { margin: 0 0 14px; padding-left: 20px; }
.tienich-wrap ul:not(.ti-breadcrumb) li { margin-bottom: 5px; }
.tienich-wrap a { color: var(--ti-primary); }

/* ---------- breadcrumb ---------- */
.ti-breadcrumb { list-style: none; margin: 0 0 10px; padding: 0; font-size: 13px; color: var(--ti-faint); }
.ti-breadcrumb li { display: inline; }
.ti-breadcrumb li + li:before { content: "\203A"; margin: 0 6px; color: #c4ccd4; }
.ti-breadcrumb a { color: var(--ti-primary); text-decoration: none; }
.ti-breadcrumb a:hover { text-decoration: underline; }

/* ---------- card grid (hub) ---------- */
.ti-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; margin: 8px 0 10px; }
.ti-card { display: flex; align-items: flex-start; gap: 14px; text-decoration: none; border: 1px solid var(--ti-border);
    border-radius: var(--ti-r); padding: 18px; background: var(--ti-bg); box-shadow: var(--ti-shadow);
    transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease; }
.ti-card:hover { box-shadow: var(--ti-shadow-hover); transform: translateY(-3px); border-color: #bcd7ef; }
.ti-card .ti-ico { font-size: 21px; color: var(--ti-primary); width: 48px; height: 48px; line-height: 48px;
    text-align: center; background: var(--ti-primary-soft); border-radius: 12px; flex-shrink: 0; }
.ti-card .ti-txt { display: flex; flex-direction: column; min-width: 0; }
.ti-card .ti-name { display: block; font-size: 16px; font-weight: 700; color: var(--ti-ink); margin-bottom: 5px; line-height: 1.35; }
.ti-card .ti-desc { display: block; font-size: 13px; color: var(--ti-muted); line-height: 1.55; }

/* hub tool filter */
.ti-filter { position: relative; margin: 4px 0 22px; max-width: 460px; }
.ti-filter input { width: 100%; padding: 11px 14px 11px 40px; border: 1px solid var(--ti-border); border-radius: 24px;
    font-size: 15px; box-sizing: border-box; background: var(--ti-bg-soft); }
.ti-filter input:focus { border-color: var(--ti-primary); outline: none; box-shadow: var(--ti-focus); background: #fff; }
.ti-filter:before { content: "\1F50D"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: .5; }

/* ---------- tool panel ---------- */
.ti-tool { border: 1px solid var(--ti-border); border-radius: var(--ti-r); padding: 20px; background: var(--ti-bg);
    box-shadow: var(--ti-shadow); margin: 8px 0 20px; }
.ti-field { margin-bottom: 14px; }
.ti-field:last-child { margin-bottom: 0; }
.ti-field label { display: block; font-weight: 600; font-size: 13.5px; color: var(--ti-ink); margin-bottom: 6px; }
.ti-field input[type=text], .ti-field input[type=number], .ti-field input[type=date], .ti-field select {
    width: 100%; max-width: 440px; padding: 10px 12px; border: 1px solid #cfd6dd; border-radius: var(--ti-r-sm);
    font-size: 15px; box-sizing: border-box; background: #fff; transition: border-color .15s, box-shadow .15s; }
.ti-field .ti-inline { display: flex; gap: 8px; max-width: 440px; }
.ti-field .ti-inline input { flex: 1 1 auto; }
.ti-field .ti-inline .ti-btn { flex: 0 0 auto; }
.ti-field input::placeholder { color: #aeb6bf; font-style: italic; opacity: 1; }
.ti-field input:focus, .ti-field select:focus { border-color: var(--ti-primary); outline: none; box-shadow: var(--ti-focus); }
.ti-hint { font-size: 12.5px; color: var(--ti-faint); margin-top: 5px; }
.ti-row { display: flex; flex-wrap: wrap; gap: 14px; }
.ti-row .ti-field { flex: 1 1 200px; margin-bottom: 14px; }

.ti-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--ti-primary);
    color: #fff; border: none; border-radius: var(--ti-r-sm); padding: 11px 22px; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: background .15s, box-shadow .15s; }
.ti-btn:hover { background: var(--ti-primary-dark); box-shadow: 0 4px 14px rgba(31,111,178,.28); }
.ti-btn:active { transform: translateY(1px); }
.ti-btn.ghost { background: #eef2f6; color: var(--ti-primary); }
.ti-btn.ghost:hover { background: #e2e9f0; box-shadow: none; }

/* tabs */
.ti-tabs { display: flex; gap: 6px; margin-bottom: 14px; border-bottom: 2px solid var(--ti-border-soft); }
.ti-tabs button { background: transparent; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px;
    padding: 9px 16px; cursor: pointer; font-size: 14.5px; font-weight: 600; color: var(--ti-muted); border-radius: 6px 6px 0 0; }
.ti-tabs button:hover { color: var(--ti-primary); background: var(--ti-bg-soft); }
.ti-tabs button.active { color: var(--ti-primary); border-bottom-color: var(--ti-primary); background: transparent; }

/* pills (converter groups) */
.ti-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.ti-pill { background: var(--ti-bg-soft); border: 1px solid var(--ti-border); color: var(--ti-text); border-radius: 22px;
    padding: 7px 15px; font-size: 13.5px; font-weight: 600; cursor: pointer; transition: all .15s; }
.ti-pill:hover { border-color: var(--ti-primary); color: var(--ti-primary); }
.ti-pill.active { background: var(--ti-primary); border-color: var(--ti-primary); color: #fff; }

/* ---------- converter block ---------- */
.ti-conv-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: end; }
.ti-conv-col { display: flex; flex-direction: column; gap: 8px; }
.ti-conv-col label { font-weight: 600; font-size: 13px; color: var(--ti-muted); text-transform: uppercase; letter-spacing: .4px; }
.ti-conv-col input, .ti-conv-col select { width: 100%; padding: 12px 12px; border: 1px solid #cfd6dd; border-radius: var(--ti-r-sm);
    font-size: 16px; box-sizing: border-box; background: #fff; }
.ti-conv-col input { font-weight: 700; color: var(--ti-ink); }
.ti-conv-col input:focus, .ti-conv-col select:focus { border-color: var(--ti-primary); outline: none; box-shadow: var(--ti-focus); }
.ti-swap { align-self: center; margin-bottom: 6px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--ti-border);
    background: var(--ti-primary-soft); color: var(--ti-primary); font-size: 18px; cursor: pointer; flex-shrink: 0;
    transition: transform .2s, background .15s; }
.ti-swap:hover { background: var(--ti-primary); color: #fff; transform: rotate(180deg); }
.ti-conv-out { margin-top: 16px; padding: 16px 18px; border-radius: var(--ti-r-sm); background: var(--ti-primary-soft);
    border: 1px solid #cfe4fb; font-size: 16px; color: var(--ti-ink); }
.ti-conv-out .ti-big { display: inline-block; font-size: 24px; font-weight: 800; color: var(--ti-primary-dark); }
.ti-note { font-size: 12.5px; color: var(--ti-warn-fg); background: var(--ti-warn-bg); border-radius: 6px;
    padding: 8px 12px; margin: 12px 0 0; }

/* ---------- result box ---------- */
.ti-result { margin-top: 16px; padding: 15px 17px; border-radius: var(--ti-r-sm); background: var(--ti-primary-soft);
    border: 1px solid #cfe4fb; font-size: 15px; color: var(--ti-ink); }
.ti-result.empty { background: #fff8e6; border-color: #f3e0a8; color: #8a6d1e; }
.ti-result .ti-big { font-size: 23px; font-weight: 800; color: var(--ti-primary-dark); }
.ti-result table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.ti-result td { padding: 5px 4px; }

/* copy button */
.ti-copy { display: inline-flex; align-items: center; gap: 5px; margin-left: 10px; padding: 4px 11px; font-size: 12.5px;
    font-weight: 600; color: var(--ti-primary); background: #fff; border: 1px solid #bcd7ef; border-radius: 16px;
    cursor: pointer; vertical-align: middle; transition: all .15s; }
.ti-copy:hover { background: var(--ti-primary); color: #fff; border-color: var(--ti-primary); }
.ti-copy.done { background: var(--ti-ok-bg); color: var(--ti-ok-fg); border-color: #b6e0bf; }

/* ---------- data tables ---------- */
.ti-tablewrap { overflow-x: auto; border: 1px solid var(--ti-border); border-radius: var(--ti-r-sm); margin: 10px 0 14px;
    -webkit-overflow-scrolling: touch; }
.ti-tablewrap .ti-table { margin: 0; border: none; }
.ti-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0; }
.ti-table th, .ti-table td { border-bottom: 1px solid var(--ti-border-soft); padding: 10px 12px; text-align: left; vertical-align: top; }
.ti-table thead th { background: var(--ti-bg-soft); font-weight: 700; color: var(--ti-ink); white-space: nowrap;
    position: sticky; top: 0; border-bottom: 2px solid var(--ti-border); }
.ti-table tbody tr:hover td { background: #f4f8fc; }
.ti-table tbody tr:last-child td { border-bottom: none; }
.ti-table code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 13px;
    background: #f1f4f8; padding: 2px 7px; border-radius: 5px; color: var(--ti-primary-dark); font-weight: 600; }
.ti-badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 11px; white-space: nowrap; }
.ti-badge.ok { background: var(--ti-ok-bg); color: var(--ti-ok-fg); }
.ti-badge.warn { background: var(--ti-warn-bg); color: var(--ti-warn-fg); }

/* ---------- faq (accordion) ---------- */
.ti-faq { border: 1px solid var(--ti-border); border-radius: var(--ti-r); overflow: hidden; margin: 10px 0; }
.ti-faq details { border-bottom: 1px solid var(--ti-border-soft); background: #fff; }
.ti-faq details:last-child { border-bottom: none; }
.ti-faq summary { position: relative; list-style: none; font-weight: 600; cursor: pointer; font-size: 15px; color: var(--ti-ink);
    padding: 14px 44px 14px 16px; transition: background .15s; }
.ti-faq summary::-webkit-details-marker { display: none; }
.ti-faq summary:hover { background: var(--ti-bg-soft); }
.ti-faq summary:after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
    font-size: 20px; font-weight: 400; color: var(--ti-primary); transition: transform .2s; }
.ti-faq details[open] summary:after { content: "\2212"; }
.ti-faq details[open] summary { background: var(--ti-bg-soft); }
.ti-faq p { margin: 0; padding: 0 16px 14px; color: var(--ti-text); font-size: 14px; }

/* ---------- related chips ---------- */
.ti-related { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--ti-border-soft); }
.ti-related strong { display: block; margin-bottom: 10px; font-size: 14px; color: var(--ti-ink); }
.ti-related a { display: inline-block; margin: 0 8px 8px 0; padding: 7px 14px; background: var(--ti-bg-soft);
    border: 1px solid var(--ti-border); border-radius: 20px; text-decoration: none; color: var(--ti-primary);
    font-size: 13px; font-weight: 600; transition: all .15s; }
.ti-related a:hover { background: var(--ti-primary); color: #fff; border-color: var(--ti-primary); }

.ti-disclaimer { margin-top: 22px; font-size: 12.5px; color: var(--ti-faint); font-style: italic; line-height: 1.6; }
.ti-attrib { margin-top: 10px; font-size: 12px; color: var(--ti-faint); }
.ti-attrib a { color: var(--ti-muted); }

/* ---------- responsive ---------- */
@media (max-width: 680px) {
    .tienich-wrap { padding: 12px 12px 40px; }
    .tienich-wrap h1 { font-size: 23px; }
    .tienich-wrap h2 { font-size: 19px; }
    .ti-grid { grid-template-columns: 1fr; gap: 12px; }
    .ti-field input[type=text], .ti-field input[type=number], .ti-field input[type=date], .ti-field select,
    .ti-field .ti-inline { max-width: 100%; }
    .ti-conv-grid { grid-template-columns: 1fr; gap: 10px; }
    .ti-swap { justify-self: center; transform: rotate(90deg); margin: 2px 0; }
    .ti-swap:hover { transform: rotate(270deg); }
    .ti-conv-out .ti-big, .ti-result .ti-big { font-size: 20px; }
}
