
:root{
  --bg:#f4f7fb;
  --surface:#ffffff;
  --surface-soft:#f8fafc;
  --text:#1f2937;
  --muted:#6b7280;
  --line:#dbe3ec;
  --primary:#245b94;
  --primary-dark:#1c4775;
  --primary-soft:#eaf2fb;
  --sidebar:#eef3f8;
  --sidebar-text:#334155;
  --green:#2f855a;
  --green-bg:#edf8f2;
  --yellow:#b7791f;
  --yellow-bg:#fff8e8;
  --red:#c53030;
  --red-bg:#fff1f1;
  --shadow:0 5px 18px rgba(31,41,55,.06);
  --radius:12px;
}

*{box-sizing:border-box}
html,body{
  margin:0;
  min-height:100%;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:var(--bg);
  color:var(--text);
}
button,input,select,textarea{font:inherit}
button{cursor:pointer}
.hidden{display:none!important}

.view-login{
  min-height:100vh;
  display:none;
  place-items:center;
  padding:24px;
  background:
    linear-gradient(135deg,rgba(36,91,148,.045),transparent 40%),
    var(--bg);
}
.view-login.active{display:grid}

.login-card{
  width:min(420px,100%);
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow:var(--shadow);
  padding:34px;
}
.login-card h1{
  margin:8px 0 8px;
  font-size:28px;
  font-weight:700;
  letter-spacing:-.02em
}
.eyebrow{
  color:var(--primary);
  text-transform:uppercase;
  font-size:11px;
  font-weight:800;
  letter-spacing:.12em
}
.muted{color:var(--muted);margin:0}

.brand-mark{
  width:48px;
  height:48px;
  border-radius:10px;
  display:grid;
  place-items:center;
  background:var(--primary);
  color:white;
  font-weight:800;
  letter-spacing:.04em;
  margin-bottom:18px;
}
.brand-mark.small{
  width:38px;
  height:38px;
  border-radius:8px;
  margin:0
}

.login-form,.stack-form{display:grid;gap:16px;margin-top:24px}
label{
  display:grid;
  gap:7px;
  font-weight:650;
  font-size:13px;
  color:#334155
}
input,select,textarea{
  width:100%;
  border:1px solid var(--line);
  border-radius:8px;
  background:white;
  color:var(--text);
  padding:11px 12px;
  outline:none;
}
input:focus,select:focus,textarea:focus{
  border-color:#8eb1d5;
  box-shadow:0 0 0 3px rgba(36,91,148,.08)
}
.password-wrap{position:relative}
.password-wrap input{padding-right:45px}
.password-wrap .icon-btn{position:absolute;right:5px;top:4px}

.primary-btn,.secondary-btn,.link-btn,.icon-btn{
  border:0;
  border-radius:8px;
  font-weight:700;
}
.primary-btn{
  background:var(--primary);
  color:white;
  padding:11px 16px;
  box-shadow:none
}
.primary-btn:hover{background:var(--primary-dark)}
.secondary-btn{
  background:white;
  color:var(--sidebar-text);
  border:1px solid var(--line);
  padding:10px 14px
}
.link-btn{
  background:transparent;
  color:var(--primary);
  padding:6px 0
}
.icon-btn{
  background:transparent;
  padding:8px 9px;
  color:var(--text)
}
.full{width:100%}
.demo-box{
  margin-top:18px;
  background:var(--surface-soft);
  border:1px solid var(--line);
  padding:12px;
  border-radius:8px;
  font-size:12px;
  color:var(--muted)
}

