/* FML Portal. Same palette and type as FML Concierge: teal on warm paper, Inter, soft layered shadows. */
@font-face { font-family: "Inter"; src: url("/static/fonts/Inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --teal: #2E7D74; --teal-600: #286E66; --teal-700: #22605A; --teal-900: #17433F; --teal-50: #EEF6F3; --teal-100: #DDEDE8;
  --bg: #F6F3ED; --surface: #FFFDFA; --ink: #1F2A29; --ink-2: #44514F; --muted: #7A8684;
  --hair: rgba(31, 42, 41, .08); --hair-2: rgba(31, 42, 41, .12);
  --sand: #F1E9DB; --amber: #A9701B; --amber-50: #FBF2E2; --rose: #AE4E44; --rose-50: #F9E9E6; --blue: #36698A; --blue-50: #E6EFF5;
  --r-lg: 18px; --r-md: 12px;
  --shadow-sm: 0 1px 2px rgba(23, 67, 63, .05);
  --shadow: 0 1px 2px rgba(23, 67, 63, .04), 0 6px 20px -6px rgba(23, 67, 63, .10);
  --shadow-lg: 0 2px 4px rgba(23, 67, 63, .05), 0 16px 40px -12px rgba(23, 67, 63, .22);
  --side: 272px; --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.5 "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif; color: var(--ink); background: var(--bg);
       -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.02em; margin: 0; font-weight: 650; }
.muted { color: var(--muted); margin: 6px 0 0; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); height: 100vh; transition: grid-template-columns .28s var(--ease); }
.app.collapsed { --side: 68px; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }

/* ---------- sidebar ---------- */
.side { display: flex; flex-direction: column; min-height: 0; padding: 16px 12px 12px; background: var(--surface); border-right: 1px solid var(--hair); overflow: hidden; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 4px 14px; }
.brand b { display: block; font-size: 15px; letter-spacing: -.01em; }
.brand small { display: block; color: var(--muted); font-size: 12px; margin-top: -1px; white-space: nowrap; }
.brand-text { flex: 1; min-width: 0; }
.mark { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px; color: #fff; font-weight: 700;
        background: linear-gradient(145deg, var(--teal), var(--teal-900)); box-shadow: var(--shadow-sm); }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--muted); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--teal-50); color: var(--teal-700); }

.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px; margin: 0 2px 10px; border: 1px solid var(--hair-2); border-radius: var(--r-md);
          background: #fff; color: var(--muted); transition: border-color .15s, box-shadow .15s; }
.search:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-50); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); }
.search input::-webkit-search-cancel-button { display: none; }
kbd { font: 600 10.5px "Inter", sans-serif; color: var(--muted); border: 1px solid var(--hair-2); border-radius: 6px; padding: 1px 5px; white-space: nowrap; }

#nav { flex: 1; overflow-y: auto; margin: 4px -4px 0; padding: 0 4px 8px; scrollbar-width: thin; scrollbar-color: var(--hair-2) transparent; }
.group-name { margin: 16px 10px 5px; font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 10px; text-align: left; color: var(--ink-2);
            transition: background .15s, color .15s, transform .15s var(--ease); position: relative; }
.nav-item:hover { background: var(--teal-50); color: var(--teal-900); }
.nav-item:active { transform: scale(.985); }
.nav-item.active { background: var(--teal-50); color: var(--teal-900); font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--teal); }
.nav-icon { display: grid; place-items: center; width: 20px; flex: none; color: var(--muted); }
.nav-item.active .nav-icon, .nav-item:hover .nav-icon { color: var(--teal); }
.nav-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px var(--teal-100); }
.side-foot { border-top: 1px solid var(--hair); padding-top: 8px; margin: 0; }
.home-link { margin-bottom: 2px; }

.app.collapsed .brand-text, .app.collapsed .search, .app.collapsed .nav-text, .app.collapsed .group-name { display: none; }
.app.collapsed .brand { flex-direction: column; padding-bottom: 10px; }
.app.collapsed .nav-item { justify-content: center; padding: 10px 0; }
.app.collapsed .dot { position: absolute; top: 6px; right: 10px; }
.app.collapsed .group-sep { height: 1px; background: var(--hair); margin: 8px 10px; }

/* ---------- tabs ---------- */
.tabs { display: flex; align-items: center; gap: 8px; padding: 8px 12px 0 14px; background: var(--surface); border-bottom: 1px solid var(--hair); }
.tab-list { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tab-list::-webkit-scrollbar { display: none; }
.tab { display: flex; align-items: center; gap: 8px; max-width: 230px; padding: 8px 8px 9px 13px; border-radius: 11px 11px 0 0; color: var(--ink-2); white-space: nowrap;
       border: 1px solid transparent; border-bottom: 0; transition: background .15s, color .15s; animation: tab-in .25s var(--ease); }
.tab:hover { background: var(--teal-50); }
.tab.active { background: var(--bg); color: var(--teal-900); font-weight: 600; border-color: var(--hair); margin-bottom: -1px; padding-bottom: 10px; }
.tab-name { overflow: hidden; text-overflow: ellipsis; }
.tab-close { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; color: var(--muted); }
.tab-close:hover { background: var(--rose-50); color: var(--rose); }
.tab-close svg { width: 12px; height: 12px; stroke-width: 2; }
.tab-actions { display: flex; gap: 2px; padding-bottom: 6px; }
@keyframes tab-in { from { opacity: 0; transform: translateY(4px); } }

.loadbar { position: absolute; left: 0; right: 0; height: 2px; z-index: 5; overflow: hidden; background: var(--teal-100); }
.loadbar::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--teal); border-radius: 2px; animation: slide 1.1s var(--ease) infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* ---------- views ---------- */
.view, #frames { flex: 1; min-height: 0; }
#frames { position: relative; display: none; }
.main.tool #frames { display: block; }
.main.tool #home { display: none; }
iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; visibility: hidden; }
iframe.active { visibility: visible; }

