:root{
  --bg: #f6f8fc;
  --panel: #ffffff;
  --card: #ffffff;
  --border: #e0e3eb;
  --border2:#dadce0;

  --text: #202124;
  --muted:#5f6368;

  --accent: #1a73e8;
  --radius: 16px;

  --success: #1e8e3e;
  --danger:  #d93025;
  --warn:    #f9ab00;

  color-scheme: light;
}

*{ box-sizing:border-box; }
html, body{ height:100%; }

body{
  margin:0;
  font-family: "Google Sans", "Segoe UI", Roboto, Arial, Tahoma, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.app{
  display:grid;
  grid-template-columns: 320px 1fr;
  min-height:100vh;
}
@media (max-width: 980px){
  .app{ grid-template-columns: 1fr; }
  .side{ position: relative; }
}

.side{
  padding:20px;
  border-left:1px solid var(--border);
  background: var(--bg);
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  padding:12px;
  border-radius: var(--radius);
  background: var(--card);
  border:1px solid var(--border);
  box-shadow: 0 1px 2px rgba(60,64,67,.15);
}
.logo{
  width:44px;height:44px;
  display:grid;place-items:center;
  border-radius: 14px;
  background: rgba(26,115,232,0.10);
  border:1px solid rgba(26,115,232,0.18);
  font-size:18px;
}
.brandTitle{ font-weight:700; }
.brandSub{ color: var(--muted); font-size: 12px; margin-top:2px; }

.sideCard{
  margin-top:14px;
  padding:14px;
  border-radius: var(--radius);
  background: var(--card);
  border:1px solid var(--border);
  box-shadow: 0 1px 2px rgba(60,64,67,.15);
}
.sideTitle{ font-weight:700; margin-bottom:8px; }
.sideList{
  margin:0;
  padding:0 18px 0 0;
  color: var(--muted);
  line-height: 1.8;
}
.sideFooter{
  margin-top:18px;
  color: var(--muted);
  opacity: .9;
}

.main{ padding:22px; }

.top{
  padding:14px 16px;
  border-radius: var(--radius);
  background: var(--card);
  border:1px solid var(--border);
  box-shadow: 0 1px 2px rgba(60,64,67,.15);
  margin-bottom:14px;
}
.top h1{ margin:0 0 6px 0; font-size: 22px; font-weight: 700; }
.top p{ margin:0; color: var(--muted); }

.card{
  padding:16px;
  border-radius: var(--radius);
  background: var(--card);
  border:1px solid var(--border);
  margin: 14px 0;
  box-shadow: 0 1px 2px rgba(60,64,67,.15);
}

.cardHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

h2{ margin:0; font-size: 16px; font-weight: 700; }
h3{ margin:0; font-size: 14px; font-weight: 700; }
.muted{ color: var(--muted); font-size: 12px; }

.pill{
  font-size: 12px;
  padding:6px 10px;
  border-radius: 999px;
  background: rgba(26,115,232,0.10);
  border:1px solid rgba(26,115,232,0.22);
  color: #1f1f1f;
}

.grid2{
  display:grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
}
@media (max-width: 720px){
  .grid2{ grid-template-columns: 1fr; }
}

.grid4{
  display:grid;
  grid-template-columns: 1.2fr 180px 220px 180px;
  gap: 12px;
}
@media (max-width: 900px){
  .grid4{ grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px){
  .grid4{ grid-template-columns: 1fr; }
}

.field label{
  display:block;
  margin-bottom:6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.field input, .field select{
  width:100%;
  padding: 11px 12px;
  border-radius: 14px;
  border:1px solid var(--border2);
  background: #fff;
  color: var(--text);
  outline: none;
}

.field input::placeholder{ color: #9aa0a6; }

.field select option{
  background:#ffffff;
  color:#202124;
}
.field select option:checked{
  background:#e8f0fe;
  color:#202124;
}

.field input:focus, .field select:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.18);
}

.colorRow{
  display:flex;
  gap:10px;
  align-items:center;
}
#textColor{
  width: 52px;
  height: 44px;
  padding: 0;
  border-radius: 12px;
  overflow:hidden;
  border: 1px solid var(--border2);
  background:#fff;
}
#textColorHex{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Editor */
.editorWrap{ margin-top: 12px; }
.editorHead{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:12px;
  margin-bottom:8px;
}
.hint{ color: var(--muted); font-size: 12px; }

.toolbar{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  padding:10px;
  border-radius: 14px;
  background: #fff;
  border:1px solid var(--border);
}

.tbtn{
  padding: 9px 10px;
  border-radius: 12px;
  border:1px solid var(--border2);
  background:#fff;
  color: var(--text);
  cursor:pointer;
  transition: transform .08s ease, border-color .12s ease, box-shadow .12s ease;
}
.tbtn:hover{
  border-color: rgba(26,115,232,0.55);
  box-shadow: 0 1px 2px rgba(60,64,67,.15);
}
.tbtn:active{ transform: scale(0.98); }

.sep{ width:1px; background: var(--border); margin: 0 4px; }

.editor{
  margin-top:10px;
  min-height: 240px;
  padding: 14px;
  border-radius: var(--radius);
  border:1px solid var(--border2);
  background:#fff;
  line-height: 1.9;
  overflow:auto;
}

.note{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(26,115,232,0.20);
  background: #e8f0fe;
  color: #1f1f1f;
  font-size: 12px;
}

/* Preview */
.previewWrap{ margin-top: 12px; }
.previewHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom: 10px;
}
.previewTitle{
  position:relative;
  font-weight:700;
  padding-bottom: 6px;
}
.previewTitle::after{
  content:"";
  position:absolute;
  right:0;
  bottom:0;
  height:3px;
  width: 90px;
  background: var(--accent);
  border-radius:999px;
}
.preview{
  min-height: 160px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px dashed var(--border2);
  background:#fff;
}

