:root {
  --primary: #27A7DF;
  --primary-dark: #0C72B6;
  --bg: #F5F7FA;
  --bg-white: #FFFFFF;
  --text: #2C3E50;
  --text-light: #656565;
  --border: #E1E8ED;
  --shadow: rgba(0, 0, 0, 0.08);
  --shadow-hover: rgba(39, 167, 223, 0.2);
}

* {
  box-sizing: border-box;
}

html {
  /* Prevent horizontal jump when scrollbar appears/disappears between tabs */
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

.back {
  background: var(--bg);
  min-height: 100vh;
  padding: 40px 15px;
}

.div-center {
  background: var(--bg-white);
  max-width: 1000px;
  margin: 0 auto;
  padding: 2.5rem 3rem;
  border-radius: 12px;
  box-shadow: 0 4px 20px var(--shadow);
  border: 1px solid var(--border);
}

.logo-container {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 25px;
  border-bottom: 2px solid var(--border);
}

.logo {
  max-width: 220px;
  height: auto;
  display: inline-block;
  transition: opacity 0.3s ease;
}

.logo:hover {
  opacity: 0.85;
}

.div-center h2, .div-center h3 {
  color: var(--text);
  font-weight: 600;
  margin-bottom: 25px;
  font-size: 1.5rem;
}

.welcome-section__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.welcome-section__header .welcome-title {
  margin-bottom: 8px;
}

.welcome-section__header .welcome-description {
  margin-bottom: 0;
}

.welcome-section__logout {
  flex: 0 0 auto;
  margin: 0;
}

.welcome-section {
  text-align: center;
  margin-bottom: 40px;
}

.welcome-session {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 16px;
  max-width: 100%;
}

.welcome-session__status {
  margin: 0;
}

.welcome-session__logout {
  margin: 0;
}

.users-policy-form {
  margin: 0 0 4px 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.users-policy-header .section-title {
  margin-bottom: 8px;
}

.section-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.section-title {
  color: var(--text);
  font-weight: 600;
  font-size: 1.25rem;
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.settings-stack .section-card {
  margin-bottom: 16px;
}

.settings-stack .section-title {
  margin-bottom: 8px;
}

.settings-stack__hint {
  margin: 0 0 18px 0;
  font-style: normal;
}

.settings-stack__actions {
  margin-top: 4px;
  margin-bottom: 8px;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 1.05rem;
  display: block;
}

.form-control {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  background-color: var(--bg-white);
  color: var(--text);
  min-height: 55px;
  line-height: 1.5;
  width: 100%;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--shadow-hover);
  outline: none;
}

.file-input {
  padding: 6px 10px;
  min-height: 0;
  font-size: 0.95rem;
  line-height: 1.25;
  cursor: pointer;
}

.file-input::file-selector-button,
.file-input::-webkit-file-upload-button {
  appearance: none;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.3px;
  line-height: 1.25;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-right: 12px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(39, 167, 223, 0.3);
}

.file-input::file-selector-button:hover,
.file-input::-webkit-file-upload-button:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.form-hint {
  display: block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-light);
  font-style: italic;
}

.form-divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
}

.form-divider::before,
.form-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 45%;
  height: 1px;
  background: var(--border);
}

.form-divider::before {
  left: 0;
}

.form-divider::after {
  right: 0;
}

.form-divider span {
  display: inline-block;
  padding: 0 15px;
  background: var(--bg-white);
  color: var(--text-light);
  font-weight: 600;
  position: relative;
  z-index: 1;
}

.btn {
  appearance: none;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
  border: none;
  transition: all 0.2s ease;
  text-transform: none;
  letter-spacing: 0.3px;
  cursor: pointer;
  line-height: 1.25;
  text-decoration: none;
  display: inline-block;
}

