:root {
  color-scheme: light;
  --ink: #2f3432;
  --muted: #707579;
  --line: #d9e5dd;
  --surface: #ffffff;
  --page: #f3f8f5;
  --accent: #00692b;
  --accent-dark: #004f22;
  --accent-soft: #e8f3ec;
  --gold: #ffae00;
  --success: #00692b;
  --danger: #a8323e;
  --warning: #9f6900;
  --shadow: 0 16px 40px rgba(0, 105, 43, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
}

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

a {
  color: inherit;
}

.topbar,
.viewer-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 2px 16px rgba(0, 105, 43, 0.06);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0;
}

.brand span {
  color: #565759;
}

.topbar-nav {
  display: flex;
  gap: 14px;
  align-items: center;
}

.topbar-nav a {
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
}

.topbar-nav a:hover {
  background: var(--surface);
}

.topbar-lang {
  display: flex;
  gap: 12px;
  align-items: center;
}

.language {
  font-size: 0.9rem;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  padding: 4px 8px;
}

.language.active {
  font-weight: bold;
}

.topbar-user {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-left: auto;
}

.topbar-user span {
  font-size: 0.9rem;
  color: var(--muted);
  padding: 4px 8px;
}

.brand-logo {
  width: auto;
  height: 40px;
  max-width: 172px;
  object-fit: contain;
}

.shell {
  width: min(1380px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.admin-container,
.user-container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.admin-container .panel,
.user-container .panel {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.admin-container .panel-header,
.user-container .panel-header {
  background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
  color: white;
  padding: 28px 32px;
}

.admin-container .panel-header h1,
.user-container .panel-header h1 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 2.2vw, 2.4rem);
}

.admin-container .subtitle,
.user-container .subtitle {
  margin: 0;
  opacity: 0.9;
  font-size: 0.98rem;
  line-height: 1.5;
}

.admin-container .form-section,
.user-container .form-section,
.admin-container .table-section,
.user-container .table-section,
.admin-container .info-section,
.user-container .info-section {
  padding: 28px 32px;
}

.admin-container .form-section:not(:last-child),
.user-container .form-section:not(:last-child),
.admin-container .table-section:not(:last-child),
.user-container .table-section:not(:last-child),
.admin-container .info-section:not(:last-child),
.user-container .info-section:not(:last-child) {
  border-bottom: 1px solid var(--line);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.breadcrumbs a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs span::before {
  content: "/";
  margin: 0 8px;
  color: var(--line);
}

.auth-panel,
.page-heading,
.two-column {
  display: grid;
  gap: 28px;
}

.auth-panel {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  align-items: center;
  min-height: calc(100vh - 170px);
}

.auth-panel.single {
  grid-template-columns: 1fr;
}

.page-heading {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  margin-bottom: 20px;
}

.two-column {
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  align-items: start;
  overflow-x: auto;
}

.two-column > *,
.dashboard-grid > *,
.dashboard-grid > .surface,
.sidebar-stack > * {
  min-width: 0;
  max-width: 100%;
}

.dashboard-grid {
  gap: 22px;
  grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  overflow-x: auto;
}

.section-block {
  margin-top: 28px;
}

.sidebar-stack {
  display: grid;
  gap: 18px;
}

.surface-header,
.bulk-actions,
.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.surface-header {
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 8px 0;
}

.surface-header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.surface-header h2 {
  color: #000;
  font-weight: 800;
  font-size: 18px;
  margin: 0;
}

.bulk-actions {
  justify-content: space-between;
  margin-bottom: 12px;
}

.file-input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.file-input-row > label {
  flex: 1 1 280px;
  min-width: 220px;
}

.file-input-row input[type="file"] {
  width: 100%;
  min-width: 0;
}

.file-input-row .button {
  padding: 10px 14px;
  flex-shrink: 0;
}

.logo-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  border: 1px dashed #b8d4c3;
  border-radius: 8px;
  padding: 12px;
  background: var(--accent-soft);
}

.logo-preview img {
  max-width: 100%;
  max-height: 72px;
  object-fit: contain;
}

.inline-check {
  display: inline-flex;
  width: 100%;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.02);
}