.home { overflow-y: auto; padding: 34px clamp(20px, 4vw, 52px) 60px; }
.home-head { margin-bottom: 8px; }
.section-title { display: flex; align-items: center; gap: 9px; margin: 30px 0 12px; font-size: 12px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.section-title svg { color: var(--teal); width: 16px; height: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; gap: 10px; padding: 18px 18px 16px; text-align: left; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--r-lg);
        box-shadow: var(--shadow-sm); transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s; animation: rise .4s var(--ease) backwards; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--teal-100); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card h3 { margin: 0; font-size: 15.5px; letter-spacing: -.01em; font-weight: 620; }
.card p { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.badge { flex: none; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 650; background: var(--teal-50); color: var(--teal-700); white-space: nowrap; }
.badge.agentic { background: linear-gradient(135deg, var(--teal), var(--teal-900)); color: #fff; }
.badge.voice { background: var(--blue-50); color: var(--blue); }
.badge.download, .badge.search { background: var(--amber-50); color: var(--amber); }
.steps { margin: 2px 0 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 5px; color: var(--muted); font-size: 12.5px; }
.steps li { counter-increment: s; display: flex; gap: 8px; }
.steps li::before { content: counter(s); display: grid; place-items: center; width: 17px; height: 17px; flex: none; margin-top: 1px; border-radius: 50%; background: var(--sand); color: var(--ink-2); font-size: 10.5px; font-weight: 650; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 8px; }
.is-open { display: flex; align-items: center; gap: 7px; color: var(--teal-700); font-size: 12.5px; font-weight: 600; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 15px; border-radius: 10px; font-weight: 600; font-size: 13.5px;
       border: 1px solid var(--hair-2); background: #fff; color: var(--ink); transition: background .15s, transform .15s var(--ease), box-shadow .15s; text-decoration: none; }
.btn:hover { background: var(--teal-50); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: var(--teal-600); }
.btn svg { width: 15px; height: 15px; }
.btn[disabled] { opacity: .7; cursor: default; }
.btn.busy span { opacity: 0; }
.btn.busy::after { content: ""; position: absolute; width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn { position: relative; }
@keyframes spin { to { transform: rotate(360deg); } }

.open-now { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding: 12px 14px; border-radius: var(--r-md); background: var(--teal-50); color: var(--teal-900); font-size: 13.5px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; background: #fff; border: 1px solid var(--teal-100); font-weight: 600; font-size: 12.5px; color: var(--teal-900); }
.chip:hover { border-color: var(--teal); }
.empty { text-align: center; color: var(--muted); padding: 50px 0; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: var(--teal-900); color: #fff; font-size: 13.5px; box-shadow: var(--shadow-lg); z-index: 20; animation: rise .25s var(--ease); }

/* ---------- sign-in ---------- */
body.login { display: grid; place-items: center; padding: 20px;
             background: radial-gradient(1100px 520px at 12% -10%, var(--teal-100), transparent 60%), radial-gradient(900px 500px at 105% 110%, var(--sand), transparent 55%), var(--bg); }
.login-card { width: min(400px, 100%); padding: 30px 30px 24px; background: var(--surface); border: 1px solid var(--hair); border-radius: 22px; box-shadow: var(--shadow-lg); animation: rise .45s var(--ease); }
.login-card .brand { padding: 0 0 22px; }
.login-card form { display: grid; gap: 8px; margin-top: 22px; }
.login-card label { font-weight: 600; font-size: 13px; }
.login-card input { height: 44px; padding: 0 13px; border: 1px solid var(--hair-2); border-radius: var(--r-md); background: #fff; outline: 0; transition: border-color .15s, box-shadow .15s; }
.login-card input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-50); }
.login-card .btn { height: 44px; margin-top: 8px; font-size: 14.5px; }
.error { margin: 2px 0 0; padding: 8px 11px; border-radius: 10px; background: var(--rose-50); color: var(--rose); font-size: 13px; }
.fine { margin: 16px 0 0; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ---------- smaller windows (Windows laptops, half-screen) ---------- */
@media (max-width: 1100px) { .app:not(.expanded) { --side: 68px; }
  .app:not(.expanded) .brand-text, .app:not(.expanded) .search, .app:not(.expanded) .nav-text, .app:not(.expanded) .group-name { display: none; }
  .app:not(.expanded) .brand { flex-direction: column; padding-bottom: 10px; }
  .app:not(.expanded) .nav-item { justify-content: center; padding: 10px 0; }
  .app:not(.expanded) .dot { position: absolute; top: 6px; right: 10px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
