:root{
  --app-bg:#0D1117;
  --panel-bg:#161B22;
  --panel-alt:#092330;
  --accent:#005F87;
  --accent-2:#0A7FB0;
  --text:#E6EDF0;
  --muted:#8B949E;
  --input-bg:#5c737d;
  --input-text:#ffffff;
  --button:#111111;
  --button-text:#ffffff;
  --light-button:#dddddd;
  --paper-shadow:rgba(0,0,0,.9);
}

*{
  box-sizing:border-box;
}

html, body {
    margin: 0;
    padding: 0;
    direction: rtl;
    font-family: "Segoe UI", "Heebo", "Rubik", sans-serif;
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    background: var(--app-bg);
    color: var(--text);
}

/* =========================================================
   APP LAYOUT
========================================================= */

.app-shell{
  display:grid;
  grid-template-columns:230px 370px 1fr;
  gap:18px;
  align-items:start;
  padding:16px;
  min-height:100vh;
}

/* =========================================================
   SIDEBAR
========================================================= */

.sidebar{
  position:sticky;
  top:12px;
  max-height:96vh;
  overflow:auto;

  background:var(--panel-bg);

  border-radius:18px;

  padding:16px;

  box-shadow:0 8px 30px rgba(0,0,0,.18);

  z-index:30;
}

/* =========================================================
   BRAND
========================================================= */

.brand-box {
    border: 1px dashed var(--accent);
    border-radius: 16px;
    padding: 14px;
    text-align: center;
    background: linear-gradient(150deg, #130936 0%, #090c36 45%, #011c52 100%);
    margin-bottom: 16px;
}

.brand-logo{

  height:78px;

  max-width:100%;

  object-fit:contain;

}

.brand-fallback{

  display:none;

  font-weight:900;

  font-size:26px;

  color:#fff;

}

.brand-subtitle{

  margin-top:8px;

  font-size:13px;

  color:var(--muted);

}

/* =========================================================
   SIDEBAR TITLE
========================================================= */

.nav-title{

  font-size:13px;

  color:var(--muted);

  margin:12px 0 10px;

  font-weight:700;

}

/* =========================================================
   FORMS MENU
========================================================= */

.forms-menu{

  display:flex;

  flex-direction:column;

  gap:10px;

}

/* =========================================================
   MENU BUTTONS
========================================================= */

.form-menu-btn{

  width:100%;

  min-height:58px;

  border-radius:18px;

  border:1px solid rgba(255,255,255,.08);

  background:#111820;

  color:var(--text);

  padding:8px 12px;

  cursor:pointer;

  position:relative;

  overflow:hidden;

  transition:.2s;

}

    .form-menu-btn:hover {
        border-color: #2b03ad;
        background: #151433;
        transform: translateY(-1px);
    }

    .form-menu-btn.active {
        background: linear-gradient(150deg, #371161 0%, #5840cf 45%, #3e81ed 100%);
        border-color: #2b03ad;
        color: #fff;
    }

/* =========================================================
   MENU CONTENT
========================================================= */

.menu-btn-top{
  position:relative;
  width:100%;
  min-height:24px;
  display:flex;
  align-items:center;
  justify-content:center;
}


/* ===== TITLE ===== */

.menu-btn-title{
  text-align:center;
  font-weight:700;
  font-size:16px;
  letter-spacing:-0.3px;
  white-space:nowrap;
}

/* ===== ICON ===== */

.menu-icon{
  position:absolute;
  right:14px;
  top:50%;
  transform:translateY(-50%);
  width:26px !important;
  height:26px !important;
  object-fit:contain;
}

/* ===== DESCRIPTION ===== */

.form-menu-btn span{

  display:block;

  margin-top:2px;

  text-align:center;
  
  font-family:
  "Segoe UI",
  "Heebo",
  sans-serif;

  font-size:12px;

  color:var(--muted);

  line-height:1.5;

}

.form-menu-btn.active span{

  color:#d9f3ff;

}

/* =========================================================
   GROUP MENU
========================================================= */

.menu-group{

  width:100%;

}

.menu-group-title{

  list-style:none;

  position:relative;

}

.menu-group-title::-webkit-details-marker{

  display:none;

}

/* ===== LEFT ARROW ===== */

.menu-group-title::after{
  content:"⌄";
  position:absolute;
  left:14px;
  top:50%;
  transform:translateY(-50%);
  font-size:18px;
}

  left:10px;

  top:50%;

  transform:translateY(-50%);

  font-size:18px;

  transition:.2s;

}

.menu-group[open] .menu-group-title::after{
  transform:translateY(-50%) rotate(180deg);
}

}

