:root{
  --navy:#10263d;
  --navy-soft:#193959;
  --red:#c81924;
  --red-dark:#9e111b;
  --bg:#dbe5ec;
  --panel:#f8fafc;
  --surface:#ffffff;
  --line:#cfd8e3;
  --text:#142033;
  --muted:#667085;
  --success:#0e8d5f;
  --shadow:0 24px 60px rgba(16, 38, 61, .16);
}

*{box-sizing:border-box}

body{
  margin:0;
  font-family:"Segoe UI",Tahoma,Geneva,Verdana,sans-serif;
  background:
    radial-gradient(circle at top left, rgba(200,25,36,.10), transparent 20%),
    linear-gradient(135deg, #eef3f7 0%, var(--bg) 100%);
  color:var(--text);
}

.auth-body{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.auth-shell{
  width:100%;
  max-width:460px;
}

.auth-card{
  background:rgba(255,255,255,.94);
  border:1px solid rgba(16,38,61,.08);
  border-radius:24px;
  padding:32px 28px;
  box-shadow:0 24px 60px rgba(16,38,61,.16);
}

.auth-logo{
  display:block;
  max-width:220px;
  width:100%;
  height:auto;
  margin-bottom:20px;
}

.auth-copy{
  margin:10px 0 18px;
  color:var(--muted);
  line-height:1.5;
}

.auth-form{
  display:grid;
  gap:14px;
}

.auth-error{
  border:1px solid rgba(200,25,36,.16);
  background:rgba(255,244,245,.95);
  color:var(--red-dark);
  border-radius:12px;
  padding:12px 14px;
  margin-bottom:14px;
  font-size:14px;
  font-weight:700;
}

button,input,textarea,select{
  font:inherit;
}

.app{
  display:grid;
  grid-template-columns:420px 1fr;
  min-height:100vh;
}

.panel{
  background:rgba(248,250,252,.92);
  backdrop-filter:blur(18px);
  border-right:1px solid rgba(16,38,61,.08);
  padding:24px;
  overflow:auto;
  max-height:100vh;
}

.panel-header{
  display:grid;
  gap:16px;
  margin-bottom:18px;
}

.auth-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
  padding:12px 14px;
  border-radius:14px;
  background:rgba(16,38,61,.05);
  border:1px solid rgba(16,38,61,.08);
}

.auth-toolbar-label{
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:1.2px;
  color:var(--muted);
  font-weight:800;
}

.logout-link{
  color:var(--navy);
  font-weight:800;
  text-decoration:none;
}

.logout-link:hover{
  text-decoration:underline;
}

.panel-tabs{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:10px;
  margin-bottom:14px;
}

.tab-button{
  background:#fff;
  color:var(--navy);
  border:1px solid rgba(16,38,61,.12);
  box-shadow:none;
}

.tab-button.active{
  background:linear-gradient(180deg, var(--navy-soft), var(--navy));
  color:#fff;
  box-shadow:0 14px 26px rgba(16,38,61,.18);
}

[data-tab-panel][hidden]{
  display:none;
}

.eyebrow{
  margin:0 0 8px;
  color:var(--red);
  text-transform:uppercase;
  letter-spacing:1.6px;
  font-size:11px;
  font-weight:800;
}

.panel h1,
.preview-topbar h2{
  margin:0;
  color:var(--navy);
}

.panel h1{
  font-size:28px;
  line-height:1.05;
}

.intro{
  font-size:14px;
  color:var(--muted);
  margin:8px 0 0;
  line-height:1.5;
}

.status-card{
  border:1px solid rgba(16,38,61,.08);
  background:linear-gradient(180deg, rgba(255,255,255,.96), rgba(236,242,247,.95));
  border-radius:18px;
  padding:16px;
  box-shadow:0 10px 30px rgba(16,38,61,.08);
}

.status-label{
  display:block;
  font-size:11px;
  letter-spacing:1.4px;
  text-transform:uppercase;
  color:var(--muted);
  margin-bottom:6px;
}

.status-card strong{
  display:block;
  font-size:18px;
  color:var(--success);
}

.status-card small{
  display:block;
  margin-top:6px;
  color:var(--muted);
}

.panel-section{
  background:rgba(255,255,255,.8);
  border:1px solid rgba(16,38,61,.08);
  border-radius:20px;
  padding:16px;
  margin-bottom:14px;
  box-shadow:0 10px 22px rgba(16,38,61,.05);
}

.panel-tools{
  background:linear-gradient(180deg, rgba(16,38,61,.05), rgba(255,255,255,.82));
}

.section-title{
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:1.2px;
  color:var(--navy-soft);
  font-weight:800;
  margin-bottom:14px;
}

label{
  display:block;
  font-size:12px;
  font-weight:700;
  margin:12px 0 0;
  color:#344054;
}

input,textarea,select{
  width:100%;
  margin-top:6px;
  border:1px solid var(--line);
  border-radius:12px;
  padding:11px 12px;
  background:#fff;
  font-size:14px;
  color:var(--text);
  transition:border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

input:focus,textarea:focus,select:focus{
  outline:none;
  border-color:rgba(200,25,36,.65);
  box-shadow:0 0 0 4px rgba(200,25,36,.10);
}

textarea{
  min-height:82px;
  resize:vertical;
}

.invalid{
  border-color:rgba(200,25,36,.78);
  background:rgba(255,244,245,.95);
}

.button-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:10px;
  margin-top:14px;
}

.buttons{
  display:flex;
  gap:10px;
  position:sticky;
  bottom:0;
  padding-top:14px;
  background:linear-gradient(180deg, rgba(248,250,252,0), rgba(248,250,252,.95) 32%);
}

button{
  flex:1;
  border:0;
  border-radius:12px;
  padding:12px 14px;
  cursor:pointer;
  font-weight:800;
  letter-spacing:.2px;
  transition:transform .16s ease, box-shadow .16s ease, background .16s ease;
}

button:hover{
  transform:translateY(-1px);
}

button:disabled{
  cursor:wait;
  opacity:.75;
  transform:none;
}

button:not(.secondary):not(.ghost){
  background:linear-gradient(180deg, var(--red), var(--red-dark));
  color:#fff;
  box-shadow:0 14px 26px rgba(200,25,36,.22);
}

button.secondary{
  background:linear-gradient(180deg, var(--navy-soft), var(--navy));
  color:#fff;
  box-shadow:0 14px 26px rgba(16,38,61,.18);
}

button.ghost{
  background:#fff;
  color:var(--navy);
  border:1px solid rgba(16,38,61,.12);
}

.preview-wrap{
  padding:28px;
  overflow:auto;
}

.preview-topbar{
  display:flex;
  justify-content:space-between;
  align-items:end;
  gap:20px;
  margin:0 auto 22px;
  width:min(100%, 980px);
}

.preview-meta{
  display:flex;
  flex-direction:column;
  gap:6px;
  text-align:right;
  color:var(--muted);
  font-size:13px;
}

.preview-meta span{
  background:rgba(255,255,255,.72);
  border:1px solid rgba(16,38,61,.08);
  border-radius:999px;
  padding:8px 12px;
}

.certificate{
  width:794px;
  height:1123px;
  background:
    radial-gradient(circle at 50% 46%, rgba(16, 38, 61, .05) 0 1px, transparent 1px 100%),
    radial-gradient(circle at 50% 46%, rgba(16, 38, 61, .028) 0 90px, transparent 90px 100%),
    radial-gradient(circle at 50% 46%, rgba(200, 25, 36, .022) 0 150px, transparent 150px 100%),
    repeating-linear-gradient(45deg, rgba(16, 38, 61, .022) 0 1px, transparent 1px 22px),
    repeating-linear-gradient(-45deg, rgba(16, 38, 61, .018) 0 1px, transparent 1px 22px),
    repeating-linear-gradient(90deg, rgba(200, 25, 36, .012) 0 1px, transparent 1px 28px),
    linear-gradient(180deg, rgba(16, 38, 61, .02) 0%, rgba(16, 38, 61, 0) 18%, rgba(200, 25, 36, .012) 100%),
    #fff;
  margin:auto;
  position:relative;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  padding:54px 66px 34px;
  border:1px solid #dde3ea;
  box-shadow:var(--shadow);
}

.certificate::before{
  content:"";
  position:absolute;
  inset:-34px -88px auto auto;
  width:360px;
  height:178px;
  background:var(--navy);
  transform:skewY(-16deg);
  z-index:0;
}

.certificate::after{
  content:"";
  position:absolute;
  left:-80px;
  top:-70px;
  width:820px;
  height:250px;
  border-radius:0 0 90% 0;
  border-bottom:18px solid var(--red);
  opacity:.95;
  z-index:0;
}

.top-corner{
  position:absolute;
  right:40px;
  top:30px;
  color:#fff;
  font-weight:800;
  letter-spacing:.8px;
  line-height:1.45;
  text-align:right;
  z-index:2;
  font-size:14px;
}

.certificate-header{
  display:flex;
  align-items:center;
  position:relative;
  z-index:2;
  margin-bottom:72px;
  width:100%;
  max-width:310px;
  min-height:88px;
}

.logo-image{
  display:block;
  width:auto;
  max-width:100%;
  max-height:88px;
  height:auto;
  object-fit:contain;
}

.certificate h3{
  text-align:center;
  color:var(--navy);
  font-size:36px;
  letter-spacing:5px;
  margin:24px 0 0;
  font-weight:900;
}

.red-line{
  width:240px;
  height:3px;
  background:linear-gradient(90deg,transparent,var(--red),transparent);
  margin:12px auto 24px;
}

.info{
  font-size:13px;
  line-height:1.3;
}

.row{
  display:grid;
  grid-template-columns:175px 20px 1fr;
  gap:0;
  margin:11px 0;
}

.row strong,
.standards,
.company span{
  white-space:pre-line;
  overflow-wrap:anywhere;
}

hr{
  border:0;
  border-top:1.5px solid #6b7280;
  margin:18px 0 12px;
}

.cert-text{
  font-size:13px;
  line-height:1.35;
  margin:0 0 10px;
}

.standards{
  text-align:center;
  font-size:12.5px;
  font-weight:800;
  line-height:1.35;
  margin-bottom:12px;
}

.approval{
  display:grid;
  grid-template-columns:1fr 125px;
  align-items:center;
  margin-top:10px;
  gap:14px;
}

.signature small{
  display:block;
  font-weight:800;
  color:#344054;
  font-size:11px;
}

footer{
  margin-top:auto;
  border-top:2px solid var(--navy);
  padding-top:12px;
  display:grid;
  grid-template-columns:190px 1fr 92px;
  gap:8px;
  align-items:start;
  font-size:9px;
}

.date{
  font-size:13px;
  line-height:1.2;
}

.company span{
  display:block;
  margin-top:4px;
  color:#475467;
  line-height:1.15;
}

.company b{
  display:block;
  white-space:pre-line;
}

.contacts{
  display:flex;
  flex-direction:column;
  gap:2px;
  color:#344054;
}

.iso{
  border-left:1px solid #9aa4b2;
  padding-left:8px;
  text-align:center;
  font-weight:900;
  color:var(--navy);
}

.iso small{
  font-size:6.5px;
  color:#475467;
}

@media (max-width: 1240px){
  .app{
    grid-template-columns:1fr;
  }

  .panel{
    max-height:none;
    border-right:0;
    border-bottom:1px solid rgba(16,38,61,.08);
  }

  .preview-topbar{
    width:794px;
  }
}

@media (max-width: 860px){
  .preview-wrap{
    padding:18px;
  }

  .preview-topbar{
    width:100%;
    flex-direction:column;
    align-items:flex-start;
  }

  .preview-meta{
    width:100%;
    text-align:left;
  }

  .certificate{
    transform-origin:top center;
    transform:scale(.76);
    margin-left:-95px;
    margin-right:-95px;
  }
}

@media (max-width: 640px){
  .panel{
    padding:16px;
  }

  .button-grid,
  .buttons{
    grid-template-columns:1fr;
    flex-direction:column;
  }

  .certificate{
    transform:scale(.56);
    margin-left:-174px;
    margin-right:-174px;
    margin-bottom:-480px;
  }
}

@media print{
  @page{
    size:A4 portrait;
    margin:10mm;
  }

  html,
  body{
    width:210mm;
    height:297mm;
    background:#fff;
    margin:0;
    overflow:hidden;
  }

  .panel,
  .preview-topbar{
    display:none;
  }

  .app{
    display:block;
  }

  .preview-wrap{
    padding:0;
    width:auto;
    height:auto;
    overflow:visible;
  }

  .certificate{
    box-shadow:none;
    border:0;
    margin:0;
    width:210mm;
    height:297mm;
    zoom:.9;
    transform:none;
    box-sizing:border-box;
    page-break-inside:avoid;
    break-inside:avoid-page;
  }
}