.inline-check:hover {
  background: rgba(0, 0, 0, 0.04);
}

.row-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px;
}

.file-input-row input[type="file"] {
  width: 100%;
  min-width: 0;
}

.file-input-row .button {
  padding: 10px 14px;
  flex-shrink: 0;
}

.logo-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  border: 1px dashed #b8d4c3;
  border-radius: 8px;
  padding: 12px;
  background: var(--accent-soft);
}

.logo-preview img {
  max-width: 100%;
  max-height: 72px;
  object-fit: contain;
}

.inline-check {
  display: inline-flex;
  width: 100%;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.02);
}

.inline-check:hover {
  background: rgba(0, 0, 0, 0.04);
}

.row-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px;
}

.form label:not(.inline-check) input,
.form label:not(.inline-check) textarea,
.form label:not(.inline-check) select {
  width: 100%;
  min-width: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

.form h2,
.form h3,
.form h4,
.form h5,
.form h6 {
  margin-top: 0;
  margin-bottom: 12px;
}

.section-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

h1 {
  max-width: 780px;
  margin-bottom: 12px;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.page-heading h1 {
  font-size: clamp(1.8rem, 2.6vw, 2.6rem);
  line-height: 1.1;
  margin-bottom: 8px;
}

.page-heading p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0;
}

h2 {
  margin-bottom: 18px;
  font-size: 1.08rem;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
}

.lede {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.surface,
.share-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 22px;
}

/* Ensure QR images in auth panels and surfaces scale properly and don't overflow */
.auth-panel .surface img,
.surface img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0.5rem auto;
}

.surface.storage-quota-panel {
  margin-top: 1rem;
}

.surface {
  padding: 22px;
}

.form {
  display: grid;
  gap: 16px;
}

.form label:not(.inline-check) {
  display: grid;
  gap: 0.4rem;
}

.form label:not(.inline-check) input,
.form label:not(.inline-check) textarea,
.form label:not(.inline-check) select {
  width: 100%;
  min-width: 0;
}

.form.surface {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 22px;
}

#company-logo-form,
#login-settings-form {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

#login-settings-form label,
#login-settings-form .surface,
#login-settings-form .database-check-container {
  min-width: 0;
  max-width: 100%;
}

#login-settings-form label > span,
#login-settings-form small,
#login-settings-form p {
  overflow-wrap: anywhere;
}

#company-logo-form .file-input-row,
#login-settings-form .file-input-row {
  align-items: flex-end;
}

#company-logo-form .file-input-row > label,
#login-settings-form .file-input-row > label {
  flex: 1 1 100%;
  min-width: 0;
}

#company-logo-form input[type="file"],
#login-settings-form input,
#login-settings-form select,
#login-settings-form textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

#company-logo-form input[type="file"],
#login-settings-form input[type="file"] {
  overflow: hidden;
  text-overflow: ellipsis;
}

#login-settings-form .inline-check {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  align-items: start;
}

#login-settings-form .inline-check input {
  width: 16px;
  min-width: 16px;
  margin-top: 2px;
}

#company-logo-form .logo-preview,
#login-settings-form .logo-preview {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

#company-logo-form .logo-preview img,
#login-settings-form .logo-preview img {
  display: block;
  max-width: 100%;
  height: auto;
}

#company-logo-form > .row-actions,
#login-settings-form .row-actions {
  flex-wrap: wrap;
  white-space: normal;
}

#company-logo-form > .row-actions .button,
#login-settings-form .row-actions .button {
  flex: 1 1 160px;
  min-width: 0;
  white-space: normal;
}

.panel {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
  color: white;
  padding: 28px 32px;
}

.panel-header h1 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 2.2vw, 2.4rem);
}

.subtitle {
  margin: 0;
  opacity: 0.9;
  font-size: 0.98rem;
  line-height: 1.5;
}

.form-section,
.table-section,
.info-section {
  padding: 28px 32px;
}

