/*
  app.css — the look of the Telos CRM.

  Layout (plan Section 5.1): left sidebar on desktop, bottom bar on phones.
  Colours are defined once as variables below so the whole look can be
  changed in one place.  No build step: this file is used as written.
*/

:root {
  --navy: #1f3a5f;
  --blue: #2e74b5;
  --blue-soft: #e8eef5;
  --ink: #1d2433;
  --muted: #5b6577;
  --line: #d9dfe8;
  --bg: #f5f7fa;
  --card: #ffffff;
  --good: #1e7b4d;
  --good-soft: #e3f3ea;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --bad: #a3282a;
  --bad-soft: #fbe6e6;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.45 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; color: var(--navy); }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .6rem; color: var(--navy); }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- frame: sidebar + main ---------- */
/* The navy band is painted on the frame so it runs the full page height. */
.frame { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh;
         background: linear-gradient(to right, var(--navy) 220px, var(--bg) 220px); }
.sidebar { background: var(--navy); color: #fff; padding: 1rem .75rem; position: sticky; top: 0; height: 100vh; align-self: start; }
.brand { font-weight: 700; font-size: 1.15rem; padding: .25rem .6rem 1rem; letter-spacing: .02em; }
.brand span { color: #9cc3ea; font-weight: 500; }
.nav a { display: flex; justify-content: space-between; align-items: center; color: #dfe8f3;
         padding: .55rem .6rem; border-radius: 8px; margin-bottom: 2px; }
.nav a:hover, .nav a.active { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.badge { background: #f0b429; color: #222; border-radius: 999px; font-size: .75rem; padding: 0 .5rem; font-weight: 700; }
.sidebar .foot { position: absolute; bottom: 1rem; left: .75rem; right: .75rem; font-size: .85rem; color: #b8c7da; }
.sidebar .foot a { color: #dfe8f3; }

main { padding: 1.25rem 1.75rem 5rem; max-width: 1200px; width: 100%; }
.topbar { display: flex; gap: .75rem; align-items: center; margin-bottom: 1.25rem; }
.topbar form { flex: 1; }
.topbar input[type=search] { width: 100%; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem; background: #fff; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line); background: #fff;
       color: var(--ink); padding: .5rem .9rem; border-radius: 8px; cursor: pointer; font: inherit; }
.btn:hover { text-decoration: none; border-color: var(--blue); }
.btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.primary:hover { background: var(--navy); }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }

/* ---------- cards, grids, tables ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 1rem 0; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; }
.stat .label { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.3rem; font-weight: 650; color: var(--navy); }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfd; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap table { border: 0; }
.empty { color: var(--muted); padding: .75rem 0; }

/* ---------- pills ---------- */
.pill { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
        background: var(--blue-soft); color: var(--navy); white-space: nowrap; }
.pill.A { background: var(--bad-soft); color: var(--bad); }
.pill.B { background: var(--warn-soft); color: var(--warn); }
.pill.C { background: #eef0f3; color: var(--muted); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: 1rem 0; overflow-x: auto; }
.tabs a { padding: .55rem .8rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--navy); border-color: var(--blue); font-weight: 600; }

/* ---------- lists ---------- */
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: .6rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .75rem; align-items: baseline; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.timeline .when { width: 6.5rem; flex: none; color: var(--muted); font-size: .85rem; }
.timeline .kind { width: 5.5rem; flex: none; }

/* ---------- messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .6rem .9rem; border-radius: 8px; margin-bottom: .4rem; background: var(--blue-soft); }
.messages li.success { background: var(--good-soft); }
.messages li.error { background: var(--bad-soft); }

/* ---------- upload drop zone ---------- */
.dropzone { display: block; border: 2px dashed var(--line); border-radius: var(--radius); background: #fff; padding: 2.5rem 1rem;
            text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone.over { border-color: var(--blue); background: var(--blue-soft); }
.dropzone input { display: none; }
.dropzone .big { font-size: 1.1rem; font-weight: 600; color: var(--navy); }
.filelist { margin-top: .75rem; text-align: left; }

/* ---------- filing screen ---------- */
.filing { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 1rem; }
.suggest { list-style: none; padding: 0; margin: 0; }
.suggest li { border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; margin-bottom: .45rem; background: #fff; }
.suggest li.high { border-left: 4px solid var(--good); }
.suggest li.medium { border-left: 4px solid #f0b429; }
.suggest label { display: flex; gap: .6rem; align-items: baseline; cursor: pointer; }
.suggest input[type=checkbox] { transform: scale(1.25); }
.suggest .kind { font-size: .75rem; text-transform: uppercase; color: var(--muted); width: 4.5rem; flex: none; }
.suggest .why { font-size: .82rem; color: var(--muted); margin: .2rem 0 0 2.1rem; }
.keyfields dt { font-size: .78rem; color: var(--muted); text-transform: uppercase; }
.keyfields dd { margin: 0 0 .5rem; font-weight: 600; }
.preview { white-space: pre-wrap; font-size: .82rem; background: #fafbfd; border: 1px solid var(--line);
           border-radius: 8px; padding: .75rem; max-height: 420px; overflow: auto; }
select, input[type=text], input[type=search], input[type=password] {
  padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
.search-results { list-style: none; padding: 0; margin: .4rem 0 0; }
.search-results li { padding: .3rem 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }

/* ---------- login ---------- */
.login { max-width: 360px; margin: 12vh auto; }
.login input { width: 100%; margin-bottom: .75rem; }

/* ---------- phone layout ---------- */
.bottombar { display: none; }
@media (max-width: 800px) {
  .frame { grid-template-columns: 1fr; background: var(--bg); }
  .sidebar { display: none; }
  main { padding: 1rem 1rem 5.5rem; }
  .filing { grid-template-columns: 1fr; }
  .bottombar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: #fff;
               border-top: 1px solid var(--line); justify-content: space-around; padding: .35rem 0 calc(.35rem + env(safe-area-inset-bottom)); z-index: 10; }
  .bottombar a { display: flex; flex-direction: column; align-items: center; font-size: .72rem; color: var(--muted); min-width: 56px; }
  .bottombar a .ico { font-size: 1.2rem; line-height: 1.4; }
  .bottombar a.plus .ico { background: var(--blue); color: #fff; border-radius: 50%; width: 2.4rem; height: 2.4rem;
                           display: flex; align-items: center; justify-content: center; margin-top: -.9rem; font-size: 1.5rem; }
  .timeline .when { width: 4.8rem; }
  .hide-phone { display: none; }
}

/* ---------- Big Rocks (D-069) ---------- */
.rocks-grid { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 1rem; }
@media (max-width: 1000px) { .rocks-grid { grid-template-columns: 1fr; } }
.rocks-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; margin-bottom: .5rem; }
.rock-list { list-style: none; padding: 0; margin: 0 0 .75rem; }
.rock-list li { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.rock-list li form { margin: 0; }
.rock-list .check { width: 1.4rem; height: 1.4rem; flex: none; border: 2px solid var(--blue); border-radius: 6px; background: #fff;
                    color: #fff; font-weight: 700; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.rock-list li.done .check { background: var(--good); border-color: var(--good); }
.rock-list li.done .rock-title { text-decoration: line-through; color: var(--muted); }
.rock-title { font-weight: 600; }
.rock-edit summary { cursor: pointer; color: var(--blue); margin-top: .2rem; }
.rock-edit input[type=text], .rock-edit textarea, .rock-add input[type=text], .rock-add textarea {
  width: 100%; margin-top: .35rem; padding: .45rem .55rem; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.rock-add { display: grid; gap: .35rem; }
.rock-add .btn { justify-self: start; }
