:root { --bg:#f3f5f9; --card:#fff; --ink:#111827; --mut:#6b7280; --line:#e3e7ee; --pri:#0b5bd3; --pri-d:#0947a8; --side:#0f172a; --ok:#15803d; --err:#b91c1c; --warn:#b45309; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--pri); text-decoration: none; }
h1 { font-size: 24px; margin: 0 0 18px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--mut); margin: 18px 0 8px; }
.muted { color: var(--mut); } .small { font-size: 13px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: #22d3ee; box-shadow: 0 0 0 4px rgba(34,211,238,.25); margin-right: 10px; vertical-align: 1px; }
.top { position: fixed; z-index: 20; top: 0; left: 0; right: 0; height: 54px; background: var(--side); color: #fff; display: flex; align-items: center; padding: 0 16px; gap: 14px; }
.top a { color: #cbd5e1; } .top .brand { color: #fff; font-weight: 800; letter-spacing: .06em; }
.top .tenant { margin-left: 8px; padding-left: 14px; border-left: 1px solid #334155; color: #e2e8f0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .who { margin-left: auto; font-size: 13px; color: #94a3b8; white-space: nowrap; }
.chip { font-size: 11px; background: #1e293b; padding: 2px 8px; border-radius: 20px; margin-left: 6px; }
.burger { display: none; background: none; border: 0; color: #fff; font-size: 22px; padding: 0 4px; }
.side { position: fixed; top: 54px; bottom: 0; left: 0; width: 200px; background: var(--side); padding: 10px 8px; overflow: auto; z-index: 15; }
.side a { display: block; color: #cbd5e1; padding: 10px 12px; border-radius: 8px; margin-bottom: 2px; font-weight: 500; }
.side a:hover { background: #1e293b; } .side a.on { background: var(--pri); color: #fff; }
main { margin: 54px 0 0 200px; padding: 26px 28px 60px; max-width: 1250px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 18px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat b { display: block; font-size: 30px; line-height: 1.1; } .stat span { color: var(--mut); font-size: 13px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--mut); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.tablewrap { overflow-x: auto; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; color: #374151; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=time], input[type=date], input[type=datetime-local], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid #cbd2dc; border-radius: 8px; font: inherit; background: #fff; color: var(--ink); }
input[type=color] { display: block; margin-top: 5px; width: 64px; height: 38px; padding: 2px; border: 1px solid #cbd2dc; border-radius: 8px; background: #fff; }
input[type=file] { display: block; margin-top: 6px; font: inherit; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(11,91,211,.35); border-color: var(--pri); }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; } label.check input { margin: 0; width: 17px; height: 17px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; } .row > * { flex: 1; min-width: 150px; } .row > .fix { flex: none; min-width: 0; }
.btn { display: inline-block; padding: 9px 15px; border-radius: 8px; border: 1px solid #cbd2dc; background: #fff; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f1f4f9; } .btn.primary { background: var(--pri); border-color: var(--pri); color: #fff; } .btn.primary:hover { background: var(--pri-d); }
.btn.danger { color: var(--err); border-color: #f1c4c4; } .btn.sm { padding: 5px 10px; font-size: 13px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; } .actions form { margin: 0; }
.flash { padding: 11px 14px; border-radius: 9px; margin-bottom: 16px; font-weight: 500; }
.flash.ok { background: #e7f6ec; color: #14532d; } .flash.err { background: #fdeaea; color: #7f1d1d; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 20px; background: #e5e7eb; color: #374151; white-space: nowrap; }
.badge.on { background: #dcfce7; color: #166534; } .badge.off { background: #fee2e2; color: #991b1b; } .badge.blue { background: #dbeafe; color: #1e40af; } .badge.warn { background: #fef3c7; color: #92400e; }
.thumb { width: 96px; height: 54px; border-radius: 6px; background: #0f172a center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; overflow: hidden; flex: none; }
.mediacard { padding: 0; overflow: hidden; margin: 0; } .mediacard .thumb { width: 100%; height: 0; padding-bottom: 56.25%; border-radius: 0; position: relative; }
.mediacard .thumb span { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 8px; text-align: center; }
.mediacard .info { padding: 10px 12px 12px; } .mediacard .info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; } .tabs a { padding: 7px 13px; border-radius: 20px; background: #e5e9f0; color: #374151; font-weight: 600; font-size: 14px; } .tabs a.on { background: var(--ink); color: #fff; }
.layouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.layouts label { margin: 0; cursor: pointer; border: 2px solid var(--line); border-radius: 10px; padding: 8px; font-weight: 600; font-size: 12px; text-align: center; }
.layouts input { position: absolute; opacity: 0; } .layouts label.sel { border-color: var(--pri); background: #eef4ff; }
.lay { position: relative; width: 100%; padding-bottom: 56.25%; background: #0f172a; border-radius: 5px; margin-bottom: 6px; overflow: hidden; }
.lay i { position: absolute; background: #3b82f6; border: 2px solid #0f172a; border-radius: 4px; } .lay i:nth-child(2) { background: #22d3ee; } .lay i:nth-child(3) { background: #a78bfa; }
.preview { position: relative; width: 100%; padding-bottom: 56.25%; background: #000; border-radius: 10px; overflow: hidden; } .preview iframe { position: absolute; left: 0; top: 0; width: 100%; height: 100%; border: 0; }
.code { font: 700 22px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .2em; text-transform: uppercase; }
.drag { cursor: grab; color: var(--mut); user-select: none; }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(135deg, #0f172a, #1e3a8a); }
.loginbox { width: 100%; max-width: 380px; padding: 28px; } .loginbox.wide { max-width: 460px; } .loginbox h1 { margin-bottom: 4px; } .loginbox .btn { width: 100%; margin-top: 6px; padding: 11px; }
.manual h2 { margin-top: 26px; } .manual li { margin-bottom: 6px; } .manual code { background: #eef1f6; padding: 1px 6px; border-radius: 5px; font-size: 13px; }
@media (max-width: 820px) {
  .burger { display: block; } .side { transform: translateX(-100%); transition: transform .2s; width: 230px; } .nav-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
  main { margin-left: 0; padding: 18px 14px 50px; } .tablewrap table { min-width: 620px; } .top .who { font-size: 12px; } .top .tenant { display: none; }
}

.tlogo { height: 26px; max-width: 110px; object-fit: contain; vertical-align: middle; margin-right: 10px; background: #fff; border-radius: 4px; padding: 2px 4px; }
.tpls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tpls button { border: 0; border-radius: 8px; color: #fff; font: inherit; font-weight: 700; padding: 14px 18px; cursor: pointer; min-width: 120px; }
.cal { display: grid; grid-template-columns: 44px repeat(7, minmax(84px, 1fr)); min-width: 680px; }
.cal .hd { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--mut); text-align: center; padding: 6px 0; }
.cal .hours { position: relative; height: 600px; }
.cal .hours span { position: absolute; right: 6px; font-size: 11px; color: var(--mut); transform: translateY(-50%); }
.cal .day { position: relative; height: 600px; border-left: 1px solid var(--line); background: repeating-linear-gradient(to bottom, #f6f8fb 0, #f6f8fb 24px, #fff 25px, #fff 49px, #f6f8fb 50px); background-size: 100% 50px; }
.cal .day.today { background-color: #eef4ff; box-shadow: inset 0 0 0 2px #bfdbfe; }
.cal .blk { position: absolute; border-radius: 6px; color: #fff; font-size: 11px; font-weight: 600; line-height: 1.2; padding: 3px 5px; overflow: hidden; box-shadow: 0 0 0 1px #fff; }
.cal .blk small { display: block; font-weight: 400; opacity: .9; }
.cal .blk.off { opacity: .35; }
.editor { position: relative; width: 100%; padding-bottom: 56.25%; background: #0f172a; border-radius: 8px; overflow: hidden; touch-action: none; user-select: none;
  background-image: linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px); background-size: 10% 10%; }
.editor .z { position: absolute; border: 2px solid #fff; border-radius: 6px; color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; text-align: center; cursor: move; opacity: .92; }
.editor .z.sel { outline: 3px solid #facc15; outline-offset: -3px; }
.editor .z i { position: absolute; right: -2px; bottom: -2px; width: 22px; height: 22px; background: #fff; border-radius: 6px 0 4px 0; cursor: nwse-resize; }
.bar { height: 10px; border-radius: 5px; background: var(--pri); min-width: 2px; }

/* Schermi verticali */
.lay.portrait { width: 42%; padding-bottom: 74.67%; margin-left: auto; margin-right: auto; }
.preview.portrait { width: 56.25%; max-width: 320px; padding-bottom: min(100%, 568.9px); margin: 0 auto; }
.edwrap { max-width: 860px; }
.edwrap.portrait { max-width: 360px; margin: 0 auto; }
.edwrap.portrait .editor { padding-bottom: 177.78%; background-size: 10% 10%; }