a.btn,
a.btn:hover,
a.btn:focus {
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(39, 167, 223, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  box-shadow: 0 6px 16px rgba(39, 167, 223, 0.4);
  transform: translateY(-2px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(39, 167, 223, 0.3);
}

.btn-primary:focus {
  box-shadow: 0 0 0 3px var(--shadow-hover);
  outline: none;
}

.alert {
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 2px solid;
}

.alert-danger {
  background-color: #f8d7da;
  border-color: #dc3545;
  color: #721c24;
}

.alert-success {
  background-color: #d1e7dd;
  border-color: #198754;
  color: #0f5132;
}

.alert-warning {
  background-color: #fff3cd;
  border-color: #ffc107;
  color: #664d03;
}

.otp-result {
  margin-top: 25px;
  padding: 20px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.otp-code {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
  letter-spacing: 4px;
  text-align: center;
  padding: 20px;
  background: var(--bg-white);
  border-radius: 8px;
  border: 2px solid var(--primary);
  margin: 15px 0;
}

.otp-validated {
  color: #28a745;
  font-size: 0.9rem;
  text-align: center;
  margin-top: 10px;
  font-weight: 600;
}

.copyright {
  margin-top: 30px;
  padding: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  border-top: 1px solid var(--border);
}

.disclaimer {
  margin-top: 8px;
  font-size: 11px;
}

.btn-secondary {
  background: #6c757d;
  color: #fff;
}

.btn-secondary:hover {
  background: #5c636a;
}

.btn-danger {
  background: #dc3545;
  color: #fff;
}

.btn-danger:hover {
  background: #bb2d3b;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrap--drag {
  cursor: grab;
  user-select: none;
}

.table-wrap--drag.is-dragging {
  cursor: grabbing;
}

.simple-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.simple-table th,
.simple-table td {
  border: 1px solid var(--border);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

.simple-table th {
  background: var(--bg);
  font-weight: 600;
}

.simple-table td a {
  color: var(--primary-dark);
  word-break: break-all;
}

.simple-table td a.btn,
.simple-table td a.btn-primary {
  color: #FFFFFF;
  word-break: normal;
  text-decoration: none;
  display: inline-block;
}

.simple-table td a.btn-primary:hover {
  color: #FFFFFF;
}

.simple-table td a.btn-ghost {
  color: var(--primary-dark);
  background: transparent;
}

.simple-table td a.btn-ghost:hover {
  color: var(--primary);
  background: rgba(39, 167, 223, 0.08);
}

.share-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  padding: 12px 14px;
}

.share-item__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.share-item__title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.share-item__name {
  color: var(--text);
  font-size: 0.98rem;
  word-break: break-word;
}

.share-item__status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
}

.share-item__status.is-uploaded {
  background: #d1e7dd;
  color: #0f5132;
}

.share-item__status.is-pending {
  background: #fff3cd;
  color: #664d03;
}

.share-item__actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.share-item__actions .btn {
  padding: 6px 12px;
  font-size: 0.85rem;
  line-height: 1.2;
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.user-actions__reset {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.user-actions__delete {
  margin: 0;
}

.user-actions__password {
  width: 170px;
  min-height: 0;
  padding: 8px 10px;
  font-size: 0.88rem;
  line-height: 1.2;
}

.user-actions .btn {
  padding: 8px 12px;
  font-size: 0.85rem;
  line-height: 1.2;
  white-space: nowrap;
}

.user-actions__you {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--text-light);
  white-space: nowrap;
}

.share-label-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.share-label-row__input {
  flex: 1 1 auto;
  width: auto;
  max-width: min(100%, 480px);
  min-width: 270px;
}

.share-label-row__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  flex: 0 1 auto;
  min-width: 9rem;
}

.share-label-row__counter {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-light);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.share-label-row__counter.is-max {
  color: #b42318;
}

.share-label-row__limit {
  font-size: 0.82rem;
  color: #b42318;
  line-height: 1.3;
  max-width: 14rem;
}

.share-item__actions form {
  display: inline;
  margin: 0;
}

.share-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  color: var(--text-light);
  font-size: 0.84rem;
  line-height: 1.45;
}

.btn-ghost {
  background: transparent;
  color: var(--primary-dark);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(39, 167, 223, 0.08);
}

.share-link-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.share-link-actions .btn {
  padding: 6px 12px;
  font-size: 0.85rem;
  line-height: 1.2;
}

.upload-progress {
  margin: 12px 0 18px;
}

.upload-progress__bar-wrap {
  width: 100%;
  height: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.upload-progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  transition: width 0.2s ease;
}

.upload-progress__text {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-light);
}

