/* Office app layout. Colours and buttons come from theme.css (Get Amped style guide). */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.testbar { background: var(--ga-warn-bg); color: var(--ga-warn); text-align: center; font-weight: 700; font-size: 13px; padding: 6px 12px; border-bottom: 1px solid var(--ga-warn); }

.login { min-height: 80vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; text-align: center; padding: 28px 24px; }
.login-logo { width: 220px; max-width: 100%; height: auto; }
.login-card form { text-align: left; margin-top: 8px; }
.login-card input { width: 100%; font-size: 22px; letter-spacing: .3em; text-align: center; }
.login-card .ga-btn { margin-top: 14px; }

.shell { display: grid; grid-template-columns: 200px 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; background: var(--ga-card); border-bottom: 3px solid var(--ga-blue); padding: 8px 16px; position: sticky; top: 0; z-index: 20; }
.toplogo { height: 36px; width: auto; display: block; }
.brandlink { display: inline-block; line-height: 0; }
.search { flex: 1; max-width: 460px; margin-left: auto; }
.search input { width: 100%; }
.search-results { position: absolute; top: 58px; right: 16px; width: min(460px, calc(100vw - 32px)); max-height: 70vh; overflow: auto; z-index: 30; padding: 6px 0; }
.search-results a { display: block; padding: 8px 14px; color: var(--ga-text); text-decoration: none; }
.search-results a:hover, .search-results a:focus { background: var(--ga-soft); }
.search-results h4 { margin: 6px 14px 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ga-muted); }
.nav { background: var(--ga-card); border-right: 1px solid var(--ga-line); padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 55px; align-self: start; height: calc(100vh - 55px); }
.nav a { padding: 10px 12px; border-radius: 10px; color: var(--ga-text); text-decoration: none; font-weight: 600; }
.nav a:hover { background: var(--ga-plain); }
.nav a.on { background: var(--ga-soft); color: var(--ga-link); }
.view { padding: 18px 22px 60px; max-width: 1200px; width: 100%; }
.iconbtn { background: none; border: 0; font-size: 24px; color: var(--ga-text); padding: 4px 8px; cursor: pointer; }
.only-phone { display: none; }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .only-phone { display: inline-block; }
  .nav { position: fixed; top: 55px; left: 0; bottom: 0; width: 230px; z-index: 25; transform: translateX(-105%); transition: transform .15s; height: auto; box-shadow: 2px 0 12px rgba(0,0,0,.2); }
  .nav.open { transform: none; }
  .view { padding: 14px 12px 80px; }
  .search { max-width: none; }
  .toplogo { height: 30px; }
  table.list .hide-sm { display: none; }
}

h1.page { font-size: 22px; margin: 4px 0 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h1.page .sub { font-size: 15px; font-weight: 400; color: var(--ga-muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; align-items: start; }
.ga-card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ga-card h2 .ga-btn { text-transform: none; letter-spacing: 0; }
.empty { color: var(--ga-muted); font-style: normal; padding: 6px 0; }
.err { color: var(--ga-bad); white-space: pre-wrap; }
.small { font-size: 13px; }
.tiny-btn { font: inherit; font-size: 13px; font-weight: 600; border: 0; border-radius: 8px; padding: 6px 10px; min-height: 32px; cursor: pointer; background: var(--ga-plain); color: var(--ga-plain-text); }
.tiny-btn.bad { background: var(--ga-bad-bg); color: var(--ga-bad); }
.ga-btn.sm { padding: 6px 12px; min-height: 34px; font-size: 14px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar input[type=search], .toolbar select { min-width: 160px; }

table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ga-heading); background: var(--ga-soft); padding: 8px; }
table.list td { padding: 9px 8px; border-bottom: 1px solid var(--ga-line); vertical-align: top; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: var(--ga-soft); }
table.list td.num, table.list th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.list input, table.list select, table.list textarea { width: 100%; padding: 6px 8px; }
table.list td.tight { width: 1%; white-space: nowrap; }
.scroll-x { overflow-x: auto; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; }
.kv dt { color: var(--ga-muted); }
.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ga-muted); }
.form label.wide { grid-column: 1 / -1; }
.form input, .form select, .form textarea { width: 100%; font-size: 15px; }
.form textarea { min-height: 90px; resize: vertical; }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--ga-text) !important; font-size: 15px !important; }
.check input { width: auto !important; }

.note { border-left: 3px solid var(--ga-line); padding: 6px 0 6px 10px; margin-bottom: 8px; }
.note .meta { font-size: 12px; color: var(--ga-muted); }
.note .body { white-space: pre-wrap; word-break: break-word; }
.desc { white-space: pre-wrap; word-break: break-word; max-height: 360px; overflow: auto; }

