:root {
  --gb:#4285F4; --gr:#EA4335; --gy:#FBBC05; --gg:#34A853;
  --gb-lt:#E8F0FE; --gr-lt:#FCE8E6; --gy-lt:#FEF7E0; --gg-lt:#E6F4EA;
  --surface:#F8F9FA; --white:#fff; --border:#DADCE0;
  --text:#202124; --text2:#5F6368; --text3:#80868B;
}

* { box-sizing:border-box; }
body {
  margin:0; background:var(--surface); color:var(--text);
  font-family:'Roboto',sans-serif; font-size:11px; -webkit-font-smoothing:antialiased;
}
a { color:inherit; }

/* ── HEADER ── */
.app-header {
  height:44px; background:var(--white); border-bottom:1px solid var(--border);
  display:flex; align-items:center; justify-content:space-between; padding:0 12px;
  position:sticky; top:0; z-index:500; gap:10px;
}
.app-brand { display:flex; align-items:center; gap:7px; }
.app-brand-mark {
  width:22px; height:22px; border-radius:6px; background:var(--gb);
  display:flex; align-items:center; justify-content:center; color:#fff; font-weight:800; font-size:11px;
  font-family:'Google Sans',sans-serif; flex-shrink:0;
}
.app-brand-text { display:flex; flex-direction:column; line-height:1.1; }
.app-brand-text b { font-family:'Google Sans',sans-serif; font-size:12px; font-weight:700; color:var(--text); }
.app-brand-text span { font-size:8px; color:var(--text3); letter-spacing:.3px; text-transform:uppercase; }

.app-nav { display:flex; align-items:center; gap:2px; flex:1; padding-left:14px; }
.app-nav-item {
  font-size:11px; font-weight:600; color:var(--text2); padding:0 10px; height:44px;
  display:flex; align-items:center; gap:5px; cursor:pointer; border-bottom:2px solid transparent;
  transition:color .12s, border-color .12s; white-space:nowrap;
}
.app-nav-item i { font-size:13px; }
.app-nav-item:hover { color:var(--gb); }
.app-nav-item.active { color:var(--gb); border-bottom-color:var(--gb); }

