/* co.my tools: one stylesheet for every subdomain. No external fonts, no inline styles needed. */
:root {
  color-scheme: light;
  --ink: #1e2924; --muted: #56635b; --soft: #6b7a71; --paper: #f5f7f3; --white: #fff;
  --line: #dde4dc; --green: #d5ed76; --forest: #193d32; --forest-2: #275b49;
  --ok: #1d6b3a; --bad: #9b1c1c; --warn-bg: #fff7e0; --warn-line: #f0d48a;
  --accent: #193d32;
  --shadow: 0 16px 50px #20392c12;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  font-family: var(--sans); color: var(--ink); background: var(--paper);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-width: 320px; line-height: 1.5; }
a { color: var(--forest-2); }
a:hover { color: var(--forest); }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid #7b9b57; outline-offset: 2px; }

/* header and footer */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px max(5vw, 16px); border-bottom: 1px solid var(--line); background: var(--paper); border-top: 4px solid var(--accent); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand img { flex: none; border-radius: 9px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text b { font-size: 15px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font: 11px var(--mono); color: var(--soft); }
.site-header nav { display: flex; gap: 20px; flex: none; }
.site-header nav a, .footer-links a { color: var(--muted); text-decoration: none; font-size: 14px; }
.site-header nav a:hover, .footer-links a:hover { color: var(--ink); text-decoration: underline; }
.site-footer { display: grid; grid-template-columns: 1fr auto; gap: 14px 24px; align-items: center; padding: 28px max(5vw, 16px) 36px; border-top: 1px solid var(--line); margin-top: 40px; }
.site-footer .brand-text small a { color: inherit; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer-legal { font: 11px/1.6 var(--mono); color: var(--soft); }
.email-obfuscated { border: 0; background: transparent; padding: 4px; cursor: pointer; justify-self: start; }
.email-obfuscated img { display: block; width: 156px; height: auto; }

/* layout */
.tool-main { max-width: 900px; margin: auto; padding: 24px 16px 40px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 28px; padding: 0; font-size: 13px; color: var(--soft); }
.breadcrumbs li + li::before { content: "›"; margin-right: 8px; color: #9aa79f; }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.eyebrow { font: 600 11px var(--mono); letter-spacing: .12em; color: #5d7468; text-transform: uppercase; margin: 0 0 12px; }
.tool-intro { margin-bottom: 24px; }
.tool-intro h1 { font-size: clamp(34px, 6vw, 54px); line-height: 1.05; letter-spacing: -.04em; margin: 0; }
.lede { font-size: 17px; line-height: 1.6; color: var(--muted); max-width: 680px; margin: 14px 0 0; }

/* tool card and form */
.tool-card { padding: 24px; background: var(--white); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: 12px; box-shadow: var(--shadow); }
.tool-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field-wide { grid-column: 1 / -1; }
.field label, .field legend { font-size: 13px; font-weight: 700; color: #3d4b43; padding: 0; }
.field legend { margin-bottom: 6px; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid #cfd8cf; border-radius: 7px; background: #fbfcfa; padding: 11px 12px; color: var(--ink); font: 15px var(--sans); }
.field textarea { min-height: 150px; resize: vertical; line-height: 1.5; font-family: var(--mono); font-size: 14px; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #6f8f4c; box-shadow: 0 0 0 3px #7b9b5726; outline: none; }
.field input[type=file] { padding: 9px; background: #fff; }
.help { font-size: 12px; color: var(--soft); }
.field-check { justify-content: flex-end; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500 !important; font-size: 14px !important; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--forest); margin: 0; }
.check-options { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.color-pair { display: grid; grid-template-columns: 52px 1fr; gap: 8px; }
.color-pair input[type=color] { height: 44px; padding: 3px; cursor: pointer; }
.action-row { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.action-row.center { justify-content: center; }
.action { appearance: none; display: inline-flex; align-items: center; border: 0; background: var(--forest); color: #fff; padding: 11px 16px; border-radius: 7px; font: 700 14px var(--sans); cursor: pointer; text-decoration: none; }
.action:hover { background: var(--forest-2); color: #fff; }
.action.secondary { background: #e9eee7; color: var(--ink); }
.action.secondary:hover { background: #dde5da; color: var(--ink); }
.noscript { grid-column: 1 / -1; margin: 0; padding: 12px 14px; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 8px; font-size: 14px; }

/* results */
.result { grid-column: 1 / -1; padding: 16px; border-radius: 8px; background: #f2f6ee; border: 1px solid #e1e9d8; font-size: 15px; overflow-wrap: anywhere; min-width: 0; }
.result:empty { display: none; }
.result > * + * { margin-top: 12px; }
.result p { margin: 0; }
.result h3 { font-size: 15px; margin: 18px 0 0; }
.big-result strong { display: block; font-size: clamp(22px, 4vw, 30px); line-height: 1.2; color: var(--forest); letter-spacing: -.02em; }
.big-result span { display: block; color: var(--muted); font-size: 14px; margin-top: 4px; }
.big-result.ok strong { color: var(--ok); }
.error strong { color: var(--bad); }
.note { font-size: 13px; color: var(--muted); }
.note.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 6px; padding: 8px 10px; color: #5b4a12; }
.kv { display: grid; gap: 6px; margin: 0; }
.kv div { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; gap: 10px; border-top: 1px solid #e1e9d8; padding-top: 6px; }
.kv dt { color: var(--muted); font-size: 14px; }
.kv dd { margin: 0; font-weight: 600; font-size: 14px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
table.data caption { text-align: left; font-weight: 700; padding: 0 0 6px; }
table.data th, table.data td { padding: 7px 9px; border-bottom: 1px solid #e3e9e1; text-align: left; vertical-align: top; }
table.data thead th { background: #eaf0e6; font-size: 13px; }
table.data tbody th { font-weight: 600; }
.output { width: 100%; min-height: 220px; border: 1px solid #cfd8cf; border-radius: 7px; background: #fff; padding: 11px 12px; font: 13px/1.5 var(--mono); color: var(--ink); resize: vertical; }
.snippet { margin: 0; padding: 10px 12px; background: #fff; border: 1px solid #f0caca; border-radius: 6px; font: 13px/1.5 var(--mono); overflow-x: auto; white-space: pre; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.stats b { display: block; font-size: 24px; letter-spacing: -.02em; color: var(--forest); }
.stats span { font-size: 12px; color: var(--muted); }
.top-words summary { cursor: pointer; font-weight: 600; }
.regex-preview { background: #fff; border: 1px solid #e1e9d8; border-radius: 6px; padding: 10px 12px; font: 13px/1.6 var(--mono); white-space: pre-wrap; max-height: 320px; overflow: auto; }
.regex-preview mark { background: #ffe58a; border-radius: 2px; padding: 0 1px; }
.regex-preview mark.empty { padding: 0; border-left: 2px solid #c58b00; }
.preview-box { border-radius: 8px; padding: 18px 20px; border: 1px solid #0000001a; }
.preview-box .sample-normal { font-size: 16px; margin: 0; }
.preview-box .sample-large { font-size: 24px; margin: 8px 0 0; font-weight: 400; }
.passwords { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.passwords li { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: #fff; border: 1px solid #e1e9d8; border-radius: 6px; padding: 8px 8px 8px 12px; }
.passwords code { font: 16px var(--mono); overflow-wrap: anywhere; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bar-label { display: block; font-size: 14px; }
.bar-track { display: block; height: 8px; background: #e2e9de; border-radius: 4px; overflow: hidden; margin-top: 3px; }
.bar { display: block; height: 100%; background: var(--forest); }
.resized-preview { display: block; max-width: 100%; height: auto; border: 1px solid #e1e9d8; border-radius: 6px; background: #fff; }
.timer-face { text-align: center; }
.timer { font: 700 clamp(56px, 14vw, 96px)/1 var(--sans); letter-spacing: -.04em; padding: 10px 0 18px; font-variant-numeric: tabular-nums; color: var(--forest); }
.sheet { background: #fff; border: 1px solid #e1e9d8; border-radius: 6px; padding: 12px; overflow: auto; }
.sheet svg { display: block; max-width: 100%; height: auto; margin: auto; }

/* guide content */
.guide, .faq, .related { margin-top: 44px; }
.guide h2, .faq h2, .related h2, .help-copy h2 { font-size: 25px; line-height: 1.25; letter-spacing: -.02em; margin: 36px 0 12px; }
.guide > h2:first-child { margin-top: 0; }
.guide h3 { font-size: 18px; margin: 26px 0 8px; }
.guide p, .guide li { font-size: 16px; line-height: 1.7; color: #2c3831; }
.guide ul, .guide ol { padding-left: 22px; }
.guide li + li { margin-top: 6px; }
.guide code, .faq code { font: 14px var(--mono); background: #e9eee6; border-radius: 4px; padding: 1px 5px; overflow-wrap: anywhere; }
.guide pre { font: 14px/1.55 var(--mono); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
.guide pre code { background: none; padding: 0; }
.guide .formula { font: 15px/1.6 var(--mono); background: #fff; border-left: 4px solid var(--accent); border-radius: 4px; padding: 10px 14px; overflow-x: auto; white-space: pre-wrap; }
.guide .example { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px 18px; margin: 14px 0; }
.guide .example h3 { margin-top: 14px; }
.guide table { width: 100%; border-collapse: collapse; background: #fff; font-size: 15px; }
.guide th, .guide td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.guide thead th { background: #eaf0e6; }
.guide .table-wrap { margin: 12px 0; }
.faq-item { padding: 16px 0; border-top: 1px solid var(--line); }
.faq-item h3 { font-size: 17px; margin: 0 0 6px; }
.faq-item p { font-size: 15px; color: #3a473f; line-height: 1.65; margin: 0; }
.related-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.related-list a { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); height: 100%; }
.related-list a:hover { border-color: #b9c9b2; box-shadow: var(--shadow); }
.related-list img { flex: none; border-radius: 8px; }
.related-list b { display: block; font-size: 15px; }
.related-list small { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.all-tools { margin-top: 16px; font-weight: 600; }

/* legal pages */
.help-copy h1 { font-size: clamp(30px, 5vw, 44px); letter-spacing: -.03em; margin: 0 0 16px; }
.help-copy p, .help-copy li { font-size: 15px; line-height: 1.75; color: #3a473f; }
.company-details { margin: 24px 0; padding: 18px 20px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.company-details h2 { font-size: 18px !important; margin: 0 0 10px !important; }
.company-details p { font-size: 14px; line-height: 1.8; margin: 0; }
.last-updated { color: var(--soft); font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
  .tool-form { grid-template-columns: 1fr; }
  .tool-card { padding: 16px; border-radius: 10px; }
  .site-header nav a[href="/#guide"], .site-header nav a[href="/#faq"] { display: none; }
  .site-footer { grid-template-columns: 1fr; }
  .kv div { grid-template-columns: 1fr; gap: 2px; }
  .guide h2, .faq h2, .related h2 { font-size: 22px; }
  .lede { font-size: 16px; }
  .breadcrumbs ol { margin-bottom: 18px; }
}

/* printing: the grid tool prints only its sheet; other tools print their result */
@page { size: A4; margin: 10mm; }
@page letter { size: letter; margin: 10mm; }
@media print {
  body { background: #fff; }
  .site-header, .site-footer, .breadcrumbs, .tool-intro, .guide, .faq, .related, .tool-form > .field, .tool-form > .action-row, .result > .action-row { display: none !important; }
  .tool-main { padding: 0; max-width: none; }
  .tool-card { border: 0; box-shadow: none; padding: 0; }
  .result { border: 0; background: #fff; padding: 0; }
  body[data-tool="print"] .result > :not(.sheet) { display: none !important; }
  .sheet { border: 0; padding: 0; overflow: visible; }
  .sheet svg { max-width: none; margin: 0 auto; }
  .sheet.page-letter { page: letter; }
}

/* per-tool accent (generated) */
body[data-tool="convert"]{--accent:#2563eb}
body[data-tool="time"]{--accent:#0e7490}
body[data-tool="calendar"]{--accent:#dc2626}
body[data-tool="words"]{--accent:#7c3aed}
body[data-tool="case"]{--accent:#db2777}
body[data-tool="csv"]{--accent:#15803d}
body[data-tool="json"]{--accent:#ca8a04}
body[data-tool="regex"]{--accent:#4338ca}
body[data-tool="color"]{--accent:#ea580c}
body[data-tool="image"]{--accent:#0891b2}
body[data-tool="percentage"]{--accent:#16a34a}
body[data-tool="password"]{--accent:#111827}
body[data-tool="finance"]{--accent:#047857}
body[data-tool="budget"]{--accent:#9333ea}
body[data-tool="loan"]{--accent:#1d4ed8}
body[data-tool="cook"]{--accent:#f97316}
body[data-tool="study"]{--accent:#e11d48}
body[data-tool="print"]{--accent:#475569}