/* Buttons */
.actions{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.btnPrimary{
  padding: 12px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  cursor:pointer;
  font-weight: 700;
  transition: transform .08s ease, box-shadow .12s ease, filter .12s ease;
  box-shadow: 0 1px 2px rgba(60,64,67,.3);
}
.btnPrimary:hover{
  filter: brightness(0.97);
  box-shadow: 0 2px 6px rgba(60,64,67,.35);
}
.btnPrimary:active{ transform: scale(0.99); }

.btnSecondary{
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: #fff;
  color: var(--text);
  cursor:pointer;
}
.btnSecondary:hover{ background:#f1f3f4; }

.status{ color: var(--muted); font-size: 12px; }

/* -------- RESULTS UI (NEW) -------- */

.hidden{ display:none !important; }

.resultCard{
  margin-top: 12px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 1px 2px rgba(60,64,67,.15);
}

.resultTop{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom: 10px;
}

.resultTitle{
  font-weight: 800;
}

.resultHint{
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

/* Badges */
.badge{
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background:#f1f3f4;
  color: #1f1f1f;
  font-weight: 700;
}
.badge.success{
  background: rgba(30,142,62,0.10);
  border-color: rgba(30,142,62,0.25);
  color: #137333;
}
.badge.danger{
  background: rgba(217,48,37,0.10);
  border-color: rgba(217,48,37,0.25);
  color: #a50e0e;
}
.badge.warn{
  background: rgba(249,171,0,0.18);
  border-color: rgba(249,171,0,0.30);
  color: #b06000;
}
.badge.info{
  background: rgba(26,115,232,0.10);
  border-color: rgba(26,115,232,0.22);
  color: #1967d2;
}

/* KPIs */
.kpis{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 900px){
  .kpis{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.kpi{
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fafbff;
}

.kpiLabel{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 700;
}

.kpiValue{
  font-size: 20px;
  font-weight: 900;
  color: var(--text);
}
.kpiValue.small{ font-size: 14px; font-weight: 700; color: var(--muted); }
.kpiValue.success{ color: var(--success); }
.kpiValue.danger{ color: var(--danger); }

/* Logs */
.logsBox{
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background:#fff;
}

.logsBox summary{
  cursor:pointer;
  padding: 12px 14px;
  font-weight: 800;
  color: var(--text);
  background: #f8f9fa;
  border-bottom: 1px solid var(--border);
  list-style: none;
}
.logsBox summary::-webkit-details-marker{ display:none; }

.logs{
  list-style: none;
  margin:0;
  padding: 8px 0;
  max-height: 260px;
  overflow:auto;
}

.logItem{
  display:flex;
  align-items:flex-start;
  gap:10px;
  padding: 10px 14px;
  border-bottom: 1px solid #eef0f5;
}
.logItem:last-child{ border-bottom: none; }

.logIcon{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display:grid;
  place-items:center;
  font-weight: 900;
  flex: 0 0 auto;
  margin-top: 2px;
}
.logIcon.ok{
  background: rgba(30,142,62,0.12);
  color: #137333;
}
.logIcon.bad{
  background: rgba(217,48,37,0.12);
  color: #a50e0e;
}
.logIcon.skip{
  background: rgba(249,171,0,0.18);
  color: #b06000;
}

.logText{
  flex: 1 1 auto;
}
.logMain{
  font-weight: 800;
  margin-bottom: 2px;
}
.logSub{
  color: var(--muted);
  font-size: 12px;
  direction:ltr;
  text-align:left;
  unicode-bidi: plaintext;
}

/* Old pre styling kept (if any) */
pre{
  margin: 10px 0 0 0;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: #202124;
  color: #e8eaed;
  overflow:auto;
}

/* -------- Admin Box + Logout button -------- */
.adminBox{
  margin-top: 8px;
}
.adminName{
  font-weight: 900;
  margin-bottom: 4px;
}
.adminEmail{
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 10px;
  direction:ltr;
  text-align:left;
  unicode-bidi: plaintext;
}
.btnLogout{
  display:inline-block;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(217,48,37,0.25);
  background: rgba(217,48,37,0.08);
  color: #a50e0e;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.btnLogout:hover{
  background: rgba(217,48,37,0.12);
  border-color: rgba(217,48,37,0.35);
}

/* -------- Login page (use same style.css) -------- */
/* =========================
   Gmail-like Login Page
   ========================= */

body.loginPage {
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f6f9fe;
  background-image: radial-gradient(at 0% 0%, rgba(26, 115, 232, 0.05) 0px, transparent 50%),
                    radial-gradient(at 100% 100%, rgba(26, 115, 232, 0.05) 0px, transparent 50%);
}

.loginCard {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  padding: 40px;
  border-radius: 24px;
  border: 1px solid #e0e3eb;
  box-shadow: 0 10px 25px rgba(60, 64, 67, 0.05), 0 1px 3px rgba(0, 0, 0, 0.1);
}

.loginHeader {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 32px;
}

.loginLogo {
  width: 56px;
  height: 56px;
  background: #1a73e8;
  color: white;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

.loginTitle {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  color: #202124;
}

.loginSub {
  margin: 8px 0 0 0;
  color: #5f6368;
  font-size: 14px;
}

.loginForm .field {
  margin-bottom: 20px;
}

.loginForm label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
  color: #3c4043;
}

.loginForm input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid #dadce0;
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.2s ease;
  outline: none;
}

.loginForm input:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.1);
}

.loginError {
  background: #fce8e6;
  color: #d93025;
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 20px;
  border-right: 4px solid #d93025;
}

.loginActions {
  margin-top: 30px;
}

.loginBtn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: #1a73e8;
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.loginBtn:hover {
  background: #1765cc;
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.2);
}

.loginBtn:active {
  transform: scale(0.98);
}

.loginFooter {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #f1f3f4;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #70757a;
}

.loginFooter a {
  color: #1a73e8;
  text-decoration: none;
  font-weight: 600;
}

/* Mobile Adjustments */
@media (max-width: 480px) {
  .loginCard {
    padding: 24px;
    border: none;
    box-shadow: none;
    background: transparent;
  }
  body.loginPage {
    background: #fff;
    align-items: flex-start;
  }
}