/* Layout */
.app-shell{
  min-height:100vh;
  display:grid;
  grid-template-columns:220px 1fr
}
.sidebar{
  position:sticky;
  top:0;
  height:100vh;
  background:var(--sidebar);
  color:var(--sidebar-text);
  padding:20px 14px;
  display:flex;
  flex-direction:column;
  border-right:1px solid var(--line)
}
.sidebar-brand{
  display:flex;
  align-items:center;
  gap:11px;
  padding:2px 6px 24px
}
.sidebar-brand strong,.sidebar-brand span{display:block}
.sidebar-brand strong{font-size:14px}
.sidebar-brand span{color:var(--muted);font-size:12px}
.sidebar nav{display:grid;gap:5px}
.nav-btn{
  border:0;
  background:transparent;
  color:#536274;
  padding:10px 12px;
  border-radius:8px;
  text-align:left;
  display:flex;
  align-items:center;
  gap:9px;
  font-weight:650;
  font-size:14px
}
.nav-btn:hover{background:#e4ebf3;color:var(--primary-dark)}
.nav-btn.active{
  background:white;
  color:var(--primary);
  box-shadow:0 1px 2px rgba(15,23,42,.04);
  border:1px solid var(--line)
}
.sidebar-bottom{margin-top:auto;display:grid;gap:14px}
.user-mini{display:flex;gap:9px;align-items:center}
.user-mini strong,.user-mini span{display:block}
.user-mini strong{font-size:13px}
.user-mini span{font-size:11px;color:var(--muted)}
.avatar{
  width:34px;
  height:34px;
  display:grid;
  place-items:center;
  border-radius:8px;
  background:#d9e5f1;
  color:var(--primary-dark);
  font-weight:800
}

.main{min-width:0}
.topbar{
  height:74px;
  background:rgba(255,255,255,.95);
  backdrop-filter:blur(8px);
  border-bottom:1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 24px;
  position:sticky;
  top:0;
  z-index:20
}
.topbar h2{
  margin:3px 0 0;
  font-size:21px;
  font-weight:700
}
.topbar-actions{
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--muted);
  font-size:12px
}
.status-dot{
  width:7px;
  height:7px;
  background:var(--green);
  border-radius:50%
}

.app-view{display:none;padding:24px}
.app-view.active{display:block}
.content-head{
  display:flex;
  align-items:end;
  justify-content:space-between;
  gap:16px;
  margin-bottom:20px
}
.content-head h3{
  margin:0 0 5px;
  font-size:21px;
  font-weight:700
}

.search-box{
  min-width:280px;
  display:flex;
  align-items:center;
  gap:7px;
  border:1px solid var(--line);
  background:white;
  border-radius:8px;
  padding:0 11px
}
.search-box input{
  border:0;
  box-shadow:none;
  padding-left:0;
  background:transparent
}
.search-box.grow{flex:1;min-width:220px}

/* Modules */
.module-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(185px,1fr));
  gap:14px
}
.module-card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:12px;
  padding:18px;
  min-height:150px;
  box-shadow:none;
  transition:.15s ease;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  text-align:left
}
.module-card:hover{
  transform:translateY(-2px);
  border-color:#b7c8d9;
  box-shadow:var(--shadow)
}
.module-icon{
  width:44px;
  height:44px;
  display:grid;
  place-items:center;
  border-radius:9px;
  background:var(--primary-soft);
  font-size:22px
}
.module-card h4{
  margin:16px 0 4px;
  font-size:16px;
  font-weight:700
}
.module-card p{
  margin:0;
  color:var(--muted);
  font-size:12px;
  line-height:1.45
}

/* Dashboard */
.dashboard{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:12px;
  margin-bottom:18px
}
.metric{
  background:white;
  border:1px solid var(--line);
  border-radius:10px;
  padding:15px
}
.metric span{
  color:var(--muted);
  font-size:12px;
  font-weight:650
}
.metric strong{
  display:block;
  font-size:26px;
  margin-top:5px;
  font-weight:700
}
.metric-green{border-top:3px solid var(--green)}
.metric-yellow{border-top:3px solid var(--yellow)}
.metric-red{border-top:3px solid var(--red)}

.toolbar{
  display:flex;
  gap:10px;
  margin-bottom:15px
}
.toolbar select{max-width:210px}

.folio-list{display:grid;gap:9px}
.folio-row{
  display:grid;
  grid-template-columns:14px minmax(100px,135px) 1fr auto;
  gap:14px;
  align-items:center;
  background:white;
  border:1px solid var(--line);
  border-radius:10px;
  padding:14px 15px;
  transition:.15s ease;
  text-align:left
}
.folio-row:hover{
  border-color:#b9c8d8;
  box-shadow:0 3px 10px rgba(31,41,55,.04)
}
.rav-dot{
  width:10px;
  height:10px;
  border-radius:50%
}
.rav-dot.green{background:var(--green)}
.rav-dot.yellow{background:var(--yellow)}
.rav-dot.red{background:var(--red)}
.folio-code{font-weight:750}
.folio-objective{color:var(--muted);font-size:13px}
.badge{
  font-size:11px;
  font-weight:800;
  padding:6px 9px;
  border-radius:999px
}
.badge.green{color:var(--green);background:var(--green-bg)}
.badge.yellow{color:var(--yellow);background:var(--yellow-bg)}
.badge.red{color:var(--red);background:var(--red-bg)}