.form-section:not(:last-child),
.table-section:not(:last-child),
.info-section:not(:last-child) {
  border-bottom: 1px solid var(--line);
}

.form-inline {
  display: flex;
  gap: 15px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  margin-bottom: 5px;
  font-weight: 500;
}

.form-control {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.95rem;
  min-width: 250px;
  width: 100%;
}

.button {
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-weight: 800;
}

.button.primary {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.button.primary:hover {
  background: var(--accent-dark);
}

.button.danger {
  border-color: rgba(168, 50, 62, 0.25);
  color: var(--danger);
}

.button.small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge-success {
  color: #155724;
  background: #d4edda;
}

.badge-secondary {
  color: #383d41;
  background: #e2e3e5;
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.alert-success {
  background: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}

.alert-danger {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  color: #721c24;
}

.alert-info {
  background: #d1ecf1;
  border: 1px solid #bee5eb;
  color: #0c5460;
}

.alert-warning {
  background: #fff3cd;
  border: 1px solid #ffeeba;
  color: #856404;
}

.close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  opacity: 0.5;
}

.close:hover {
  opacity: 0.8;
}

.table-responsive {
  overflow-x: auto;
}

.api-key-display {
  background: #f8f9fa;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.88rem;
  color: #333;
}

.copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}

.copy-btn:hover {
  transform: scale(1.05);
}

.info-section h4 {
  margin-top: 20px;
  margin-bottom: 10px;
}

.info-section pre {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
}

.info-section code {
  font-family: 'Courier New', monospace;
  font-size: 0.92rem;
}

.info-section ul {
  margin: 15px 0;
  padding-left: 20px;
}

.info-section li {
  margin: 8px 0;
}

@media (max-width: 768px) {
  .form-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .form-control {
    min-width: 100%;
  }

  .button.small {
    width: 100%;
  }
}


label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  min-height: 42px;
  width: 100%;
  border: 1px solid #c7d6ce;
  border-radius: 6px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  box-sizing: border-box;
}


.toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
}

.toolbar-right .filter-label {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  width: auto;
  min-width: 220px;
}

.toolbar-right .filter-label.filter-actions {
  min-width: 150px;
}

.toolbar-right .filter-label.filter-actions button {
  width: 100%;
}

.toolbar-right .filter-label .filter-select,
.toolbar-right .filter-label input {
  width: 260px;
  max-width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(0, 105, 43, 0.18);
  border-color: var(--accent);
}

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

.check-row {
  display: grid;
  gap: 10px;
}

.check-row label {
  grid-template-columns: 18px 1fr;
  align-items: center;
  color: var(--ink);
  font-weight: 600;
}

.check-row input {
  width: 16px;
  min-height: 16px;
}

.inline-check {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.settings-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 -6px 18px;
}

.settings-checkboxes label {
  min-width: 220px;
  flex: 1 1 240px;
}

.inline-check input,
.document-select {
  width: 16px;
  min-height: 16px;
}

.org-settings-form {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(220px, 1fr) minmax(190px, 240px) auto;
  gap: 12px;
  align-items: end;
}

.button.secondary {
  border-color: rgba(0, 105, 43, 0.25);
  color: var(--accent);
  background: #f4f8f5;
}

@media (max-width: 980px) {
  .dashboard-grid,
  .two-column {
    grid-template-columns: 1fr;
  }

  .org-settings-form {
    grid-template-columns: 1fr;
  }

  .org-settings-form label,
  .org-settings-form .button.primary,
  .org-settings-form .button.secondary,
  .org-settings-form .button.danger {
    width: 100%;
  }
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 14px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
}

.button:not(.primary):not(.danger):hover {
  border-color: rgba(0, 105, 43, 0.35);
  color: var(--accent);
  background: var(--accent-soft);
}

.button.primary {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(0, 105, 43, 0.16);
}

.button.primary:hover {
  background: var(--accent-dark);
}

.button.ghost {
  background: transparent;
}

