/* Looks like the FileMaker screens: dark title bar, blue nav buttons, grey panels, striped lists. No grids. */
:root {
  --bar: #2b2b2b; --bg: #e2e2e2; --panel: #dedede; --line: #c4c4c4; --stripe-a: #f2f2f2; --stripe-b: #e5e5e5;
  --sel: #c3c3c3; --blue1: #3c92ea; --blue2: #1869c9; --btn: #6c6c6c; --text: #1d1d1d; --muted: #666;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 13px/1.35 -apple-system, "Helvetica Neue", Arial, sans-serif; color: var(--text); background: var(--bg); }
#app { height: 100%; display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; color: inherit; }

/* title bar */
.topbar { background: var(--bar); height: 54px; flex: none; display: flex; align-items: center; padding: 0 8px; gap: 12px; color: #fff; }
.nav { display: flex; }
.nav a { background: linear-gradient(#3f95ec, #1a69c8); color: #fff; font-size: 11px; font-weight: 700; text-decoration: none; padding: 5px 15px; border-left: 1px solid #6aaaf0; border-right: 1px solid #0f4f9c; }
.nav a:first-child { border-radius: 4px 0 0 4px; } .nav a:last-child { border-radius: 0 4px 4px 0; }
.nav a.on { background: linear-gradient(#1a69c8, #0f58ad); box-shadow: inset 0 1px 3px rgba(0,0,0,.45); }
.title { flex: 1; text-align: center; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who { font-size: 11px; color: #bbb; display: flex; gap: 10px; align-items: center; }
.who a, .linklike { color: #9cc7ff; cursor: pointer; background: none; border: 0; padding: 0; text-decoration: underline; font-size: inherit; }
.main { flex: 1; min-height: 0; display: flex; }
.scroll { overflow: auto; }

/* buttons */
.btn { background: linear-gradient(#7d7d7d, #5a5a5a); color: #fff; border: 1px solid #4a4a4a; border-radius: 4px; padding: 4px 11px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: linear-gradient(#8a8a8a, #656565); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { padding: 2px 8px; font-size: 11px; }
.btn.blue { background: linear-gradient(#3f95ec, #1a69c8); border-color: #0f4f9c; }
.btn.danger { background: linear-gradient(#d65a50, #b03328); border-color: #8b241b; }
.btn.light { background: linear-gradient(#fff, #e6e6e6); color: #222; border-color: #aaa; }
.x { background: #8a8a8a; color: #fff; border: 0; border-radius: 50%; width: 20px; height: 20px; line-height: 18px; cursor: pointer; font-size: 12px; padding: 0; flex: none; }
.x:hover { background: #b03328; }

/* inputs */
input[type=text], input[type=search], input[type=email], input[type=tel], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  background: #fff; border: 1px solid #c2c2c2; border-radius: 2px; padding: 4px 6px; width: 100%; min-width: 0;
}
textarea { resize: vertical; line-height: 1.4; }
input:focus, select:focus, textarea:focus { outline: 2px solid #5da5f1; outline-offset: -1px; }
input[type=checkbox] { width: 14px; height: 14px; margin: 0 6px 0 0; vertical-align: -2px; }
.saved-flag { font-size: 11px; color: #2c7a2c; min-width: 90px; text-align: right; }
.saved-flag.err { color: #b03328; font-weight: 700; }

/* lists (striped rows, FileMaker style) */
.rows > .row { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 4px 10px; background: var(--stripe-a); cursor: default; }
.rows > .row:nth-child(even) { background: var(--stripe-b); }
.rows > .row.sel { background: var(--sel); }
.rows > .row.click { cursor: pointer; }
.rows > .row.click:hover { background: #d3e5fb; }
.row .name { font-weight: 700; }
.row .sub { font-size: 11px; color: var(--muted); }
.row .grow { flex: 1; min-width: 0; }
.row .ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb { width: 74px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center; }
.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.counts { font-size: 11px; color: #444; text-align: left; min-width: 82px; }
.chips { display: flex; gap: 3px; flex-wrap: wrap; width: 130px; flex: none; }
.chip { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 9px; background: #fff; border: 1px solid #aaa; color: #333; }
.chip.v { background: #b4202d; border-color: #b4202d; color: #fff; }
.chip.p { background: #1c4f8a; border-color: #1c4f8a; color: #fff; }
.chip.t { background: #2d7a4a; border-color: #2d7a4a; color: #fff; }

/* toolbar over lists */
.toolbar { display: flex; gap: 8px; align-items: center; padding: 8px 10px; background: var(--bg); flex: none; }
.toolbar .grow { flex: 1; }
.toolbar input[type=search] { max-width: 320px; border-radius: 12px; }
.count-line { font-weight: 700; padding: 0 10px; white-space: nowrap; }

/* company details split view */
.side { width: 270px; flex: none; display: flex; flex-direction: column; background: #f2f2f2; border-right: 1px solid var(--line); }
.side .toolbar { background: #e8e8e8; padding: 6px; }
.side .rows { flex: 1; overflow: auto; }
.side .rows > .row { min-height: 24px; padding: 3px 8px; font-size: 12px; }
.detail { flex: 1; min-width: 0; padding: 8px 10px 20px; overflow: auto; }
.head { display: flex; gap: 10px; align-items: flex-start; }
.head .left { flex: 1; min-width: 0; }
.bigname { font-size: 15px; font-weight: 600; padding: 7px 8px; background: #fff; border: 1px solid #c2c2c2; border-radius: 2px; width: 100%; }
.logos { display: flex; gap: 6px; flex: none; }
.drop { border: 2px dashed transparent; border-radius: 4px; position: relative; background: #fff; display: flex; align-items: center; justify-content: center; text-align: center; color: #888; font-size: 11px; padding: 4px; }
.drop.over { border-color: #1a69c8; background: #e6f1ff; color: #1a69c8; }
.drop img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.drop.logo { width: 200px; height: 62px; }
.drop.mini { width: 74px; height: 62px; }
.drop.card { width: 150px; height: 96px; }
.drop.pic { width: 96px; height: 96px; }
.drop.attach { min-height: 56px; margin: 6px; border: 2px dashed #aaa; background: #f0f0f0; flex-direction: column; gap: 4px; padding: 10px; }
.drop .tag { position: absolute; left: 2px; bottom: 2px; font-size: 9px; background: rgba(0,0,0,.55); color: #fff; padding: 0 4px; border-radius: 2px; }

.tabs { display: flex; gap: 2px; margin-top: 8px; align-items: flex-end; }
.tabs button { background: #b9b9b9; border: 1px solid #9c9c9c; border-bottom: 0; border-radius: 4px 4px 0 0; padding: 3px 11px; font-size: 11px; font-weight: 700; color: #333; cursor: pointer; }
.tabs button.on { background: var(--panel); color: #000; position: relative; top: 1px; }
.tabs .grow { flex: 1; }
.panel { background: var(--panel); border: 1px solid #9c9c9c; padding: 14px 16px; min-height: 420px; }
.form { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 7px 8px; align-items: center; }
.form > label { text-align: right; font-weight: 700; font-size: 12px; color: #333; }
.cols2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 24px; }
.inline { display: flex; gap: 6px; align-items: center; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 3px 10px; }
.checks label { display: flex; align-items: center; font-size: 12px; cursor: pointer; }
.group-title { font-weight: 700; margin: 14px 0 4px; }
.box { background: #ececec; border: 1px solid #bbb; border-radius: 2px; }
.box-title { font-weight: 700; margin: 12px 0 4px; display: flex; align-items: center; gap: 8px; }
.attrow { display: flex; gap: 8px; align-items: center; padding: 5px 8px; min-height: 46px; }
.attrow:nth-child(even) { background: #e2e2e2; }
.attrow .preview { width: 60px; height: 38px; flex: none; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid #ccc; font-size: 10px; color: #777; }
.attrow .preview img { max-width: 100%; max-height: 100%; }
.kv { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 2px 12px; font-size: 12px; }
.kv > div:nth-child(odd) { text-align: right; color: #555; font-weight: 700; }
.kv > div:nth-child(even) { word-break: break-word; white-space: pre-wrap; }
.note-card { background: #fff; border: 1px solid #c6c6c6; border-radius: 3px; padding: 8px 10px; margin-bottom: 8px; }
.note-card .meta { font-size: 11px; color: #666; margin-bottom: 4px; display: flex; gap: 10px; align-items: center; }
.note-card pre { margin: 0; white-space: pre-wrap; font: inherit; }
.meeting-grid { display: flex; gap: 10px; padding: 0 10px 10px; flex: 1; min-height: 0; }
.meeting-left { width: 190px; flex: none; background: var(--panel); border: 1px solid #aaa; padding: 12px; display: flex; flex-direction: column; gap: 8px; align-self: flex-start; }
.meeting-right { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.meeting-right textarea { flex: 1; min-height: 360px; }
.field-label { font-weight: 700; font-size: 12px; margin-top: 6px; }

/* misc */
.page { padding: 14px 18px; overflow: auto; flex: 1; }
.page h2 { margin: 0 0 8px; font-size: 16px; }
.card { background: #f4f4f4; border: 1px solid #c4c4c4; border-radius: 4px; padding: 12px 14px; margin-bottom: 12px; }
.muted { color: var(--muted); }
.warn { background: #fff3cd; border: 1px solid #e0c870; padding: 6px 10px; border-radius: 3px; }
.center { text-align: center; }
.empty { padding: 30px; text-align: center; color: #777; }
.login { margin: 12vh auto 0; width: 330px; background: #f4f4f4; border: 1px solid #bbb; border-radius: 6px; padding: 22px; }
.login h1 { font-size: 18px; margin: 0 0 14px; text-align: center; }
.login label { display: block; font-weight: 700; margin: 8px 0 3px; }
.login .btn { margin-top: 14px; width: 100%; padding: 7px; }
.err-text { color: #b03328; margin-top: 8px; }
.toast-wrap { position: fixed; right: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 6px; z-index: 50; }
.toast { background: #333; color: #fff; padding: 8px 14px; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.35); max-width: 380px; }
.toast.err { background: #a8281d; }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 40; }
.modal { background: #f2f2f2; border-radius: 6px; padding: 16px 18px; min-width: 340px; max-width: 560px; max-height: 85vh; overflow: auto; box-shadow: 0 6px 30px rgba(0,0,0,.4); }
.modal h3 { margin: 0 0 10px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.progress { height: 6px; background: #ccc; border-radius: 3px; overflow: hidden; width: 100%; }
.progress > div { height: 100%; background: #1a69c8; width: 0; transition: width .1s; }
.suggest { position: absolute; z-index: 30; background: #fff; border: 1px solid #999; border-radius: 3px; box-shadow: 0 3px 10px rgba(0,0,0,.25); max-height: 260px; overflow: auto; min-width: 280px; }
.suggest div { padding: 5px 9px; cursor: pointer; }
.suggest div:hover, .suggest div.on { background: #d3e5fb; }
.rel { position: relative; }
.pill { display: inline-block; font-size: 11px; background: #e6f1ff; border: 1px solid #9cc2ee; border-radius: 9px; padding: 0 7px; }

@media (max-width: 900px) {
  .side { display: none; }
  .cols2 { grid-template-columns: 1fr; }
  .meeting-grid { flex-direction: column; } .meeting-left { width: 100%; }
  .chips, .counts { display: none; }
  .form { grid-template-columns: 90px minmax(0, 1fr); }
}
@media print { .topbar, .side, .toolbar, .tabs, .btn, .x { display: none !important; } }