/* Detail */
.detail-card{
  background:white;
  border:1px solid var(--line);
  border-radius:12px;
  padding:20px;
  margin-top:14px
}
.detail-title-row{
  display:flex;
  align-items:start;
  justify-content:space-between;
  gap:16px
}
.detail-title-row h3{
  margin:0 0 5px;
  font-size:24px;
  font-weight:700
}
.objective-box{
  margin:16px 0 20px;
  background:var(--surface-soft);
  border:1px solid var(--line);
  border-radius:9px;
  padding:14px;
  font-size:14px
}
.objective-box strong{display:block;margin-bottom:5px}
.actions-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:12px
}
.action-tree{display:grid;gap:8px}
.action-card{
  border:1px solid var(--line);
  border-radius:9px;
  padding:12px;
  background:white
}
.action-card.depth-1{margin-left:22px;background:#fbfcfd}
.action-card.depth-2{margin-left:44px;background:#f8fafc}
.action-card.depth-3{margin-left:66px;background:#f6f8fa}
.action-top{display:grid;grid-template-columns:1fr auto;gap:10px}
.action-title{
  display:flex;
  gap:9px;
  align-items:center;
  font-weight:700;
  font-size:14px
}
.action-meta{
  margin-top:7px;
  color:var(--muted);
  font-size:12px;
  display:flex;
  flex-wrap:wrap;
  gap:10px
}
.action-notes{
  margin-top:8px;
  font-size:12px;
  color:#556171;
  background:var(--surface-soft);
  padding:8px 9px;
  border-radius:7px
}
.action-controls{
  display:flex;
  gap:7px;
  align-items:center;
  flex-wrap:wrap;
  justify-content:flex-end
}
.action-controls select{
  width:auto;
  padding:7px 9px;
  font-size:12px
}
.mini-btn{
  border:1px solid var(--line);
  background:white;
  color:var(--text);
  border-radius:7px;
  padding:7px 9px;
  font-size:11px;
  font-weight:700
}

.empty{
  text-align:center;
  color:var(--muted);
  background:white;
  border:1px dashed var(--line);
  padding:30px;
  border-radius:10px
}

/* Modals */
.modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.38);
  z-index:50;
  display:grid;
  place-items:center;
  padding:20px
}
.modal-card{
  width:min(500px,100%);
  max-height:90vh;
  overflow:auto;
  background:white;
  border-radius:12px;
  padding:20px;
  box-shadow:0 12px 35px rgba(15,23,42,.16);
  border:1px solid var(--line)
}
.modal-head{
  display:flex;
  justify-content:space-between;
  align-items:start
}
.modal-head h3{
  margin:4px 0 0;
  font-size:21px
}

.toast{
  position:fixed;
  right:18px;
  bottom:18px;
  z-index:100;
  background:#24364a;
  color:white;
  padding:11px 14px;
  border-radius:8px;
  box-shadow:var(--shadow);
  transform:translateY(140%);
  transition:.2s ease;
  font-size:13px
}
.toast.show{transform:translateY(0)}
.mobile-only{display:none}

@media(max-width:900px){
  .app-shell{grid-template-columns:1fr}
  .sidebar{
    position:fixed;
    left:0;
    top:0;
    z-index:40;
    width:220px;
    transform:translateX(-105%);
    transition:.2s ease
  }
  .sidebar.open{transform:translateX(0)}
  .mobile-only{display:inline-flex}
  .desktop-only{display:none}
  .topbar{padding:12px 16px}
  .app-view{padding:18px 14px}
  .dashboard{grid-template-columns:repeat(2,1fr)}
}

@media(max-width:620px){
  .login-card{padding:26px 20px}
  .content-head{align-items:stretch;flex-direction:column}
  .search-box{min-width:0;width:100%}
  .toolbar{flex-direction:column}
  .toolbar select{max-width:none}
  .folio-row{grid-template-columns:12px 1fr auto}
  .folio-objective{grid-column:2/4}
  .dashboard{grid-template-columns:repeat(2,1fr)}
  .detail-title-row{flex-direction:column}
  .action-top{grid-template-columns:1fr}
  .action-controls{justify-content:flex-start}
  .action-card.depth-1{margin-left:12px}
  .action-card.depth-2{margin-left:24px}
  .action-card.depth-3{margin-left:36px}
}
