:root {
  --primary: #b71c1c;
  --blue: #0d47a1;
  --accent: #f57c00;
  --pro-green: #2e7d32;
  --bg: #f4f6f9;
}
* { box-sizing: border-box; font-family: 'Segoe UI', Arial, sans-serif; }
body { margin: 0; background: var(--bg); color: #222; padding-bottom: 85px; }

/* Header + ऑफिस बॅकग्राऊंड फोटो (office_bg.jpg असल्यास आपोआप दिसेल) */
header {
  background:
    linear-gradient(135deg, rgba(26, 35, 126, 0.90), rgba(13, 71, 161, 0.88)),
    url('office_bg.jpg') center/cover no-repeat;
  color: white; padding: 12px 18px; display: flex; justify-content: space-between;
  align-items: center; flex-wrap: wrap; gap: 10px; box-shadow: 0 3px 10px rgba(0,0,0,0.22);
}
.brand h1 { margin: 0; font-size: 19px; text-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.brand p { margin: 2px 0 0; font-size: 11.5px; opacity: 0.95; }
.header-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.icon-pill {
  background: rgba(255,255,255,0.16); color: #fff; border: 1px solid rgba(255,255,255,0.38);
  padding: 6px 11px; border-radius: 20px; font-weight: bold; cursor: pointer; font-size: 12px;
  display: flex; align-items: center; gap: 5px; position: relative; text-decoration: none;
}
.icon-pill:hover { background: rgba(255,255,255,0.28); }
.notif-dot { background: #ff3d00; color: white; font-size: 10px; padding: 1px 5px; border-radius: 10px; }
.login-badge { background: #00838f; border-color: #4dd0e1; }
.pro-badge { background: var(--accent); border: none; }
.pro-active { background: var(--pro-green) !important; }
.wa-pill { background: #25D366; border: none; color: #fff; }

/* ग्रामपंचायत • CSC • सेतू केंद्र ओळख पट्टी */
.kendra-strip { display: none !important;
  width: 100%; display: flex; justify-content: center; align-items: center;
  gap: 10px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid rgba(255,255,255,0.18);
}
.kendra-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3);
  color: #fff; padding: 3px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 700;
}
.kendra-badge svg { width: 20px; height: 20px; border-radius: 50%; background: #fff; padding: 2px; flex-shrink: 0; }

.container { max-width: 1260px; margin: 16px auto; padding: 0 15px; }

/* Main Tabs Tiles + कामाचा खरा प्रिव्ह्यू */
.main-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 9px; margin-bottom: 18px; }
.tab-btn {
  background: white; border: 2px solid #dce4ec; padding: 8px 6px; border-radius: 10px;
  font-size: 12px; font-weight: bold; color: #1e293b; cursor: pointer; transition: 0.15s;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; text-align: center; min-height: 94px; box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  position: relative;
}
.tab-btn * { pointer-events: none; }
.tab-btn:hover { border-color: #2563eb; background: #f8fafc; }
.tab-btn.active { border-color: #0d47a1; background: #e3f2fd; color: #0d47a1; box-shadow: 0 3px 8px rgba(13,71,161,0.18); }

/* ग्रामपंचायत ऑपरेटरसाठीचे २ विशेष फोल्डर ठळक करण्यासाठी */
.tab-btn.gp-special-tile {
  background: linear-gradient(155deg, #fff8f1 0%, #ffedd5 100%);
  border: 2.5px solid #d84315;
  box-shadow: 0 4px 12px rgba(216, 67, 21, 0.20);
  color: #7c2d12;
}
.tab-btn.gp-special-tile:hover {
  background: linear-gradient(155deg, #ffedd5 0%, #fed7aa 100%);
  border-color: #b71c1c;
  transform: translateY(-2px);
}
.tab-btn.gp-special-tile.active {
  background: linear-gradient(155deg, #fee2e2 0%, #ffedd5 100%);
  border: 3px solid #b71c1c;
  color: #991b1b;
  box-shadow: 0 5px 15px rgba(183, 28, 28, 0.28);
}
.gp-folder-tag {
  display: inline-block;
  background: linear-gradient(90deg, #b71c1c, #e65100);
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.tab-tile-preview {
  width: 66px; height: 38px; border-radius: 6px; background: #f8fafc;
  border: 1px solid #cbd5e1; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.tab-btn.active .tab-tile-preview { background: #ffffff; border-color: #60a5fa; }
.tab-tile-preview svg { width: 62px; height: 34px; display: block; }

/* ऑप्शन उघडल्यावर दिसणारा 'असे दिसेल तुमचे अंतिम Result' नमुना Screenshot बॉक्स */
.result-sample-banner {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1.5px solid #7dd3fc;
  border-left: 5px solid #0284c7;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.result-sample-info {
  flex: 1;
  min-width: 220px;
}
.result-sample-info .rs-badge {
  display: inline-block;
  background: #0284c7;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  padding: 2px 9px;
  border-radius: 12px;
  margin-bottom: 4px;
}
.result-sample-info p {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: #0f172a;
  line-height: 1.45;
}
.result-sample-shot {
  background: #ffffff;
  border: 1.5px solid #94a3b8;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.14);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-sample-shot svg {
  display: block;
  width: 235px;
  height: 92px;
}

.section { display: none; background: #fff; padding: 20px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.06); }
.section.active { display: block; }
.sec-title { margin-top: 0; color: #0d47a1; border-bottom: 2px solid #eef2f6; padding-bottom: 10px; font-size: 17.5px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }

/* सोपे 1-क्लिक कार्ड व आधार प्रिंट Split Layout */
.simple-print-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 18px; align-items: start; }
@media (max-width: 880px) { .simple-print-grid { grid-template-columns: 1fr; } }

.drop-card-box {
  border: 2px dashed #0d47a1; background: #f0f7ff; border-radius: 10px; padding: 14px;
  text-align: center; transition: 0.2s;
}
.drop-card-box:hover { background: #e0f0ff; }
.drop-card-box.has-file { border-style: solid; border-color: #2e7d32; background: #f1f8e9; }

.paper-stage-box {
  background: #cbd5e1; padding: 14px; border-radius: 10px; text-align: center;
  border: 1px solid #94a3b8;
}
.paper-stage-box canvas {
  background: #fff; box-shadow: 0 5px 18px rgba(0,0,0,0.28); max-width: 100%; height: auto;
}

.pdf-tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tool-card {
  background: #1e242b; color: #fff; padding: 14px; border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; gap: 10px; transition: 0.2s; border: 2px solid transparent;
}
.tool-card:hover, .tool-card.selected { background: #2c3540; border-color: #4fc3f7; transform: translateY(-2px); }
.tool-icon { background: #0288d1; padding: 8px 10px; border-radius: 8px; font-size: 17px; }
.tool-workspace { background: #f8fafc; border: 2px dashed #90caf9; padding: 18px; border-radius: 10px; margin-top: 12px; }

.kb-box {
  background: #e3f2fd; border: 1px solid #90caf9; padding: 11px; border-radius: 8px;
  margin-bottom: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.kb-box input { width: 110px; padding: 7px; border: 1px solid #0d47a1; border-radius: 6px; font-weight: bold; font-size: 14px; }

.mode-switcher { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.mode-btn {
  flex: 1; min-width: 220px; padding: 11px; border: 2px solid #cbd5e1; border-radius: 8px;
  background: #f8fafc; font-weight: bold; font-size: 14.5px; cursor: pointer; color: #334155;
}
.mode-btn.active { border-color: #b71c1c; background: #ffebee; color: #b71c1c; }

.lh-grid { display: grid; grid-template-columns: 330px 1fr; gap: 20px; }
@media (max-width: 850px) { .lh-grid { grid-template-columns: 1fr; } }
.form-group { margin-bottom: 10px; }
.form-group label { display: block; font-size: 13px; font-weight: bold; margin-bottom: 4px; color: #444; }
.form-group input, .form-group select { width: 100%; padding: 8px 10px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; }

.editor-toolbar {
  background: #e8eef5; padding: 8px; border-radius: 8px 8px 0 0; border: 1px solid #bbb; border-bottom: none;
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}
.tool-mini-btn {
  background: #fff; border: 1px solid #ccc; padding: 5px 10px; border-radius: 4px;
  cursor: pointer; font-weight: bold; font-size: 12px;
}
.tool-mini-btn:hover { background: #dbeafe; }

.voice-btn-prominent {
  background: linear-gradient(135deg, #1b5e20, #2e7d32) !important;
  color: #ffffff !important; border: 2px solid #a5d6a7 !important;
  padding: 8px 16px !important; font-size: 14px !important; font-weight: 800 !important;
  border-radius: 6px !important; box-shadow: 0 3px 8px rgba(27, 94, 32, 0.35);
  display: inline-flex; align-items: center; gap: 6px;
}
.voice-btn-prominent:hover { background: #144d18 !important; transform: scale(1.02); }

#letterheadPreview {
  border: 1px solid #999; background: #fff; padding: 22px; color: #b71c1c;
  box-shadow: 0 3px 12px rgba(0,0,0,0.12); min-height: 560px; display: flex; flex-direction: column;
}
.lh-top { display: flex; justify-content: space-between; align-items: center; text-align: center; }
.lh-logo { width: 66px; height: 66px; border-radius: 50%; border: 2px solid #b71c1c; overflow: hidden; display: flex; align-items: center; justify-content: center; font-size: 10px; flex-shrink: 0; }
.lh-logo img { width: 100%; height: 100%; object-fit: cover; }
.lh-center h4 { margin: 0; font-size: 12px; }
.lh-center h2 { margin: 4px 0; font-size: 20px; font-weight: 900; }
.lh-center p { margin: 0; font-size: 13px; font-weight: bold; }
.lh-officials {
  display: grid; grid-template-columns: 1fr 1fr 1fr; text-align: center;
  margin-top: 12px; padding-top: 8px; border-top: 1px solid #ef9a9a; font-size: 11px;
}
.lh-officials strong { display: block; font-size: 12px; color: #880e4f; margin-bottom: 2px; }
.lh-meta {
  display: flex; justify-content: space-between; margin-top: 10px; padding: 6px 0;
  border-top: 2px solid #b71c1c; border-bottom: 2px solid #b71c1c; font-size: 13px; font-weight: bold;
}
.lh-meta input {
  border: none; border-bottom: 1px dashed #b71c1c; color: #000; font-weight: bold;
  font-size: 13px; width: 140px; outline: none; background: transparent;
}
#letterBodyEditor {
  flex-grow: 1; margin-top: 15px; color: #111; font-size: 15px; line-height: 1.75;
  outline: none; min-height: 310px; padding: 10px; border: 1px dashed #cfd8dc; border-radius: 4px;
}

.tharav-scroll-box { overflow-x: auto; background: #cbd5e1; padding: 15px; border-radius: 0 0 8px 8px; }
#tharavSheet {
  background: #fff; min-width: 1020px; padding: 22px 26px; box-shadow: 0 4px 15px rgba(0,0,0,0.2);
  color: #000; font-size: 13px; line-height: 1.5; outline: none;
}
.tharav-header { text-align: center; margin-bottom: 8px; }
.tharav-header h3 { margin: 0; font-size: 17px; text-decoration: underline; }
.tharav-header h4 { margin: 4px 0; font-size: 15px; }
.tharav-meta-line {
  font-size: 12.5px; font-weight: bold; margin: 10px 0; line-height: 1.85;
  border-top: 1px solid #000; border-bottom: 1px solid #000; padding: 5px 0;
}
.tharav-table { width: 100%; border-collapse: collapse; margin-top: 8px; table-layout: fixed; }
.tharav-table th, .tharav-table td { border: 1px solid #000; padding: 5px 6px; vertical-align: top; word-wrap: break-word; }
.tharav-table th { background: #f1f5f9; text-align: center; font-weight: bold; font-size: 11.5px; }
.tharav-footer { display: flex; justify-content: space-between; margin-top: 35px; font-weight: bold; font-size: 13.5px; padding: 0 50px; text-align: center; }

.a4-workspace-wrapper {
  background: #cbd5e1; padding: 20px; border-radius: 0 0 10px 10px;
  display: flex; justify-content: center; overflow-x: auto;
}
#a4SheetEditor {
  background: #ffffff; width: 100%; max-width: 794px; min-height: 950px;
  padding: 45px 50px; box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  color: #000; font-size: 15px; line-height: 1.8; outline: none;
}
#a4SheetEditor table, #letterBodyEditor table { width: 100%; border-collapse: collapse; margin: 12px 0; }
#a4SheetEditor th, #a4SheetEditor td, #letterBodyEditor th, #letterBodyEditor td {
  border: 1px solid #333; padding: 7px 10px; font-size: 14px;
}
.save-status { font-size: 12px; color: #2e7d32; font-weight: bold; background: #e8f5e9; padding: 4px 10px; border-radius: 12px; }
.search-bar { width: 100%; padding: 11px 15px; border: 2px solid #cbd5e1; border-radius: 8px; font-size: 15px; margin-bottom: 16px; }
.forms-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 14px; }
.doc-card {
  border: 1px solid #e2e8f0; padding: 15px; border-radius: 10px; background: #fafbfc;
  display: flex; flex-direction: column; justify-content: space-between; transition: 0.2s;
}
.doc-card:hover { border-color: #1565c0; box-shadow: 0 4px 12px rgba(21,101,192,0.1); }
.doc-card h4 { margin: 0 0 6px; font-size: 15px; color: #0d47a1; }
.doc-card span.tag { display: inline-block; background: #e0f2fe; color: #0369a1; font-size: 11px; padding: 2px 8px; border-radius: 4px; margin-bottom: 8px; width: fit-content; font-weight: bold; }
.card-btn-group { display: flex; flex-direction: column; gap: 7px; }

.links-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.portal-card {
  background: #f8fafc; border: 2px solid #dce4ec; padding: 18px; border-radius: 10px;
  text-decoration: none; color: #0d47a1; font-weight: bold; text-align: center; transition: 0.2s;
  display: flex; flex-direction: column; gap: 6px;
}
.portal-card:hover { background: #e3f2fd; border-color: #0d47a1; transform: translateY(-2px); }

.agent-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 18px; }
.agent-card {
  border: 2px solid #e2e8f0; border-radius: 12px; padding: 20px; background: linear-gradient(145deg, #ffffff, #f1f5f9);
  position: relative;
}
.coming-soon-badge {
  background: #ff6f00; color: #fff; font-size: 11px; font-weight: bold; padding: 3px 10px;
  border-radius: 12px; display: inline-block; margin-bottom: 10px;
}

.btn { width: 100%; padding: 10px; border: none; border-radius: 6px; font-size: 13.5px; font-weight: bold; cursor: pointer; text-align: center; text-decoration: none; display: block; }
.btn-blue { background: #0d47a1; color: white; }
.btn-red { background: #b71c1c; color: white; }
.btn-teal { background: #00695c; color: white; }
.btn-ad { background: var(--accent); color: white; margin-top: 8px; }
.btn-green { background: var(--pro-green); color: white; margin-top: 8px; }

.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.7); justify-content: center; align-items: center; z-index: 1000; padding: 15px;
}
.modal-box { background: white; padding: 25px; border-radius: 12px; max-width: 420px; width: 100%; text-align: center; }

/* Anti-Screenshot & Auto-Blur Protection */
.protected-preview-wrap {
  position: relative; overflow: hidden; -webkit-user-select: text; user-select: text; transition: filter 0.15s ease;
}
.protected-preview-wrap::before {
  content: "DRAFT PREVIEW   DRAFT PREVIEW   DRAFT PREVIEW\A\A   DRAFT PREVIEW   DRAFT PREVIEW   DRAFT PREVIEW\A\A   DRAFT PREVIEW   DRAFT PREVIEW   DRAFT PREVIEW";
  white-space: pre-wrap; position: absolute; top: -20%; left: -20%; width: 140%; height: 140%;
  display: flex; align-items: center; justify-content: center; text-align: center; transform: rotate(-28deg);
  font-size: 18px; font-weight: 900; line-height: 2.4; color: rgba(183, 28, 28, 0.16); pointer-events: none; z-index: 20;
}
.protected-preview-wrap.screen-blurred > * { filter: blur(11px) !important; opacity: 0.25 !important; }
.protected-preview-wrap.screen-blurred::after {
  content: "🔒 स्क्रीनशॉट सुरक्षा सक्रिय! पुन्हा पाहण्यासाठी येथे क्लिक करा.";
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #b71c1c; color: #fff; padding: 14px 22px; border-radius: 8px;
  font-weight: bold; font-size: 15px; z-index: 50; box-shadow: 0 6px 20px rgba(0,0,0,0.4); text-align: center;
}

@media print {
  body * { visibility: hidden !important; }
  body::before {
    content: "थेट प्रिंट बंद आहे! कृपया ॲपमधील प्रिंट किंवा डाउनलोड बटण वापरा.";
    visibility: visible !important; display: block; text-align: center; font-size: 20px; font-weight: bold; margin-top: 100px;
  }
}

/* Documents Ready Maker Studio */
.dm-workspace-box { background: #1c1c1c; border-radius: 10px; padding: 22px; color: #fff; border: 1px solid #333; }
.dm-cards-grid { display: flex; flex-wrap: wrap; gap: 22px; align-items: center; margin-bottom: 20px; }
.dm-item-card {
  width: 210px; background: #222222; border: 1px solid #3c3c3c; border-radius: 8px;
  padding: 12px; display: flex; flex-direction: column; align-items: center; box-shadow: 0 4px 10px rgba(0,0,0,0.35);
}
.dm-card-top { width: 100%; display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: #e5e7eb; margin-bottom: 10px; }
.dm-remove-btn { background: #2d2d2d; color: #d1d5db; border: 1px solid #4b5563; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: 13px; }
.dm-remove-btn:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
.dm-thumb-box { width: 120px; height: 150px; background: #fff; border-radius: 3px; display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 10px; }
.dm-thumb-box img { width: 100%; height: 100%; object-fit: contain; }
.dm-compact-inputs { width: 100%; display: flex; gap: 5px; margin-bottom: 8px; }
.dm-input-mini { background: #141414; border: 1px solid #444; color: #fff; padding: 4px 6px; border-radius: 4px; font-size: 11.5px; outline: none; }
.dm-new-size { font-size: 13px; font-weight: bold; color: #f3f4f6; margin-bottom: 9px; text-align: center; }
.dm-dl-btn { background: #0077cc; color: #fff; border: none; padding: 8px 0; border-radius: 5px; font-weight: bold; font-size: 13.5px; cursor: pointer; width: 100%; }
.dm-add-circle-card {
  width: 155px; height: 155px; border-radius: 50%; border: 1.5px solid #444444; background: #1f1f1f;
  display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; text-align: center; padding: 12px;
}
.dm-add-circle-card:hover { border-color: #0077cc; background: #262626; }
.dm-circle-icon { font-size: 26px; color: #e5e7eb; margin-bottom: 6px; line-height: 1; }
.dm-bottom-bar { border-top: 1px solid #333; padding-top: 15px; display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.dm-trash-icon-btn { background: #0077cc; color: #fff; border: none; width: 38px; height: 38px; border-radius: 50%; font-size: 16px; cursor: pointer; }
.dm-zip-btn { background: #0077cc; color: #fff; border: none; padding: 10px 22px; border-radius: 5px; font-weight: bold; font-size: 14px; cursor: pointer; }

/* Unified Card Print Studio & Draggable/Resizable Cropper */
.crop-viewport-box {
  border: 2px solid #00695c;
  background: #0f172a;
  overflow: auto;
  max-height: 68vh;
  margin-bottom: 12px;
  padding: 8px;
  text-align: center;
  display: block;
}
.crop-viewport-box canvas {
  cursor: crosshair;
  display: inline-block;
  margin: 0 auto;
  touch-action: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}
.mode-pill-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.mode-pill-btn {
  padding: 10px 8px;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  font-weight: bold;
  font-size: 13px;
  cursor: pointer;
  color: #334155;
  transition: 0.15s;
}
.mode-pill-btn.active {
  border-color: #0d47a1;
  background: #e3f2fd;
  color: #0d47a1;
}