.app-header-right { display:flex; align-items:center; gap:10px; }
.icon-btn {
  width:28px; height:28px; border-radius:50%; border:none; background:transparent; color:var(--text2);
  display:flex; align-items:center; justify-content:center; cursor:pointer; position:relative; font-size:14px;
  transition:background .12s;
}
.icon-btn:hover { background:var(--surface); }
.icon-btn .dot { position:absolute; top:4px; right:4px; width:6px; height:6px; border-radius:50%; background:var(--gr); border:1.5px solid #fff; }

.user-chip { display:flex; align-items:center; gap:6px; cursor:pointer; padding:2px 6px 2px 2px; border-radius:16px; transition:background .12s; position:relative; }
.user-chip:hover { background:var(--surface); }
.user-avatar {
  width:26px; height:26px; border-radius:50%; background:var(--gg); color:#fff; font-weight:700; font-size:10px;
  display:flex; align-items:center; justify-content:center; font-family:'Google Sans',sans-serif; flex-shrink:0;
}
.user-chip-name { font-size:10px; font-weight:700; color:var(--text); }
.user-chip i { font-size:12px; color:var(--text3); }

.dropdown-menu {
  position:absolute; top:36px; right:0; background:#fff; border:1px solid var(--border); border-radius:8px;
  box-shadow:0 6px 20px rgba(0,0,0,.12); width:190px; padding:6px; display:none; z-index:600;
}
.dropdown-menu.show { display:block; }
.dropdown-user-row { padding:8px 8px 9px; border-bottom:1px solid var(--border); margin-bottom:4px; }
.dropdown-user-row b { font-size:11px; display:block; color:var(--text); }
.dropdown-user-row span { font-size:9px; color:var(--text3); }
.dropdown-item {
  display:flex; align-items:center; gap:8px; padding:7px 8px; border-radius:5px; font-size:10.5px;
  font-weight:600; color:var(--text2); cursor:pointer; transition:background .12s;
}
.dropdown-item:hover { background:var(--surface); color:var(--gb); }
.dropdown-item.danger:hover { background:var(--gr-lt); color:var(--gr); }
.dropdown-item i { font-size:13px; width:14px; text-align:center; }

/* ── MAIN LAYOUT ── */
.app-body { padding:12px; max-width:1400px; margin:0 auto; }
.view { display:none; }
.view.active { display:block; }

.view-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.view-head h1 { font-family:'Google Sans',sans-serif; font-size:14px; font-weight:700; margin:0; }
.view-head p { font-size:10px; color:var(--text2); margin:2px 0 0; }
.btn-primary {
  display:flex; align-items:center; gap:4px; background:var(--gb); color:#fff; border:none; border-radius:5px;
  padding:0 11px; height:28px; font-size:11px; font-weight:600; cursor:pointer; white-space:nowrap;
  transition:background .12s; font-family:'Roboto',sans-serif;
}
.btn-primary:hover { background:#1a73e8; }
.btn-ghost {
  background:transparent; border:1px solid var(--border); color:var(--text2); border-radius:5px;
  height:26px; padding:0 9px; font-size:10px; font-weight:600; cursor:pointer; display:flex; align-items:center; gap:4px;
  transition:all .12s;
}
.btn-ghost:hover { border-color:var(--gb); color:var(--gb); }

/* ── TABLE (compact data grid) ── */
.data-card { background:#fff; border:1px solid var(--border); border-radius:8px; overflow:hidden; }
table.grid { width:100%; border-collapse:collapse; }
table.grid thead th {
  text-align:left; font-size:8.5px; font-weight:800; text-transform:uppercase; letter-spacing:.4px;
  color:var(--text3); background:var(--surface); padding:7px 10px; border-bottom:1px solid var(--border);
}
table.grid tbody td { padding:7px 10px; border-bottom:1px solid #EEEFF1; font-size:11px; color:var(--text); vertical-align:middle; }
table.grid tbody tr:last-child td { border-bottom:none; }
table.grid tbody tr:hover { background:#FAFBFC; }
.cell-sub { color:var(--text3); font-size:9px; margin-top:1px; }
.row-actions { display:flex; gap:4px; justify-content:flex-end; }
.row-actions button {
  width:24px; height:24px; border-radius:5px; border:1px solid var(--border); background:#fff; color:var(--text2);
  cursor:pointer; display:flex; align-items:center; justify-content:center; font-size:11px; transition:all .12s;
}
.row-actions button:hover { border-color:var(--gb); color:var(--gb); background:var(--gb-lt); }
.row-actions button.danger:hover { border-color:var(--gr); color:var(--gr); background:var(--gr-lt); }

.badge { font-size:7px; font-weight:800; text-transform:uppercase; letter-spacing:.4px; padding:2px 6px; border-radius:3px; white-space:nowrap; }
.badge.planning { background:var(--gy-lt); color:#B06000; }
.badge.active   { background:var(--gb-lt); color:var(--gb); }
.badge.on_hold  { background:var(--gr-lt); color:var(--gr); }
.badge.completed{ background:var(--gg-lt); color:var(--gg); }
.badge.admin    { background:#E8EAED; color:#3C4043; }
.badge.planner  { background:var(--gb-lt); color:var(--gb); }
.badge.viewer   { background:var(--surface); color:var(--text2); }

.empty-row td { text-align:center; color:var(--text3); font-style:italic; padding:26px 10px; font-size:10.5px; }

/* ── MODALS ── */
.modal-bd { position:fixed; inset:0; z-index:9999; display:none; align-items:center; justify-content:center; background:rgba(32,33,36,.5); backdrop-filter:blur(2px); }
.modal-bd.show { display:flex; }
.modal-box { background:#fff; border-radius:8px; border:1px solid var(--border); box-shadow:0 8px 32px rgba(0,0,0,.18); width:100%; max-width:360px; max-height:88vh; display:flex; flex-direction:column; overflow:hidden; margin:12px; }
.modal-head { display:flex; align-items:center; justify-content:space-between; padding:9px 12px; border-bottom:1px solid var(--border); background:var(--surface); flex-shrink:0; }
.modal-head h3 { font-size:12px; font-weight:700; margin:0; }
.modal-head p { font-size:9px; color:var(--text2); margin:1px 0 0; }
.modal-close { width:22px; height:22px; border:none; background:transparent; border-radius:50%; cursor:pointer; color:var(--text2); font-size:14px; display:flex; align-items:center; justify-content:center; }
.modal-close:hover { background:var(--border); }
.modal-body { overflow-y:auto; flex:1; padding:11px 12px; }

.f-label { font-size:8px; font-weight:700; text-transform:uppercase; letter-spacing:.4px; color:var(--text2); display:block; margin-bottom:2px; }
.f-input, .f-select, .f-textarea {
  width:100%; height:28px; padding:0 8px; border:1px solid var(--border); border-radius:4px; background:var(--surface);
  font-size:11px; color:var(--text); outline:none; transition:border-color .12s; font-family:'Roboto',sans-serif; box-sizing:border-box;
}
.f-select { appearance:auto; }
.f-textarea { height:48px; padding:5px 8px; resize:none; }
.f-input:focus, .f-select:focus, .f-textarea:focus { border-color:var(--gb); background:#fff; box-shadow:0 0 0 2px #4285F420; }
.f-field { margin-bottom:6px; }
.f-grid2 { display:grid; grid-template-columns:1fr 1fr; gap:6px; }
.f-check-row { display:flex; align-items:center; gap:6px; font-size:10.5px; color:var(--text2); margin-top:2px; }
.btn-submit { width:100%; height:30px; border:none; border-radius:4px; background:var(--gb); color:#fff; font-size:11px; font-weight:700; cursor:pointer; font-family:'Google Sans',sans-serif; letter-spacing:.3px; transition:background .12s; margin-top:4px; }
.btn-submit:hover { background:#1a73e8; }
.btn-submit.danger { background:var(--gr); }
.btn-submit.danger:hover { background:#d33426; }
.btn-submit:disabled { opacity:.6; cursor:not-allowed; }
.form-err { background:var(--gr-lt); color:var(--gr); border:1px solid #F6C6C0; border-radius:5px; padding:6px 8px; font-size:10px; font-weight:600; margin-bottom:7px; display:none; }
.form-err.show { display:block; }
.confirm-text { font-size:11px; color:var(--text2); line-height:1.5; margin-bottom:2px; }
.confirm-text b { color:var(--text); }

/* ── TOASTS ── */
#toast-stack { position:fixed; bottom:16px; right:16px; z-index:99999; display:flex; flex-direction:column; gap:6px; }
.toast {
  background:var(--text); color:#fff; font-size:11px; font-weight:600; padding:9px 13px; border-radius:6px;
  box-shadow:0 6px 18px rgba(0,0,0,.22); display:flex; align-items:center; gap:8px; min-width:200px;
  animation:toastIn .18s ease-out;
}
.toast.success { background:#1E3B2C; }
.toast.error   { background:#3B1E1E; }
.toast i { font-size:14px; }
@keyframes toastIn { from{ opacity:0; transform:translateY(6px);} to{ opacity:1; transform:translateY(0);} }

/* ── LOADING ── */
.skeleton-row td { padding:9px 10px; }
.skeleton-bar { height:9px; border-radius:4px; background:linear-gradient(90deg,#EEEFF1 25%,#E3E5E8 37%,#EEEFF1 63%); background-size:400% 100%; animation:shimmer 1.3s infinite; }
@keyframes shimmer { 0%{ background-position:100% 50%; } 100%{ background-position:0 50%; } }

.hidden { display:none !important; }

@media(max-width:640px){
  .app-nav-item span.lbl { display:none; }
  .app-brand-text { display:none; }
}