.menu-child-btn{

  margin-top:10px;

  margin-inline-start:12px;

  width:calc(100% - 12px);

  min-height:40px;

  opacity:.96;

}

/* =========================================================
   NEWS BOX
========================================================= */

.news-box{

  margin-top:18px;

  padding:14px;

  border-radius:18px;

  background:#081521;

  border:1px solid #0b3c57;

}

.news-title{

  display:flex;

  align-items:center;

  justify-content:center;

  gap:10px;

  width:100%;

  min-height:24px;

  font-size:14px;

  font-weight:700;

  color:var(--text);

  cursor:pointer;

  list-style:none;

  position:relative;

}

.news-title::-webkit-details-marker{

  display:none;

}

.news-title::after{

  content:"⌄";

  position:absolute;

  left:0;

  top:50%;

  transform:translateY(-50%);

  transition:.2s;

}

.news-box[open] .news-title::after{

  transform:translateY(-50%) rotate(180deg);

}

.news-box summary{

  cursor:pointer;

  user-select:none;

}

.news-icon{

  width:24px;

  height:24px;

  object-fit:contain;

}

.news-content{

  margin-top:12px;

}

.news-item{

  font-size:13px;

  color:#9FB3C8;

  line-height:1.6;

  margin-bottom:8px;

}

/* =========================================================
   SIDEBAR FOOTER
========================================================= */

.sidebar-footer{

  margin-top:18px;

  padding-top:14px;

  border-top:1px solid rgba(255,255,255,.08);

  font-size:11px;

  line-height:1.6;

  color:var(--muted);

  text-align:center;

}

/* =========================================================
   FORM PANEL
========================================================= */

.form-panel{

  position:sticky;

  top:12px;

  max-height:96vh;

  overflow:auto;

  background:var(--panel-bg);

  border-radius:18px;

  box-shadow:0 8px 30px rgba(0,0,0,.14);

  padding:18px;

  z-index:20;

}

.form-panel h2{

  margin:0 0 4px;

  font-size:22px;

}

.hint{

  font-size:12px;

  line-height:1.5;

  color:var(--muted);

  margin:0 0 12px;

}

/* =========================================================
   FORM SECTIONS
========================================================= */

.form-section{

  border-top:1px solid var(--accent);

  padding-top:12px;

  margin-top:12px;

}

.form-section h3{

  font-size:15px;

  margin:0 0 10px;

}

.form-group{

  margin-bottom:10px;

}

.form-group label{

  display:block;

  font-size:13px;

  font-weight:700;

  margin-bottom:4px;

}

.form-group input,
.form-group select{

  width:100%;

  padding:10px 12px;

  border:1px solid #cfcfcf;

  border-radius:10px;

  font-size:14px;

  background:var(--input-bg);

  color:var(--input-text);

}

.form-group input::placeholder{

  color:rgba(255,255,255,.65);

}

/* =========================================================
   RADIO BUTTONS
========================================================= */

.radio-group{

  display:grid;

  gap:10px;

  margin-top:8px;

}

.radio-row{

  display:flex;

  align-items:center;

  justify-content:space-between;

  gap:10px;

  padding:10px 12px;

  border:1px solid var(--accent);

  border-radius:12px;

  background:#0D1117;

  cursor:pointer;

  transition:.2s;

  color:var(--text);

  font-weight:600;

}

.radio-row:hover{

  background:#092330;

  border-color:#1f9bd1;

}

.radio-row input{

  width:18px;

  height:18px;

  accent-color:#00AEEF;

  cursor:pointer;

  flex-shrink:0;

}

.radio-row span{

  flex:1;

  text-align:right;

}

/* =========================================================
   BUTTONS
========================================================= */

.buttons{

  display:grid;

  grid-template-columns:1fr 1fr;

  gap:8px;

  margin-top:14px;

}

