/* Treco Drive: calm and plain, like treco.fi: warm white, dark text, one dark primary button. */
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #1f1d1a; background: #fbf9f4; }
a { color: #1d4f7a; }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .4rem; }
.brand { font-weight: 800; letter-spacing: -.02em; }
.muted { color: #6b665e; }
.error { color: #a12a1c; }
.empty { color: #6b665e; font-style: italic; }
.notice { background: #fff4d6; border: 1px solid #ecd58a; padding: .8rem 1rem; border-radius: 8px; }

.top { display: flex; align-items: center; gap: 1.2rem; padding: .7rem 1.2rem; background: #fff; border-bottom: 1px solid #e6e1d6; position: sticky; top: 0; z-index: 5; }
.logo { font-size: 1.2rem; color: inherit; text-decoration: none; white-space: nowrap; }
.top-search { flex: 1; max-width: 520px; }
.top-search input { width: 100%; }
#nav { display: flex; gap: 1rem; align-items: center; margin-left: auto; white-space: nowrap; }
#nav a { color: inherit; }
.who { color: #6b665e; }

.layout { display: grid; grid-template-columns: 270px 1fr; min-height: calc(100vh - 56px); }
.tree { border-right: 1px solid #e6e1d6; padding: 1rem; background: #f6f3ec; overflow: auto; }
.tree h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: #6b665e; margin: 1.2rem 0 .3rem; }
.tree h2 a { color: inherit; text-decoration: none; }
.tree ul { list-style: none; margin: 0; padding-left: .9rem; }
.tree > ul { padding-left: 0; }
.tree li { margin: .15rem 0; }
.tree a { text-decoration: none; color: #2b2925; }
.tree a.active { font-weight: 700; color: #000; }
.tree a.locked, .subfolders a.locked { color: #8c877d; }
.tree-home { font-weight: 600; }
.main { padding: 1.4rem 2rem 3rem; min-width: 0; }

input, select, button, textarea { font: inherit; }
input, select { padding: .45rem .6rem; border: 1px solid #cfc8b9; border-radius: 6px; background: #fff; }
.button { display: inline-block; padding: .5rem 1rem; border-radius: 6px; border: 1px solid #1f1d1a; background: #fff; color: #1f1d1a; cursor: pointer; text-decoration: none; }
.button.primary { background: #1f1d1a; color: #fff; }
.button.danger { border-color: #a12a1c; color: #a12a1c; }
.button:disabled { opacity: .6; cursor: default; }
button.link { background: none; border: 0; color: #1d4f7a; cursor: pointer; padding: 0; text-decoration: underline; }

.big-search { display: flex; gap: .6rem; margin-bottom: 1rem; max-width: 760px; }
.big-search input { flex: 1; font-size: 1.05rem; padding: .7rem .9rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .6rem 0 1rem; }

table { border-collapse: collapse; width: 100%; background: #fff; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid #eee8dc; vertical-align: top; }
th { font-size: .82rem; color: #6b665e; font-weight: 600; }
td.soon { color: #a15c00; font-weight: 600; }
.snippet { font-size: .85rem; color: #6b665e; white-space: pre-line; }
mark { background: #ffe58a; }
.badge { display: inline-block; font-size: .78rem; padding: .05rem .5rem; border-radius: 999px; white-space: nowrap; }
.badge.s1 { background: #e7efe4; color: #2f5a26; }
.badge.s2 { background: #fdf0d5; color: #7a5300; }
.badge.s3 { background: #f9dcd8; color: #8a1f12; }
.level { font-size: .8rem; font-weight: 500; color: #6b665e; margin-left: .8rem; }
.crumbs { font-size: .9rem; color: #6b665e; margin-bottom: .4rem; }
.subfolders { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; }
.subfolders a { display: block; padding: .5rem .8rem; background: #fff; border: 1px solid #e6e1d6; border-radius: 8px; text-decoration: none; color: inherit; }

.panel { margin-top: 1.2rem; background: #fff; border: 1px solid #e6e1d6; border-radius: 8px; padding: .6rem 1rem; }
.panel summary { cursor: pointer; font-weight: 600; }
.drop { border: 2px dashed #cfc8b9; border-radius: 8px; padding: 1.6rem; text-align: center; cursor: pointer; margin: .8rem 0 .4rem; background: #fbf9f4; }
.drop.over { border-color: #1f1d1a; background: #f1ede3; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .6rem 1rem; margin: .8rem 0; }
.fields label { display: flex; flex-direction: column; font-size: .85rem; color: #6b665e; gap: .2rem; }
.fields .wide { grid-column: 1 / -1; }
.fields button { justify-self: start; }

.actions { display: flex; gap: .6rem; margin-bottom: 1rem; }
.file-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.5rem; }
.preview { background: #fff; border: 1px solid #e6e1d6; border-radius: 8px; min-height: 300px; overflow: auto; }
.preview iframe { width: 100%; height: 78vh; border: 0; display: block; }
.preview img { max-width: 100%; display: block; margin: auto; }
.preview pre { padding: 1rem; white-space: pre-wrap; margin: 0; }
.preview > p { padding: 1rem; }
.side .panel .fields { grid-template-columns: 1fr; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; }
.facts dt { color: #6b665e; }
.facts dd { margin: 0; }
.versions { padding-left: 1.1rem; font-size: .9rem; }
.named select { width: 100%; margin: .4rem 0; }
.tabs { display: flex; gap: .3rem; padding: .5rem .5rem 0; border-bottom: 1px solid #e6e1d6; }
.tab { border: 1px solid #e6e1d6; border-bottom: 0; background: #f6f3ec; padding: .3rem .8rem; border-radius: 6px 6px 0 0; cursor: pointer; }
.tab.active { background: #fff; font-weight: 600; }
.sheet { overflow: auto; }
.grid td, .grid th { white-space: nowrap; }
.audit td.detail { white-space: normal; font-size: .82rem; color: #6b665e; max-width: 380px; word-break: break-word; }
.customers li { margin: .3rem 0; }
.group { background: #fff; border: 1px solid #e6e1d6; border-radius: 8px; padding: .2rem 1rem .6rem; margin: .8rem 0; }

.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: #1f1d1a; color: #fff; padding: .6rem 1.1rem; border-radius: 8px; z-index: 20; }
.toast.bad { background: #a12a1c; }

.login { display: grid; place-items: center; min-height: 100vh; }
.login-box { background: #fff; padding: 2.2rem; border-radius: 12px; border: 1px solid #e6e1d6; max-width: 420px; width: 100%; display: flex; flex-direction: column; gap: .8rem; }
.login-box h1 { margin: 0; }
#demo, #demo-people { display: flex; flex-direction: column; gap: .6rem; }
.note { font-size: .85rem; color: #6b665e; margin: 0; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .tree { border-right: 0; border-bottom: 1px solid #e6e1d6; max-height: 40vh; }
  .file-layout { grid-template-columns: 1fr; }
  .top { flex-wrap: wrap; }
  .main { padding: 1rem; }
}