/* Portal tabs */
.portal-tabs {
  margin-top: 24px;
}

.portal-tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border);
}

.portal-tab {
  appearance: none;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.portal-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.portal-tab.is-active,
.portal-tab[aria-selected="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.tab-badge {
  display: inline-block;
  min-width: 1.25rem;
  padding: 1px 6px;
  margin-left: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  color: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  vertical-align: middle;
}

.portal-tab:not(.is-active) .tab-badge,
.portal-tab[aria-selected="false"] .tab-badge {
  background: var(--primary);
  color: #fff;
}

.activity-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.activity-header .section-title {
  margin-bottom: 8px;
}

.activity-header .form-hint {
  margin: 0;
}

.activity-progress {
  position: relative;
  min-width: 120px;
  height: 22px;
  background: #eef2f7;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.activity-progress__bar {
  height: 100%;
  background: var(--primary);
  opacity: 0.85;
  transition: width 0.3s ease;
}

.activity-progress__label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
}

.portal-tabpanel {
  animation: portalTabIn 0.2s ease;
}

@keyframes portalTabIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.portal-tabs--single .portal-tabpanel {
  margin-top: 0;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.tool-card {
  background: var(--bg-white);
  border: 2px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
  display: block;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  position: relative;
}

.tool-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px var(--shadow-hover);
  border-color: var(--primary);
}

.tool-card.protected {
  border-color: #ff9800;
}

.tool-card.protected:hover {
  border-color: #f57c00;
}

.tool-card.external::after {
  content: '↗';
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 1.2rem;
  color: var(--text-light);
}

.tool-icon {
  font-size: 2rem;
  margin-bottom: 15px;
  display: block;
}

.tool-name {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  display: block;
}

.tool-description {
  font-size: 0.95rem;
  color: var(--text-light);
  line-height: 1.6;
  margin: 0;
}

.tool-url {
  display: block;
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 8px;
  font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
  opacity: 0.7;
  word-break: break-all;
}

.tool-card:hover .tool-url {
  opacity: 1;
  color: var(--primary);
}

.protected-badge {
  display: inline-block;
  background: #ff9800;
  color: white;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
  margin-top: 8px;
  font-weight: 600;
}

.uploaded-share-label {
  font-weight: 600;
  font-style: normal;
  font-size: 1.05rem;
  color: var(--text);
  margin: 0 0 10px 0;
}

.welcome-eyebrow {
  margin: 0 0 8px 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-light);
  text-align: center;
}

.welcome-title {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 15px 0;
  text-align: center;
}

.welcome-description {
  font-size: 1.1rem;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.7;
  text-align: center;
}

.tool-card.download {
  border-color: var(--primary);
}

.tool-card.download::after {
  content: '↓';
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 1.2rem;
  color: var(--primary);
}

.download-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  margin-top: 8px;
}

.tool-card.download:hover .download-badge {
  background: var(--primary-dark);
}

@media (max-width: 768px) {
  .div-center {
    padding: 1.5rem 2rem;
  }
  
  .logo {
    max-width: 180px;
  }
  
  .div-center h2, .div-center h3 {
    font-size: 1.3rem;
  }

  .otp-code {
    font-size: 1.5rem;
    letter-spacing: 2px;
  }
  
  .welcome-title {
    font-size: 1.8rem;
  }
  
  .welcome-description {
    font-size: 1rem;
  }
}