button{

  border:0;

  border-radius:10px;

  padding:11px;

  font-weight:700;

  cursor:pointer;

  font-size:14px;

}

.print-btn {
    background: linear-gradient(150deg, #371161 0%, #5840cf 45%, #3e81ed 100%);
    color: #ffffff;
    box-shadow: 0 8px 22px rgba(0,174,239,.22);
}

.clear-btn {
    background: #f5dae1;
    color: #111;
}

.sample-btn{

  background:#eef3ff;

  color:#173d7a;

  grid-column:1/-1;

}

.footer-note{

  margin-top:12px;

  padding-top:10px;

  border-top:1px solid rgba(255,255,255,.12);

  font-size:11px;

  line-height:1.5;

  color:var(--muted);

  text-align:center;

}

.toggle-row{

  margin-top:12px;

  font-size:12px;

  color:var(--muted);

  display:flex;

  gap:6px;

  align-items:center;

}

/* =========================================================
   PREVIEW
========================================================= */

.preview{

  min-width:0;

  display:flex;

  justify-content:center;

}

.pages{

  width:210mm;

}

.sheet{

  position:relative;

  width:210mm;

  height:297mm;

  background:#fff;

  margin:0 auto 18px;

  box-shadow:0 0 18px var(--paper-shadow);

  overflow:hidden;

  page-break-after:always;

}

.sheet:last-child{

  page-break-after:auto;

}

.page-img{

  position:absolute;

  inset:0;

  width:100%;

  height:100%;

  display:block;

  z-index:1;

}

.overlay-layer{

  position:absolute;

  inset:0;

  z-index:2;

  pointer-events:none;

}

/* =========================================================
   OVERLAY FIELDS
========================================================= */

.fill-field{

  position:absolute;

  display:flex;

  align-items:center;

  justify-content:center;

  text-align:center;

  white-space:nowrap;

  overflow:hidden;

  line-height:1;

  font-weight:700;

  color:#000;

  padding:0 2px;

  direction:rtl;

  z-index:2;

  background:transparent;

  font-family:Arial,Helvetica,sans-serif;

  unicode-bidi:plaintext;

}

.fill-field.ltr,
.fill-field.num{

  direction:ltr;

  text-align:center;

  justify-content:center;

}

.fill-field.empty{

  color:transparent;

}

body.show-boxes .fill-field{

  outline:1px dashed #0a66ff;

  background:rgba(255,255,190,.70)!important;

  color:#000!important;

}

/* =========================================================
   PRINT
========================================================= */

@page{

  size:A4;

  margin:0;

}

@media print{

  html,
  body{

    background:white!important;

    margin:0!important;

    padding:0!important;

  }

  .sidebar,
  .form-panel{

    display:none!important;

  }

  .app-shell{

    display:block!important;

    padding:0!important;

  }

  .preview{

    display:block!important;

  }

  .pages{

    width:210mm!important;

    margin:0!important;

  }

  .sheet{

    width:210mm!important;

    height:297mm!important;

    margin:0!important;

    box-shadow:none!important;

    break-after:page;

    page-break-after:always;

  }

  .sheet:last-child{

    break-after:auto;

    page-break-after:auto;

  }

  .fill-field{

    -webkit-print-color-adjust:exact;

    print-color-adjust:exact;

  }

}

/* ===== FINAL MENU ALIGNMENT FIX ===== */

.menu-group-title{
  position:relative;
}

.menu-group-title .menu-icon{
  right:14px;
}

.menu-group-title::after{
  content:"⌄";
  position:absolute;
  left:18px;
  top:50%;
  transform:translateY(-50%) rotate(0deg);
  transform-origin:center;
  font-size:18px;
  transition:transform .2s ease;
}

.menu-group[open] > .menu-group-title::after{
  transform:translateY(-50%) rotate(180deg);
}

/* קצת מוריד את האייקון של GEELY FIX למרכז */
.menu-group-title .menu-icon{
  top:50%;
  transform:translate(-50%, -50%);
}

/* ממרכז את הטקסט בכפתור הקבוצה */
.menu-group-title .menu-btn-title{
  top:50%;
  transform:translate(0%, 50%);
}

.news-box{
  cursor:pointer;
}

.news-box summary{
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  min-height:24px;
  cursor:pointer;
  user-select:none;
}

.news-box .news-title{
  pointer-events:auto;
}

/* =========================================
   STARTUP POPUP
========================================= */

.startup-popup {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.startup-box {
    width: min(420px, 92vw);
    background: #161B22;
    border: 1px solid #0A7FB0;
    border-radius: 22px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,.45);
    text-align: center;
    animation: popupIn .25s ease;
}

.startup-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 14px;
}

