*{box-sizing:border-box}
html,body{margin:0;max-width:100%;min-height:100%;font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;background:#f6f7fb;color:#111827}
body{overflow-x:hidden}
img,svg,video,canvas{max-width:100%}
a{color:var(--primary,#2563eb);text-decoration:none;overflow-wrap:anywhere}
button,input,select,textarea{font:inherit;max-width:100%}
button{appearance:none}
form{min-width:0;max-width:100%}
label{overflow-wrap:anywhere}
code{overflow-wrap:anywhere;word-break:break-word}

.shell{min-height:100vh;display:flex;min-width:0}
.sidebar{width:245px;background:#fff;border-right:1px solid #e6e8ee;padding:18px 14px;display:flex;flex-direction:column;position:fixed;inset:0 auto 0 0;overflow-y:auto;overflow-x:hidden}
.brand{display:flex;gap:10px;align-items:center;padding:4px 6px 20px;min-width:0}
.brand img{width:42px;height:42px;object-fit:contain;flex:0 0 auto}
.brand>div{min-width:0}
.brand strong,.brand small{display:block;overflow:hidden;text-overflow:ellipsis}
.brand strong{white-space:nowrap}
.brand small{color:#6b7280;font-size:12px;margin-top:3px;white-space:normal;line-height:1.25}
.sidebar nav{display:grid;gap:4px}
.sidebar nav a{padding:10px 12px;border-radius:10px;color:#374151;overflow-wrap:anywhere}
.sidebar nav a:hover{background:#f3f4f6}
.sidebar-footer{margin-top:auto;border-top:1px solid #eef0f3;padding:14px 6px 0;color:#6b7280;font-size:12px;line-height:1.45}
.sidebar-footer span{font-size:11px}
.main{margin-left:245px;width:calc(100% - 245px);min-width:0}
.topbar{min-height:62px;background:#fff;border-bottom:1px solid #e6e8ee;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 26px;position:sticky;top:0;z-index:10}
.topbar>div{min-width:0}
.topbar strong{display:block;overflow-wrap:anywhere}
.userbox{font-size:14px;color:#6b7280;text-align:right;overflow-wrap:anywhere;flex:0 1 auto}
.content{width:100%;max-width:1320px;margin:0 auto;padding:24px;min-width:0}

.card{background:#fff;border:1px solid #e6e8ee;border-radius:12px;padding:18px;min-width:0;max-width:100%;overflow-wrap:anywhere}
.card h1,.card h2,.card h3,.card h4{max-width:100%;overflow-wrap:anywhere}
.grid{display:grid;gap:16px;min-width:0}
.grid>*{min-width:0}
.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}
.metric{min-width:0}
.metric strong{font-size:28px;display:block;overflow-wrap:anywhere}
.metric span{color:#6b7280;font-size:13px}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:40px;max-width:100%;border:0;border-radius:9px;padding:10px 14px;cursor:pointer;background:var(--primary,#2563eb);color:#fff;font-weight:600;line-height:1.2;text-align:center;white-space:normal;overflow-wrap:anywhere;vertical-align:middle}
.btn.secondary{background:#fff;color:#111827;border:1px solid #dfe3e8}
.btn.danger{background:#dc2626}
.btn.success{background:#15803d}
.btn.small{min-height:34px;padding:7px 10px;font-size:13px}
.actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px;min-width:0}
.actions form{display:inline-flex;margin:0;min-width:0}
.actions .btn{height:100%}

.field{display:grid;gap:6px;margin-bottom:14px;min-width:0}
.field label{font-size:13px;font-weight:600;line-height:1.35}
.field input,.field select,.field textarea{display:block;width:100%;min-width:0;max-width:100%;border:1px solid #dfe3e8;border-radius:9px;background:#fff;padding:10px 11px;outline:none;color:#111827}
.field textarea{resize:vertical;min-height:88px}
.field input[type="file"]{padding:8px;overflow:hidden}
.field input[type="color"]{min-height:42px;padding:5px}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--primary,#2563eb)}
input[type="checkbox"],input[type="radio"]{width:auto;max-width:none;vertical-align:middle}

.table-wrap{display:block;width:100%;max-width:100%;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch}
.table{width:100%;min-width:560px;border-collapse:collapse}
.table th,.table td{padding:11px 10px;border-bottom:1px solid #eef0f3;text-align:left;font-size:14px;vertical-align:middle;overflow-wrap:anywhere}
.table th{color:#6b7280;font-size:12px;text-transform:uppercase;letter-spacing:.03em;white-space:nowrap}
.table td form{min-width:0;margin:0}
.table td input:not([type="checkbox"]):not([type="radio"]),.table td select{width:100%;min-width:140px;max-width:260px;border:1px solid #dfe3e8;border-radius:8px;padding:8px 9px}
.table td .actions{min-width:220px}
.table .btn{flex:0 0 auto}
.party-logo{display:block;width:38px;height:38px;max-width:38px;max-height:38px;object-fit:contain;border:1px solid #eef0f3;border-radius:8px;background:#fff;padding:3px}

.badge{display:inline-flex;align-items:center;max-width:100%;padding:4px 8px;border-radius:999px;font-size:12px;line-height:1.25;background:#eef2ff;color:#3730a3;white-space:normal;text-align:center}
.badge.green{background:#ecfdf5;color:#047857}
.badge.red{background:#fef2f2;color:#b91c1c}
.badge.gray{background:#f3f4f6;color:#4b5563}
.alert{padding:12px 14px;border-radius:10px;margin-bottom:14px;border:1px solid #dbeafe;background:#eff6ff;overflow-wrap:anywhere}
.alert.error{border-color:#fecaca;background:#fef2f2;color:#991b1b}
.alert.success{border-color:#bbf7d0;background:#f0fdf4;color:#166534}
.section-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:14px;min-width:0}
.section-head>div{min-width:0}
.section-head h2,.section-head h3{margin:0;overflow-wrap:anywhere}
.section-head .actions{justify-content:flex-end}
.muted{color:#6b7280}
hr{border:0;border-top:1px solid #eef0f3;margin:18px 0}
details{max-width:100%}
summary{cursor:pointer;overflow-wrap:anywhere}

.public-main{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;padding:20px;width:100%;min-width:0}.public-main>.login-card{margin:auto 0}.public-main>.member-shell{margin:0 auto}
.login-card{width:min(440px,100%);max-width:100%;background:#fff;border:1px solid #e6e8ee;border-radius:14px;padding:24px;overflow:hidden}
.login-logo{max-width:88px;max-height:70px;display:block;margin:0 auto 12px;object-fit:contain}
.center{text-align:center}
.member-shell{width:min(680px,100%);max-width:100%;margin:0 auto;min-width:0}
.member-header{text-align:center;margin-bottom:16px;overflow-wrap:anywhere}
.member-header img{max-height:64px;max-width:120px;object-fit:contain}
.vote-btn{width:100%;min-height:66px;font-size:22px;margin:7px 0}
.waiting{padding:34px 18px;text-align:center}
.pulse{width:10px;height:10px;background:#16a34a;border-radius:50%;display:inline-block;margin-right:6px}

.tv{margin:0;width:100vw;height:100vh;min-height:100vh;overflow:hidden;background:var(--tv-secondary,#0f172a);color:#fff;padding:0}
.tv-stage{width:100vw;height:100vh;display:flex;flex-direction:column;overflow:hidden;background:linear-gradient(180deg,rgba(255,255,255,.035),transparent 30%),var(--tv-secondary,#0f172a)}
.tv-top{height:12vh;min-height:88px;display:flex;align-items:center;justify-content:space-between;gap:2vw;padding:1.7vh 2.4vw;border-bottom:1px solid rgba(255,255,255,.16);flex:0 0 auto;min-width:0}
.tv-brand{display:flex;align-items:center;gap:1.3vw;min-width:0;flex:1}
.tv-brand>div{min-width:0}
.tv-brand img{width:auto;height:min(8vh,88px);max-width:9vw;object-fit:contain;flex:0 0 auto}
.tv-chamber{font-size:clamp(24px,2vw,42px);font-weight:800;line-height:1.05;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tv-session{font-size:clamp(16px,1.18vw,25px);margin-top:.5vh;color:#cbd5e1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tv-clock{font-size:clamp(24px,2vw,42px);font-weight:700;font-variant-numeric:tabular-nums;flex:0 0 auto}
.tv-content{height:88vh;display:flex;flex-direction:column;padding:1.5vh 2.2vw 2vh;min-height:0;min-width:0}
.tv-message{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;font-size:clamp(30px,3vw,60px);font-weight:800;gap:1.2vh;padding:2vw;overflow-wrap:anywhere}
.tv-message span{font-size:.45em;color:#93c5fd;letter-spacing:.05em}
.tv-matter{text-align:center;flex:0 0 auto;min-height:12vh;min-width:0}
.tv-status-pill{display:inline-flex;max-width:100%;padding:.55vh 1.2vw;border-radius:999px;background:var(--tv-primary,#2563eb);font-size:clamp(13px,.9vw,19px);font-weight:800;letter-spacing:.04em;text-align:center}
.tv-matter h1{font-size:clamp(27px,2.15vw,44px);line-height:1.05;margin:1vh 0 .45vh;overflow-wrap:anywhere}
.tv-matter p{font-size:clamp(15px,1.08vw,23px);line-height:1.2;margin:0 auto;color:#cbd5e1;max-width:80vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tv-result{flex:0 0 auto;display:flex;justify-content:center;align-items:center;flex-wrap:wrap;gap:1.2vh 2.2vw;min-height:8vh;margin:.5vh 0 1vh;text-align:center}
.tv-result>strong{font-size:clamp(24px,2.3vw,48px);overflow-wrap:anywhere}
.tv-result>div{display:flex;flex-wrap:wrap;justify-content:center;gap:.7vw}
.tv-result span{font-size:clamp(14px,1vw,22px);padding:.65vh .85vw;border:1px solid rgba(255,255,255,.18);border-radius:10px;background:rgba(255,255,255,.06);white-space:nowrap}
.tv-result b{font-size:1.15em;margin-left:.25vw}
.tv-grid{flex:1;min-height:0;min-width:0;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));grid-auto-rows:minmax(0,1fr);gap:.8vw .8vh;align-content:stretch}
.tv-person{min-width:0;min-height:0;background:#1e293b;border:1px solid #334155;border-radius:12px;padding:.75vh .55vw;display:flex;align-items:center;gap:.65vw;overflow:hidden}
.tv-person.voted,.tv-person.choice{border-color:rgba(34,197,94,.65)}
.tv-person.absent{opacity:.58}
.tv-photo-wrap{flex:0 0 auto}
.tv-photo{width:clamp(52px,4.2vw,82px);height:clamp(52px,4.2vw,82px);border-radius:50%;object-fit:cover;background:#334155;display:block}
.tv-photo-empty{border:1px solid #475569}
.tv-person-info{min-width:0;flex:1}
.tv-person h3{font-size:clamp(14px,1.05vw,22px);line-height:1.05;margin:0 0 .45vh;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tv-party{display:flex;align-items:center;gap:.35vw;min-width:0;color:#cbd5e1;font-size:clamp(11px,.72vw,16px)}
.tv-party img{height:clamp(16px,1.4vw,28px);width:clamp(16px,1.4vw,28px);object-fit:contain;flex:0 0 auto}
.tv-party span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.tv-person-status{margin-top:.5vh;font-size:clamp(11px,.72vw,16px);font-weight:800;color:#f8fafc;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.cards-a4{width:210mm;max-width:210mm;margin:0 auto;background:#fff;display:grid;grid-template-columns:1fr 1fr;grid-template-rows:repeat(4,1fr);height:297mm}
.access-card{border:1px dashed #9ca3af;padding:8mm;overflow:hidden;display:grid;grid-template-columns:minmax(0,1fr) 32mm;gap:4mm;align-items:center;min-width:0}
.access-card>div{min-width:0}
.access-card h3{overflow-wrap:anywhere}
.access-card .code{white-space:nowrap}
.qr{width:30mm;height:30mm;overflow:hidden}
.print-only{display:none}

@media(max-width:1100px){
  .content{padding:20px}
  .grid-4{grid-template-columns:repeat(2,minmax(0,1fr))}
  .grid-3{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media(max-width:900px){
  .sidebar{display:none}
  .main{margin:0;width:100%}
  .content{padding:16px}
  .grid-4,.grid-3,.grid-2{grid-template-columns:1fr}
  .topbar{padding:10px 16px}
  .member-shell{width:100%}
  .section-head{flex-wrap:wrap}
  .section-head>.actions,.section-head>.btn{max-width:100%}
}

@media(max-width:600px){
  .public-main{padding:12px}
  .login-card{padding:18px;border-radius:12px;margin-top:10px}
  .content{padding:12px}
  .card{padding:14px}
  .topbar{align-items:flex-start;flex-wrap:wrap;gap:6px 12px;padding:10px 12px}
  .topbar .userbox{width:100%;text-align:left;font-size:13px}
  .section-head{display:grid;grid-template-columns:1fr;align-items:stretch}
  .section-head .actions,.section-head>.btn{width:100%;justify-content:stretch}
  .section-head .actions .btn,.section-head>.btn{flex:1 1 100%}
  .actions{width:100%}
  .actions form{flex:1 1 calc(50% - 8px)}
  .actions form .btn,.actions>a.btn{width:100%}
  .btn{min-height:42px}
  .table{min-width:520px}
  .table th,.table td{padding:9px 8px;font-size:13px}
  .field input,.field select,.field textarea{font-size:16px}
  .vote-btn{font-size:20px}
}

@media(max-aspect-ratio:4/3){
  .tv-top{height:10vh;padding:1.3vh 2.5vw}
  .tv-content{height:90vh;padding:1.2vh 2.5vw 1.5vh}
  .tv-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:.8vh 1vw}
  .tv-person{padding:.7vh 1vw}
  .tv-photo{width:clamp(48px,7vw,78px);height:clamp(48px,7vw,78px)}
  .tv-matter p{white-space:normal;max-height:5vh;overflow:hidden}
  .tv-result{margin:.2vh 0 .8vh}
}

@media(max-aspect-ratio:3/5){
  .tv-chamber{font-size:clamp(20px,3vw,34px)}
  .tv-session{font-size:clamp(14px,2vw,21px)}
  .tv-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tv-photo{width:clamp(46px,9vw,72px);height:clamp(46px,9vw,72px)}
  .tv-person h3{font-size:clamp(13px,2.2vw,18px)}
}

@media print{
  body{background:#fff;overflow:visible}
  .no-print{display:none!important}
  .print-only{display:block}
  .cards-a4{page-break-after:always}
  .access-card{break-inside:avoid}
  .table-wrap{overflow:visible}
  .table{min-width:0}
}

.mobile-menu{display:none;width:40px;height:40px;min-height:40px;padding:0;border:1px solid #dfe3e8;border-radius:9px;background:#fff;color:#111827;font-size:22px;line-height:1;flex:0 0 auto}
.topbar-title{display:flex;align-items:center;gap:10px;min-width:0;flex:1}
.sidebar-overlay{display:none}

@media(max-width:900px){
  .sidebar{display:flex;transform:translateX(-105%);transition:transform .2s ease;z-index:50;box-shadow:0 12px 30px rgba(15,23,42,.12)}
  .sidebar.is-open{transform:translateX(0)}
  .sidebar-overlay{position:fixed;inset:0;background:rgba(15,23,42,.36);z-index:45}
  .sidebar-overlay.is-open{display:block}
  .mobile-menu{display:inline-flex;align-items:center;justify-content:center}
}
