* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: #111; color: #eee; }
a { color: #8ab4ff; }
.page { max-width: 1100px; margin: 0 auto; padding: 20px; }
.top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
h1 { margin: 0; font-size: 28px; }
h2 { margin-top: 0; }
.muted { color: #999; }
.error { color: #ff7b7b; }
.ok { color: #7be495; }
.warn { background: #3a2f00; border: 1px solid #8a6d00; padding: 10px 12px; border-radius: 8px; }

/* Вход — как в Archivio: одно поле по центру, без кнопок. */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.login-wrap input { width: 280px; padding: 12px 14px; font-size: 16px; border-radius: 8px; border: 1px solid #444; background: #1c1c1c; color: #eee; outline: none; }
.login-wrap input:focus { border-color: #8ab4ff; }
.input-error { border-color: #ff7b7b !important; }

/* Дашборд */
.card { background: #1c1c1c; border: 1px solid #333; border-radius: 12px; padding: 18px; margin-top: 18px; }
.settings { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.inline { display: inline; }
.btn { padding: 10px 16px; border-radius: 8px; border: 1px solid #555; background: #2a2a2a; color: #eee; cursor: pointer; font-size: 15px; text-decoration: none; display: inline-block; }
.btn:hover { background: #333; }
.btn.small { padding: 6px 12px; font-size: 14px; }
.add-form { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.add-form input { padding: 10px 12px; border-radius: 8px; border: 1px solid #444; background: #111; color: #eee; font-size: 15px; }
.add-form input[name="chat_id"] { flex: 1; min-width: 240px; }
.add-form input[name="title"] { flex: 1; min-width: 180px; }
.hint { color: #999; font-size: 14px; }
.status { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #666; display: inline-block; }
.status.on .dot, .btn-on .dot { background: #2ee06a; box-shadow: 0 0 8px #2ee06a; }
/* Пробел между диодом и словом на кнопке Включить/Выключить:
   в кнопке нет flex-gap, как в статусе сверху, поэтому отступ задан явно. */
.btn .dot { margin-right: 8px; }
.btn-on { border-color: #2ee06a; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #333; }
th { color: #999; font-weight: 600; }

/* Галерея */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 16px; }
.photo { margin: 0; background: #1c1c1c; border-radius: 10px; overflow: hidden; cursor: pointer; }
.photo img { width: 100%; height: 220px; object-fit: cover; display: block; }
.photo figcaption { padding: 8px 10px; font-size: 13px; color: #bbb; }
.photo .sender { font-weight: 600; color: #eee; }
.photo .cap-meta { color: #999; font-size: 12px; }

/* Контекстное меню (правый клик) */
.ctx-menu { position: fixed; z-index: 50; background: #222; border: 1px solid #555; border-radius: 8px; padding: 4px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.ctx-menu button { display: block; width: 100%; background: none; border: 0; color: #ff7b7b; padding: 8px 16px; font-size: 15px; cursor: pointer; text-align: left; }
.ctx-menu button:hover { background: #333; border-radius: 6px; }

/* Лайтбокс: фото — 90% экрана по длинной стороне */
.lightbox { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lb-stage { position: relative; max-width: 90vw; max-height: 90vh; }
.lb-stage img { max-width: 90vw; max-height: 90vh; object-fit: contain; display: block; }
.lb-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.lb-close { position: absolute; top: -14px; right: -14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: #fff; color: #111; font-size: 24px; line-height: 1; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.5); }
.lb-hint { color: #aaa; font-size: 14px; margin-top: 12px; }

/* Модалка «Поделиться» */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-box { background: #1c1c1c; border: 1px solid #444; border-radius: 12px; padding: 20px; width: min(520px, 92vw); }
.modal-box input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid #444; background: #111; color: #eee; font-size: 14px; }
.modal-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