.button.danger {
  border-color: rgba(168, 50, 62, 0.25);
  color: var(--danger);
}

.button.small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.85rem;
}

.notice {
  border-left: 4px solid var(--warning);
  padding: 12px 14px;
  color: #5d4305;
  background: #fff7de;
  border-radius: 4px;
  line-height: 1.5;
}

.flash-stack {
  position: fixed;
  top: 72px;
  right: 20px;
  z-index: 30;
  display: grid;
  gap: 10px;
  width: min(560px, calc(100vw - 40px));
}

.flash {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}

.flash.success {
  border-color: rgba(0, 105, 43, 0.25);
  color: var(--success);
}

.flash.error {
  border-color: rgba(168, 50, 62, 0.25);
  color: var(--danger);
}

.empty {
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
  min-width: 0;
  max-width: 100%;
}

.grid-container {
  overflow-x: auto;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.grid-wrapper {
  min-width: 100%;
  display: inline-block;
}

.data-grid {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  font-family: inherit;
  font-size: 0.95rem;
  background: transparent;
}

.grid-header th,
.data-grid td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.grid-header {
  background: #f6fbf7;
}

.grid-header th {
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.grid-filters {
  background-color: #f5f5f5;
  border-bottom: 2px solid #ddd;
}

.grid-filters th {
  padding: 8px;
  vertical-align: middle;
  text-align: left;
}

.filter-input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
  box-sizing: border-box;
  text-align: left;
}

.filter-input:focus {
  outline: none;
  border-color: #0d6efd;
  box-shadow: 0 0 3px rgba(13, 110, 253, 0.3);
}

.col-organization { width: 20%; }
.col-storage-quota { width: 25%; }
.col-user-limits { width: 35%; }
.col-expiration-date { width: 20%; }

.grid-header th:last-child {
  border-right: none;
}

.data-grid td:last-child {
  border-right: none;
}

.data-grid tbody tr {
  border-bottom: 1px solid #e0e0e0;
  background-color: #fff;
}

.data-grid tbody tr:hover {
  background: rgba(0, 105, 43, 0.04);
}

.data-grid tbody tr.hidden {
  display: none;
}

.grid-row-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
}

.grid-row-fields label {
  display: grid;
  gap: 8px;
  
}

.grid-row-fields .caption {
  grid-column: 1 / -1;
  margin: 0;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.row-actions button {
  flex-shrink: 0;
}

.col-checkbox {
  width: 40px;
  text-align: center;
}

.col-title {
  width: 25%;
  min-width: 180px;
}

.col-name {
  width: 15%;
  min-width: 120px;
}

.col-email {
  width: 20%;
  min-width: 150px;
}

.col-phone {
  width: 12%;
  min-width: 100px;
}

.col-date {
  width: 13%;
  min-width: 110px;
}

.col-actions {
  width: 120px;
  text-align: center;
}

#users-grid {
  min-width: 1180px;
  table-layout: fixed;
}

#users-grid th:last-child,
#users-grid .col-actions {
  width: 190px;
  min-width: 190px;
}

#users-grid th:first-child,
#users-grid td:first-child {
  width: 42px;
}

#users-grid th:nth-child(2),
#users-grid .col-username {
  width: 17%;
}

#users-grid th:nth-child(3),
#users-grid .col-email {
  width: 21%;
}

#users-grid th:nth-child(4),
#users-grid .col-language {
  width: 8%;
}

#users-grid th:nth-child(5),
#users-grid .col-role {
  width: 8%;
}

#users-grid th:nth-child(6),
#users-grid .col-organization {
  width: 14%;
}

#users-grid th:nth-child(7),
#users-grid .col-active {
  width: 7%;
}

#users-grid th:nth-child(8),
#users-grid .col-space {
  width: 8%;
}

#users-grid th:nth-child(9),
#users-grid .col-expiration {
  width: 10%;
}

#users-grid th,
#users-grid td {
  overflow-wrap: anywhere;
}

#users-grid .col-actions form {
  display: block !important;
  min-width: 0;
  margin-bottom: 6px;
}

