#link-panel[hidden], #link-panel [hidden] { display: none !important; }
.link-overlay { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; overflow: auto; padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom)); background: rgba(9, 25, 20, .72); }
.link-card { box-sizing: border-box; position: relative; width: min(100%, 600px); max-height: min(94dvh, 900px); overflow: auto; padding: 26px clamp(18px, 5vw, 34px); border: 1px solid #dce9e2; border-radius: 22px; background: #fff; color: #183b2e; box-shadow: 0 20px 70px rgba(0,0,0,.26); font: inherit; }
.link-card h2 { margin: 0 36px 8px 0; font-size: clamp(1.45rem, 5vw, 2rem); line-height: 1.1; }
.link-card h3 { margin: 16px 0 6px; font-size: 1.14rem; }
.link-card p { line-height: 1.5; }
.link-eyebrow { margin: 0 0 8px; color: #318061; font-size: .72rem; font-weight: 800; letter-spacing: .12em; }
.link-note, .link-pane p, .link-pane small { color: #52685e; font-size: .9rem; }
.link-pane small { display: block; line-height: 1.45; margin: 12px 0 4px; }
.link-close { position: absolute; top: 12px; right: 14px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: #eef5f0; color: #174e3c; font-size: 1.7rem; cursor: pointer; }
.link-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 18px 0 12px; padding: 5px; border-radius: 12px; background: #edf3ef; }
.link-tabs button, .link-actions button, #link-disconnect, .link-device { min-height: 42px; border: 1px solid #cadbd1; border-radius: 10px; background: #fff; color: #174e3c; font: inherit; font-weight: 700; cursor: pointer; }
.link-tabs button { padding: 6px 4px; font-size: .82rem; }
.link-tabs button[aria-selected="true"] { border-color: #174e3c; background: #174e3c; color: #fff; }
.link-pane label { display: block; margin: 12px 0 5px; font-size: .88rem; font-weight: 700; }
.link-pane input:not([type=checkbox]), .link-pane textarea { box-sizing: border-box; width: 100%; padding: 11px 12px; border: 1px solid #b9ccc1; border-radius: 9px; background: #fff; color: #173a2e; font: inherit; }
.link-pane textarea { resize: vertical; font: .76rem/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
.link-pane input:focus, .link-pane textarea:focus { outline: 3px solid rgba(49,128,97,.22); border-color: #318061; }
.link-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.link-actions button { flex: 1 1 130px; padding: 9px 12px; }
.link-actions button:first-child { border-color: #174e3c; background: #174e3c; color: white; }
.link-actions button:disabled { opacity: .48; cursor: not-allowed; }
.link-unavailable { padding: 9px 11px; border-left: 3px solid #ad7727; border-radius: 5px; background: #fff5df; color: #684812 !important; font-weight: 700; }
.link-devices { display: grid; gap: 7px; margin: 10px 0; }
.link-device { width: 100%; padding: 8px 10px; text-align: left; overflow-wrap: anywhere; }
.link-check { display: flex !important; align-items: center; gap: 8px; }
#link-panel-status { margin: 16px 0 8px; padding: 11px 12px; border-radius: 10px; background: #edf3ef; font-size: .9rem; }
#link-panel-status[data-connected="true"] { background: #e2f5e9; color: #185c35; font-weight: 700; }
#link-disconnect { width: 100%; padding: 10px; border-color: #ad5555; color: #9b2f2f; }
@media (max-width: 480px) { .link-tabs { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 380px) { .link-card { padding: 24px 15px; } .link-tabs button { font-size: .72rem; } }