.week { display: grid; grid-template-columns: repeat(7, minmax(120px, 1fr)); gap: 6px; overflow-x: auto; }
.day { background: var(--ga-card); border-radius: 12px; padding: 8px; min-height: 180px; box-shadow: var(--ga-shadow); }
.day.today { outline: 2px solid var(--ga-blue); }
.day h3 { font-size: 13px; margin: 0 0 6px; }
.visit { background: var(--ga-soft); border-left: 4px solid var(--ga-link); border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; font-size: 13px; cursor: pointer; }
.visit.urgent { border-left-color: var(--ga-bad); }
.visit.ai { border-left-style: dashed; }
.visit b { display: block; }

.money { font-variant-numeric: tabular-nums; }
.totals { margin-left: auto; width: min(320px, 100%); }
.totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.totals .grand { border-top: 2px solid var(--ga-charcoal); font-weight: 700; font-size: 17px; margin-top: 4px; padding-top: 6px; }

.dlg { border: 0; border-radius: 16px; padding: 0; width: min(640px, calc(100vw - 24px)); background: var(--ga-card); color: var(--ga-text); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.dlg::backdrop { background: rgba(0,0,0,.45); }
.dlg-inner { padding: 18px 20px; max-height: 85vh; overflow: auto; }
.dlg-inner h2 { margin-top: 0; font-size: 19px; }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
pre.code { background: var(--ga-bg); border-radius: 10px; padding: 10px; overflow: auto; font-size: 12px; max-height: 360px; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ga-charcoal); color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 50; box-shadow: 0 4px 16px rgba(0,0,0,.3); max-width: calc(100vw - 32px); }
.toast.bad { background: var(--ga-bad); }
.test-badge { background: var(--ga-warn-bg); color: var(--ga-warn); border: 1px solid var(--ga-warn); }
.stat { font-size: 28px; font-weight: 700; color: var(--ga-heading); }
.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 40; max-height: 240px; overflow: auto; padding: 4px 0; margin-top: 2px; }
.picker-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 12px; font: inherit; color: var(--ga-text); cursor: pointer; }
.picker-list button:hover { background: var(--ga-soft); }

/* Schedule: week / month switch and the month calendar */
.seg { display: inline-flex; gap: 0; margin-right: 6px; }
.seg .tiny-btn { border-radius: 0; }
.seg .tiny-btn:first-child { border-radius: 8px 0 0 8px; }
.seg .tiny-btn:last-child { border-radius: 0 8px 8px 0; }
.seg .tiny-btn.on { background: var(--ga-button); color: var(--ga-on-button); }
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.mhead { font-size: 12px; font-weight: 700; color: var(--ga-muted); text-align: center; padding: 4px 0; }
.mday { background: var(--ga-card); border-radius: 10px; padding: 4px 5px 6px; min-height: 104px; box-shadow: var(--ga-shadow); min-width: 0; position: relative; }
.mday.out { opacity: .45; }
.mday.wkend { background: var(--ga-soft); }
.mday.today { outline: 2px solid var(--ga-blue); }
.mnum { display: inline-block; font-size: 13px; font-weight: 700; color: var(--ga-text); text-decoration: none; padding: 1px 5px; border-radius: 6px; margin-bottom: 3px; }
.mnum:hover { background: var(--ga-soft); }
.mday.today .mnum { background: var(--ga-button); color: var(--ga-on-button); }
.mcount { display: none; }
.mvisit { font-size: 11.5px; line-height: 1.3; background: var(--ga-soft); border-left: 3px solid var(--ga-link); border-radius: 5px; padding: 2px 4px; margin-bottom: 3px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mvisit b { font-weight: 700; }
.mvisit.urgent { border-left-color: var(--ga-bad); }
.mvisit.ai { border-left-style: dashed; }
.mday.wkend .mvisit { background: var(--ga-card); }
@media (max-width: 700px) {
  .mday { min-height: 58px; padding: 3px; }
  .mvisit { display: none; }
  .mcount { display: block; margin: 2px auto 0; width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 50%; background: var(--ga-button); color: var(--ga-on-button); font-size: 12px; font-weight: 700; }
}

/* Tick boxes sit beside their words */
label.row, .form label.row { flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 8px; color: var(--ga-text); }
label.row input[type="checkbox"], .form label.row input[type="checkbox"] { width: 18px; height: 18px; flex: none; margin: 0; }
.nav .who { margin-top: auto; padding: 10px 12px; }

.req { border-top: 1px solid rgba(128,128,128,.25); padding: 12px 0; }
.req:first-of-type { border-top: 0; }
.req .kv { margin: 6px 0; }
.req details { margin-top: 6px; }
[data-sec][hidden] { display: none !important; }