#users-grid .col-actions form:last-child {
  margin-bottom: 0;
}

#users-grid .col-actions .button {
  width: 100%;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.2;
  padding-inline: 10px;
  text-align: center;
}

.form-grid,
.edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  align-items: start;
}

.user-permissions-row {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.user-permissions-row .inline-check {
  width: auto;
  min-width: max-content;
  margin: 0;
  white-space: nowrap;
}

.user-permissions-row .inline-check input {
  flex: 0 0 auto;
}

.cell-content {
  word-break: break-word;
  color: #333;
}

.action-buttons {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  font-size: 14px;
  border: 1px solid #ddd;
  background-color: #fff;
  color: #333;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background-color: #0d6efd;
  color: white;
  border-color: #0d6efd;
}

.icon-btn.danger:hover {
  background-color: #dc3545;
  border-color: #dc3545;
}

.grid-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background-color: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
  gap: 15px;
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.rows-limit-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #555;
  font-weight: 500;
}

.rows-limit-select,
.filter-input,
.filter-select {
  padding: 7px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.95rem;
  background: white;
  cursor: pointer;
  min-width: 120px;
}

.filter-input {
  width: 100%;
  max-width: 260px;
}

.grid-filters {
  background-color: #f5f5f5;
  border-bottom: 2px solid #ddd;
}

.grid-filters th {
  padding: 8px;
  vertical-align: middle;
}

.grid-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background-color: #f8f9fa;
  border-top: 1px solid #dee2e6;
  gap: 20px;
  flex-wrap: wrap;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.pagination-btn {
  padding: 6px 12px;
  border: 1px solid #ddd;
  background-color: white;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  transition: all 0.2s ease;
  font-weight: 500;
}

.pagination-btn:hover {
  background-color: #0d6efd;
  color: white;
  border-color: #0d6efd;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#page-info,
.pagination-info {
  font-size: 14px;
  color: #666;
}

div.toolbar-right .filter-label {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  width: auto;
}

.document-table,
.user-document-table {
  width: 100%;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 0;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 14px 12px;
  text-align: left;
  vertical-align: middle;
}

.ip-col {
  width: 120px;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  color: #000;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.document-table thead th {
  background: #f6fbf7;
}

.document-table tbody tr:hover {
  background: rgba(0, 105, 43, 0.04);
}

td span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.86rem;
}

.document-table-wrap {
  margin-top: 4px;
}

.document-table {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}

.document-select-col {
  width: 44px;
}

.document-select-cell {
  text-align: center;
}

.document-main-col {
  width: 42%;
  min-width: 220px;
}

.document-pages-col,
.document-links-col,
.document-activity-col,
.document-actions-col {
  width: auto;
}

.document-actions-col {
  min-width: 110px;
}

