:root {
  --bg: #0f172a; --panel: #1e293b; --panel2: #24334d;
  --text: #e2e8f0; --muted: #94a3b8; --accent: #38bdf8;
  --ok: #34d399; --warn: #fbbf24; --crit: #f87171;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
       font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
header { display: flex; justify-content: space-between; align-items: center;
         padding: 14px 22px; background: var(--panel); border-bottom: 1px solid #334155;
         flex-wrap: wrap; gap: 10px; }
header h1 { margin: 0; font-size: 20px; }
.auth input { background: var(--bg); border: 1px solid #334155; color: var(--text);
              padding: 7px 10px; border-radius: 6px; margin-right: 6px; }
.auth button { background: var(--accent); border: none; color: #082f49;
               padding: 8px 14px; border-radius: 6px; font-weight: 600; cursor: pointer; }
.tabs { display: flex; gap: 4px; padding: 10px 22px 0; }
.tab { background: transparent; border: none; color: var(--muted); padding: 10px 16px;
       cursor: pointer; font-size: 15px; border-bottom: 3px solid transparent; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
main { padding: 18px 22px 40px; max-width: 1200px; margin: 0 auto; }
.view { display: none; } .view.active { display: block; }
.status { background: var(--panel); border: 1px solid #334155; border-radius: 8px;
          padding: 10px 14px; margin-bottom: 16px; color: var(--muted); }
.status.ok { color: var(--ok); border-color: #14532d; }
.status.bad { color: var(--crit); border-color: #7f1d1d; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid #334155; border-radius: 10px; padding: 14px; }
.card h3 { margin: 0 0 6px; font-size: 16px; }
.card .role { color: var(--muted); font-size: 13px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.pill.active { background: #064e3b; color: var(--ok); }
.pill.unreachable { background: #7c2d12; color: var(--warn); }
.pill.inactive { background: #334155; color: var(--muted); }
.quota-bar { height: 8px; background: #334155; border-radius: 4px; margin: 8px 0 4px; overflow: hidden; }
.quota-fill { height: 100%; border-radius: 4px; }
.q-ok { background: var(--ok); } .q-warn { background: var(--warn); } .q-crit { background: var(--crit); }
.meta { font-size: 13px; color: var(--muted); margin-top: 6px; }
#heatmap .heat-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
#heatmap .heat-name { width: 180px; text-align: right; font-size: 14px; }
#heatmap .heat-track { flex: 1; height: 22px; background: #1a2436; border-radius: 6px; overflow: hidden; }
#heatmap .heat-fill { height: 100%; display: flex; align-items: center; justify-content: flex-end;
                      padding-right: 8px; font-size: 12px; font-weight: 700; color: #0f172a; }
.stat-row { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.stat { background: var(--panel); border: 1px solid #334155; border-radius: 10px;
        padding: 12px 18px; min-width: 130px; }
.stat .num { font-size: 26px; font-weight: 700; }
.stat .lbl { color: var(--muted); font-size: 13px; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #334155; font-size: 14px; }
th { color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
small { color: var(--muted); font-weight: 400; }
.domain-bar { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.domain-bar .d-name { width: 200px; text-align: right; }
.domain-bar .d-track { flex: 1; height: 20px; background: #1a2436; border-radius: 5px; overflow: hidden; }
.domain-bar .d-fill { height: 100%; background: var(--accent); }

/* v1.1: password gate */
.gate { position: fixed; inset: 0; background: var(--bg); display: flex;
        align-items: center; justify-content: center; z-index: 100; }
.gate-box { background: var(--panel); border: 1px solid #334155; border-radius: 12px;
            padding: 32px 36px; text-align: center; min-width: 320px; }
.gate-box h2 { margin: 0 0 8px; }
.gate-box p { color: var(--muted); margin: 0 0 16px; }
.gate-box input { width: 100%; background: var(--bg); border: 1px solid #334155;
                  color: var(--text); padding: 10px 12px; border-radius: 6px; margin-bottom: 12px; }
.gate-box button { width: 100%; background: var(--accent); border: none; color: #082f49;
                   padding: 10px; border-radius: 6px; font-weight: 700; cursor: pointer; font-size: 15px; }
.gate-err { color: var(--crit); margin-top: 10px; min-height: 20px; font-size: 14px; }
.app-hidden { display: none; }

/* v1.1: create task form */
.create-task { background: var(--panel); border: 1px solid #334155; border-radius: 10px;
               padding: 12px 16px; margin-bottom: 16px; }
.create-task summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.create-task form { display: grid; gap: 10px; margin-top: 12px; }
.create-task label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.create-task input, .create-task textarea, .create-task select {
  background: var(--bg); border: 1px solid #334155; color: var(--text);
  padding: 8px 10px; border-radius: 6px; font-size: 14px; font-family: inherit; }
.create-task button[type="submit"] { background: var(--accent); border: none; color: #082f49;
  padding: 10px; border-radius: 6px; font-weight: 700; cursor: pointer; justify-self: start;
  padding-left: 24px; padding-right: 24px; }
.form-msg { font-size: 13px; color: var(--muted); }

/* v1.2: AI polish button */
.desc-row { display: flex; justify-content: flex-end; }
.polish-btn { background: #4c1d95; border: 1px solid #7c3aed; color: #e9d5ff;
              padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px;
              font-weight: 600; }
.polish-btn:hover:not(:disabled) { background: #5b21b6; }
.polish-btn:disabled { opacity: 0.5; cursor: wait; }

/* v1.3: folder registry */
.row-actions { white-space: nowrap; }
.row-actions button { background: var(--panel2); border: 1px solid #334155; color: var(--text);
                      padding: 5px 10px; border-radius: 5px; cursor: pointer; font-size: 13px;
                      margin-right: 4px; }
.row-actions button.danger { border-color: #7f1d1d; color: var(--crit); }
.row-actions button:hover { border-color: var(--accent); }
.edit-panel { background: var(--panel); border: 1px solid var(--accent); border-radius: 10px;
              padding: 16px; margin-bottom: 16px; }
.edit-panel h3 { margin: 0 0 12px; }
.edit-panel form { display: grid; gap: 10px; }
.edit-panel label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.edit-panel input { background: var(--bg); border: 1px solid #334155; color: var(--text);
                    padding: 8px 10px; border-radius: 6px; font-size: 14px; }
.edit-actions { display: flex; gap: 8px; }
.edit-actions button { padding: 8px 20px; border-radius: 6px; cursor: pointer; font-weight: 600; }
.edit-actions button[type="submit"] { background: var(--accent); border: none; color: #082f49; }
.edit-actions button[type="button"] { background: transparent; border: 1px solid #334155; color: var(--text); }