.startup-text {
    color: #B6C2CF;
    line-height: 1.8;
    font-size: 14px;
    margin-bottom: 18px;
}

#closeStartupPopup {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 15px;
    color: white;
    background: linear-gradient( 135deg, #005F87, #00AEEF );
}

    #closeStartupPopup:hover {
        filter: brightness(1.08);
    }

@keyframes popupIn {

    from {
        opacity: 0;
        transform: translateY(10px) scale(.96);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* =========================================================
   EXTERNAL APP / IFRAME MODULE
========================================================= */

.external-app-container {
    display: none;
    width: 100%;
    height: 100vh;
}

.external-app-frame {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 18px;
    background: white;
}

.app-shell.external-mode {
    grid-template-columns: 230px 1fr;
}

    .app-shell.external-mode .preview {
        width: 100%;
        justify-content: stretch;
    }

    .app-shell.external-mode .external-app-container {
        width: 100%;
        height: calc(100vh - 32px);
    }

    .app-shell.external-mode .external-app-frame {
        width: 100%;
        height: 100%;
    }

/* ===== EXTERNAL APP FULL WIDTH FIX ===== */

.app-shell.external-mode {
    grid-template-columns: 230px 1fr;
}

    .app-shell.external-mode .form-panel {
        display: none !important;
    }

    .app-shell.external-mode .preview {
        grid-column: 2;
        width: 100%;
        justify-content: stretch;
    }

    .app-shell.external-mode .external-app-container {
        display: block;
        width: 100%;
        height: calc(100vh - 32px);
    }

    .app-shell.external-mode .external-app-frame {
        width: 100%;
        height: 100%;
        border: 0;
        border-radius: 18px;
    }

#loginScreen {
    position: fixed;
    inset: 0;
    background: #111827;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.login-box {
    width: 320px;
    padding: 30px;
    border-radius: 20px;
    background: #1f2937;
    text-align: center;
    filter: drop-shadow(0 0 10px rgba(36,211,238,.9)) drop-shadow(0 0 50px rgba(36,211,238,.5)) drop-shadow(0 0 100px rgba(36,211,238,.1));
    color: white;
}

.login-logo {
    width: 100px;
    filter: drop-shadow(0 0 10px rgba(36,211,238,.9));
    margin-bottom: 15px;
}

.login-box input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 1px solid #cfcfcf;
    border-radius: 10px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--input-text);
}

.login-box button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

#error {
    color: #ff6b6b;
    margin-top: 10px;
}

.login-input {
    width: 100%;
    height: 46px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 14px;
    background: rgba(15,23,42,.75);
    color: #fff;
    padding: 0 16px;
    font-size: 15px;
    outline: none;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
    transition: .2s ease;
}

    .login-input::placeholder {
        color: rgba(255,255,255,.45);
    }

    .login-input:focus {
        border-color: rgba(36,211,238,.75);
        box-shadow: 0 0 0 3px rgba(36,211,238,.12), 0 0 24px rgba(36,211,238,.16);
    }

.login-btn {
    width: 100%;
    height: 46px;
    border: none;
    border-radius: 14px;
    margin-top: 12px;
    cursor: pointer;
    color: #fff;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0,0,0,.3);
    font-size: 18px;
    font-family: inherit;
    background: linear-gradient(135deg,#155e75,#5b21b6);
    box-shadow: 0 14px 30px rgba(36,211,238,.18), 0 10px 28px rgba(168,85,247,.16);
    transition: .2s ease;
}

    .login-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 18px 38px rgba(36,211,238,.26), 0 12px 34px rgba(168,85,247,.22);
    }

    .login-btn:active {
        transform: translateY(0);
    }