.document-main strong {
  display: block;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.document-main span,
.document-filename,
.document-owner,
.document-activity {
  overflow-wrap: anywhere;
}

.document-number {
  white-space: nowrap;
}

.document-actions-cell {
  vertical-align: top;
  white-space: nowrap;
}

.document-actions {
  display: grid;
  gap: 8px;
  min-width: 140px;
  justify-items: end;
}

.document-actions .button {
  width: 100%;
  min-width: 124px;
  white-space: normal;
  text-align: center;
}

.document-actions .button.small {
  min-width: 124px;
}

.document-actions-cell .button {
  display: inline-flex;
}

.user-document-table {
  min-width: 760px;
}

.user-document-table .document-main-col {
  width: 32%;
}

.user-document-table .document-filename-col {
  width: 38%;
}

input[type="checkbox"] {
  width: auto;
  height: auto;
}

.backup-listbox {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font: inherit;
}

.backup-listbox option {
  padding: 4px 6px;
}

.backup-restore-panel,
.backup-restore-panel form,
.backup-restore-panel label,
.backup-restore-panel .section-block,
.backup-restore-panel .table-wrap {
  min-width: 0;
  max-width: 100%;
}

.backup-restore-panel {
  overflow: hidden;
}

.backup-restore-panel form {
  display: grid;
  gap: 14px;
}

.backup-restore-panel .backup-listbox,
.backup-restore-panel input[type="file"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.backup-restore-panel .section-note,
.backup-restore-panel label > span,
.backup-restore-panel a {
  overflow-wrap: anywhere;
}

.backup-restore-panel .bulk-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.backup-restore-panel .bulk-actions .inline-check {
  width: 100%;
  min-width: 0;
  margin: 0;
}

.backup-restore-panel .bulk-actions .button,
.backup-restore-panel > form > .button {
  width: 100%;
  white-space: normal;
}

.backup-restore-panel .table-wrap {
  overflow-x: auto;
}

.backup-restore-panel table {
  min-width: 0;
  table-layout: fixed;
}

.backup-restore-panel th:first-child,
.backup-restore-panel td:first-child {
  width: 36px;
}

.backup-restore-panel th,
.backup-restore-panel td {
  overflow-wrap: anywhere;
}

.share-list {
  display: grid;
  gap: 12px;
}

.share-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  box-shadow: none;
}

.share-card-check {
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-select-label span {
  margin-left: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.share-primary .share-document-name {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.copy-field {
  font-size: 0.82rem;
}

.link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.share-meta {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.share-meta span {
  display: block;
}

.protection-note {
  margin: 0.5rem 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.comment-form {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.comment-form .button {
  justify-self: start;
}

.share-actions {
  display: grid;
  align-items: center;
  justify-items: end;
  gap: 10px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--success);
  background: rgba(0, 105, 43, 0.1);
  font-size: 0.8rem;
  font-weight: 800;
}

.status.danger {
  color: var(--danger);
  background: rgba(168, 50, 62, 0.1);
}

.viewer-body {
  background: #24302a;
}

.viewer-bar {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.viewer-bar span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.viewer-bar nav {
  display: flex;
  gap: 10px;
}

.viewer-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.viewer-shell {
  width: min(980px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.secure-page {
  margin: 0 0 24px;
  text-align: center;
}

.secure-page img {
  width: 100%;
  height: auto;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
  user-select: none;
  -webkit-user-drag: none;
}

.enhanced-protection .viewer-shell,
.enhanced-protection .viewer-bar {
  -webkit-user-select: none;
  user-select: none;
}

.privacy-covered .viewer-shell {
  filter: blur(18px);
  opacity: 0.08;
}

.secure-page figcaption {
  margin-top: 8px;
  color: #cbd5e1;
  font-size: 0.85rem;
}

.share-security-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--accent-dark);
  background: rgba(0, 105, 43, 0.08);
  margin-left: 8px;
}

.screen-shield {
  display: none;
  pointer-events: none;
}

.shield-enabled .screen-shield {
  display: block;
}

.screen-shield div {
  position: fixed;
  z-index: 10;
  background: rgba(9, 13, 21, 0.68);
}

.privacy-cover {
  display: none;
}

.privacy-covered .privacy-cover {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  color: #ffffff;
  background: rgba(10, 16, 24, 0.94);
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
}

.reason {
  color: var(--muted);
  text-transform: capitalize;
}

@media (max-width: 1080px) {
  .topbar,
  .viewer-bar {
    padding: 12px 16px;
  }

  .auth-panel,
  .page-heading,
  .two-column,
  .dashboard-grid,
  .share-card {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2.25rem;
  }

  .share-actions {
    justify-items: start;
  }

  .org-settings-form {
    grid-template-columns: 1fr;
  }

  .link-row {
    grid-template-columns: 1fr;
  }
}

@media print {
  .viewer-body.no-print .viewer-shell {
    display: none;
  }

  .viewer-body.no-print::before {
    content: "Η εκτύπωση είναι απενεργοποιημένη για αυτό το ασφαλές έγγραφο.";
    display: block;
    margin: 72px auto;
    width: 80%;
    color: #111827;
    font-size: 24px;
    text-align: center;
  }

  .viewer-bar,
  .screen-shield {
    display: none;
  }
}
