*{box-sizing:border-box}
:root{
  --bg:#edf5ec;--card:#fff;--text:#254131;--muted:#718578;--dark:#123d2b;
  --green:#39b468;--green2:#73d58f;--line:#dce9de;
  --shadow:0 18px 50px rgba(24,72,42,.10)
}
html{scroll-behavior:smooth}
body{
  margin:0;font-family:Inter,Manrope,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:var(--bg);color:var(--text);line-height:1.6
}
button,input,textarea,select{font:inherit}
button{cursor:pointer}
a{text-decoration:none;color:inherit}
img{display:block;max-width:100%}
.hidden{display:none!important}
.container{width:min(1160px,calc(100% - 32px));margin:auto;position:relative;z-index:2}
.ambient{position:fixed;width:420px;height:420px;border-radius:999px;filter:blur(100px);opacity:.35;pointer-events:none}
.ambient-one{background:#8bdf9e;left:-160px;top:120px}
.ambient-two{background:#9fd1ff;right:-180px;top:80px}

.site-header,.admin-header{
  display:flex;align-items:center;justify-content:space-between;gap:20px;padding:24px 0
}
.brand{display:flex;align-items:center;gap:14px}
.brand-mark{
  width:56px;height:56px;border-radius:18px;display:grid;place-items:center;
  background:linear-gradient(135deg,#42c976,#258d51);color:#fff;font-weight:900;
  box-shadow:0 14px 30px rgba(48,159,89,.28)
}
.brand strong{display:block;color:var(--dark);font-size:1.15rem}
.brand span{display:block;color:var(--muted);font-size:.86rem}
.top-nav,.admin-actions{display:flex;align-items:center;gap:18px}
.top-nav a{font-weight:700;color:#54705f}
.ghost-button{padding:11px 16px;border:1px solid var(--line);border-radius:14px;background:#fff;font-weight:800;color:var(--dark)}
.primary-button,.secondary-button{
  display:inline-flex;align-items:center;justify-content:center;min-height:50px;
  padding:0 20px;border-radius:16px;font-weight:900;border:0
}
.primary-button{background:linear-gradient(135deg,#48c879,#2cab5f);color:#fff;box-shadow:0 14px 28px rgba(44,171,95,.25)}
.secondary-button{background:#fff;color:var(--dark);border:1px solid var(--line)}

.hero{display:grid;grid-template-columns:1.15fr .85fr;gap:24px;padding:40px 0 24px}
.hero-content,.hero-visual{border-radius:40px;box-shadow:var(--shadow)}
.hero-content{padding:54px;background:linear-gradient(145deg,#d8f2dc,#c7e9cc)}
.hero-content h1{
  font-size:clamp(2.8rem,6vw,5rem);line-height:.98;letter-spacing:-.06em;
  color:var(--dark);margin:12px 0 22px
}
.hero-content p{font-size:1.05rem;color:#4d6758;max-width:700px}
.eyebrow{text-transform:uppercase;letter-spacing:.14em;font-size:.75rem;font-weight:900;color:#5c9870}
.hero-actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:28px}
.hero-visual{background:#fff;padding:28px;display:flex;align-items:center}
.visual-card{width:100%;background:#f5faf5;border:1px solid var(--line);border-radius:28px;padding:30px}
.visual-label{display:inline-block;padding:8px 12px;border-radius:999px;background:#e3f5e6;color:#3f8456;font-weight:800;font-size:.8rem}
.visual-card strong{display:block;font-size:2rem;color:var(--dark);margin:18px 0 10px}
.visual-card p{color:var(--muted)}
.visual-pills{display:flex;gap:8px;flex-wrap:wrap;margin-top:20px}
.visual-pills span{padding:9px 12px;border-radius:999px;background:#fff;border:1px solid var(--line);font-weight:800}

.section{padding:64px 0 10px}
.section-heading{margin-bottom:24px}
.section-heading h2,.community h2{
  font-size:clamp(2rem,4vw,3.3rem);letter-spacing:-.045em;color:var(--dark);margin:6px 0
}
.section-heading p,.community p{color:var(--muted)}
.course-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}
.course-card,.subject-card,.type-card{
  border:1px solid transparent;background:#fff;border-radius:24px;box-shadow:var(--shadow);
  transition:.2s ease;text-align:left
}
.course-card:hover,.subject-card:hover,.type-card:hover,
.course-card.active,.subject-card.active,.type-card.active{
  transform:translateY(-4px);border-color:#7ccc91
}
.course-card{padding:24px}
.course-number{
  width:48px;height:48px;border-radius:16px;background:#e8f7ea;color:#31915a;
  display:grid;place-items:center;font-size:1.3rem;font-weight:900;margin-bottom:18px
}
.course-card strong{display:block;font-size:1.2rem;color:var(--dark)}
.course-card small{color:var(--muted)}
.catalog-step{
  margin-top:26px;background:rgba(255,255,255,.7);border:1px solid rgba(255,255,255,.9);
  border-radius:30px;padding:24px;box-shadow:var(--shadow)
}
.step-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:18px}
.step-head>div{display:flex;align-items:center;gap:12px}
.step-head h3{margin:0;color:var(--dark)}
.step-number{
  width:36px;height:36px;border-radius:12px;background:#dff4e4;color:#2f8f56;
  display:grid;place-items:center;font-weight:900
}
.text-button{border:0;background:none;color:#318c56;font-weight:900}
.subject-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}
.subject-card{padding:20px;display:flex;gap:12px;align-items:center}
.subject-card span{font-size:1.25rem}
.type-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.type-card{padding:18px;text-align:center}
.type-card span{display:block;font-size:1.5rem;margin-bottom:8px}
.materials-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}
.material-card{overflow:hidden;background:#fff;border-radius:24px;box-shadow:var(--shadow)}
.material-media{height:180px;background:#e5f4e7}
.material-media img{width:100%;height:100%;object-fit:cover}
.material-placeholder{height:100%;display:grid;place-items:center;color:#309158;font-size:2rem;font-weight:900}
.material-body{padding:20px}
.material-body h4{font-size:1.15rem;color:var(--dark);margin:0 0 8px}
.material-body p{color:var(--muted);margin:0 0 16px}
.material-links{display:flex;gap:8px;flex-wrap:wrap}
.material-link,.community-link{padding:10px 13px;border-radius:13px;font-weight:900}
.telegram-link{background:#35a7ef;color:#fff}
.max-link{background:#8d55e9;color:#fff}
.yandex-link{background:#f0c02d;color:#3e3100}

.news-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:18px}
.news-card{
  padding:0;overflow:hidden;border:0;border-radius:26px;background:#fff;box-shadow:var(--shadow);
  display:grid;grid-template-columns:180px 1fr;text-align:left
}
.news-image{background:#e7f5e8;min-height:190px}
.news-image img{width:100%;height:100%;object-fit:cover}
.news-placeholder{height:100%;display:grid;place-items:center;color:#328f58;font-weight:900}
.news-copy{padding:22px}
.news-copy small{color:#7a8f82}
.news-copy h3{color:var(--dark);margin:8px 0}
.news-copy p{color:var(--muted);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.news-copy span{font-weight:900;color:#339159}

.community{
  margin-top:64px;margin-bottom:26px;padding:32px;background:#fff;border-radius:30px;
  box-shadow:var(--shadow);display:flex;align-items:flex-end;justify-content:space-between;gap:24px
}
.community-links{display:flex;gap:10px;flex-wrap:wrap}
.site-footer{padding:30px 0 44px;display:flex;justify-content:space-between;gap:24px;color:var(--muted)}
.site-footer strong{color:var(--dark)}
.rights{max-width:600px}
.rights a{color:#278e51;font-weight:900}
.loading-box,.empty-state{
  padding:30px;border-radius:22px;background:#fff;color:var(--muted);
  text-align:center;border:1px dashed #cfe0d2
}

/* Modal windows */
.modal{border:0;padding:0;background:transparent;max-width:min(680px,calc(100% - 24px));width:100%}
.modal::backdrop{background:rgba(13,33,22,.52);backdrop-filter:blur(5px)}
.modal-card{position:relative;background:#fff;border-radius:28px;padding:28px;box-shadow:0 30px 80px rgba(0,0,0,.2)}
.wide-modal{max-height:90vh;overflow:auto}
.modal-close{
  position:absolute;right:16px;top:14px;width:38px;height:38px;border:0;
  border-radius:12px;background:#eef5ef;font-size:1.4rem
}
.modal-card h2{color:var(--dark);margin-top:4px}
.modal-card label{display:block;font-weight:800;color:#496253;margin:14px 0}
.modal-card input,.modal-card textarea,.modal-card select{
  width:100%;margin-top:6px;border:1px solid var(--line);border-radius:14px;
  padding:12px 14px;background:#fbfdfb;color:var(--text)
}
.two-cols{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.form-status{color:#3b8857}
.news-modal-image{width:100%;max-height:340px;object-fit:cover;border-radius:20px;margin-bottom:18px}

/* Installer and admin */
.simple-page,.admin-body{min-height:100vh;padding:20px}
.simple-page{display:grid;place-items:center}
.install-card,.login-card{
  width:min(480px,100%);padding:30px;background:#fff;border-radius:30px;box-shadow:var(--shadow)
}
.login-card{margin:50px auto}
.install-card label,.login-card label{display:block;font-weight:800;color:#496253;margin:14px 0}
.install-card input,.login-card input{
  width:100%;margin-top:6px;border:1px solid var(--line);border-radius:14px;padding:12px 14px;background:#fbfdfb
}
.alert{padding:12px;border-radius:12px;margin:12px 0}
.alert.error{background:#ffe8e8;color:#9c2d2d}
.alert.success{background:#e6f7ea;color:#267545}
.admin-shell{width:min(1200px,100%);margin:0 auto}
.stats-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
.stat-card{background:#fff;border-radius:22px;padding:20px;box-shadow:var(--shadow)}
.stat-card span{color:var(--muted)}
.stat-card strong{display:block;color:var(--dark);font-size:2rem}
.admin-tabs{display:flex;gap:8px;flex-wrap:wrap;margin:24px 0}
.admin-tabs button{border:0;padding:11px 15px;border-radius:13px;background:#fff;font-weight:900;color:#5d7566}
.admin-tabs button.active{background:#2faa60;color:#fff}
.admin-panel{background:#fff;border-radius:26px;padding:22px;box-shadow:var(--shadow)}
.panel-heading{display:flex;align-items:center;justify-content:space-between;gap:14px;margin-bottom:18px}
.panel-heading h2{margin:0}
.admin-list{display:grid;gap:10px}
.admin-row,.suggestion-row{border:1px solid var(--line);border-radius:18px;padding:16px}
.admin-row{display:flex;align-items:center;justify-content:space-between;gap:16px}
.admin-row strong,.suggestion-row strong{display:block;color:var(--dark)}
.admin-row span,.suggestion-row span{color:var(--muted);font-size:.9rem}
.row-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.row-actions button{border:0;padding:9px 12px;background:#edf6ef;border-radius:11px;font-weight:800}
.row-actions .danger{background:#ffeded;color:#a73838}
.status-pill{padding:7px 9px;border-radius:999px;font-size:.78rem!important;font-weight:900}
.status-pill.published{background:#e5f6e8;color:#2e8452}
.status-pill.draft{background:#f2f2f2;color:#777}
.suggestion-top{display:flex;justify-content:space-between;gap:14px}
.suggestion-row select{border:1px solid var(--line);border-radius:12px;padding:8px}
.suggestion-row p{white-space:pre-wrap}
.check-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.checkbox-line{display:flex!important;align-items:center;gap:8px;font-weight:700!important}
.checkbox-line input{width:auto!important;margin:0!important}

@media(max-width:900px){
  .hero{grid-template-columns:1fr}
  .course-grid,.subject-grid,.materials-grid{grid-template-columns:repeat(2,1fr)}
  .type-grid{grid-template-columns:repeat(2,1fr)}
  .stats-grid{grid-template-columns:repeat(2,1fr)}
  .news-grid{grid-template-columns:1fr}
  .community{align-items:flex-start;flex-direction:column}
}
@media(max-width:650px){
  .container{width:min(100% - 20px,1160px)}
  .site-header,.admin-header{align-items:flex-start}
  .top-nav{display:none}
  .hero{padding-top:12px}
  .hero-content{padding:28px 20px}
  .hero-content h1{font-size:2.6rem}
  .course-grid,.subject-grid,.materials-grid,.type-grid,.stats-grid{grid-template-columns:1fr}
  .news-card{grid-template-columns:1fr}
  .news-image{height:180px}
  .community,.site-footer,.admin-row,.suggestion-top{flex-direction:column;align-items:flex-start}
  .two-cols{grid-template-columns:1fr}
  .check-grid{grid-template-columns:repeat(2,1fr)}
  .admin-actions{flex-wrap:wrap;justify-content:flex-end}
}

/* ===== BreakingMed redesign v20 ===== */
.brand-logo{
  width:58px;
  height:58px;
  flex:0 0 58px;
  border-radius:50%;
  object-fit:contain;
  filter:drop-shadow(0 10px 20px rgba(35,142,82,.24));
}

.hero.hero-single{
  display:block;
  padding-top:34px;
  padding-bottom:18px;
}

.hero.hero-single .hero-content{
  width:100%;
  min-height:510px;
  padding:clamp(34px,6vw,76px);
  border-radius:42px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  background:
    radial-gradient(circle at 88% 18%, rgba(255,255,255,.46), transparent 30%),
    linear-gradient(135deg,#d8f3dc 0%,#c5e9cc 52%,#bfe5c8 100%);
}

.hero.hero-single .hero-content h1{
  max-width:920px;
  font-size:clamp(3rem,7vw,6.2rem);
  line-height:.93;
  margin:18px 0 26px;
}

.hero.hero-single .hero-content p{
  max-width:760px;
  font-size:clamp(1rem,1.45vw,1.2rem);
}

.news-section{
  padding-top:54px;
}

.news-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:22px;
}

.news-card{
  width:100%;
  min-height:260px;
  display:grid;
  grid-template-columns:minmax(260px,38%) 1fr;
  border-radius:30px;
  overflow:hidden;
  background:#fff;
  box-shadow:var(--shadow);
  text-align:left;
}

.news-image{
  min-height:260px;
}

.news-copy{
  padding:clamp(24px,4vw,48px);
  display:flex;
  flex-direction:column;
  justify-content:center;
}

.news-copy h3{
  font-size:clamp(1.6rem,3vw,2.65rem);
  line-height:1.08;
}

.news-copy p{
  font-size:1rem;
  -webkit-line-clamp:4;
}

#catalog.section{
  padding-top:76px;
}

@media(max-width:760px){
  .brand-logo{
    width:48px;
    height:48px;
    flex-basis:48px;
  }

  .hero.hero-single .hero-content{
    min-height:430px;
    padding:34px 22px;
    border-radius:30px;
  }

  .hero.hero-single .hero-content h1{
    font-size:clamp(2.65rem,14vw,4.2rem);
  }

  .news-card{
    grid-template-columns:1fr;
  }

  .news-image{
    height:210px;
    min-height:210px;
  }
}
