:root {
  --bg: #f2f7f5;
  --card: #ffffff;
  --border: #cfdcd5;
  --text: #112017;
  --muted: #556a60;
  --accent: #1d7f5b;
  --accent-soft: #def4eb;
  --danger: #b9302a;
  --warning: #fff4db;
  --ink-dark: #0e1620;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d5f0e4 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 0%, #dcefff 0%, transparent 55%),
    var(--bg);
}

.container {
  width: min(1200px, 100% - 2rem);
  margin: 1.5rem auto 3rem;
  display: grid;
  gap: 1rem;
}

.hero {
  padding: 0.4rem 0;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3.2vw, 2.35rem);
}

.hero p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  box-shadow: 0 14px 30px rgba(17, 32, 23, 0.07);
}

.warning-card {
  background: var(--warning);
  border-color: #efce7f;
}

.card h2,
.card h3 {
  margin-top: 0;
}

.hint-text {
  margin-top: -0.35rem;
  margin-bottom: 0.8rem;
  color: #6b3a00;
}

.grid {
  display: grid;
  gap: 0.72rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.62rem 0.7rem;
  background: #fff;
}

button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 0.58rem 0.9rem;
  cursor: pointer;
}

button.secondary {
  border-color: #8a98a9;
  background: #fff;
  color: var(--text);
}

button.danger {
  border-color: var(--danger);
  background: var(--danger);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

.panel {
  margin-top: 0.5rem;
}

.inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.inline input {
  width: auto;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.full-row {
  grid-column: 1 / -1;
}

.upload-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px dashed #8a98a9;
  border-radius: 10px;
  padding: 0.42rem 0.6rem;
}

.upload-inline input {
  width: auto;
  border: 0;
  padding: 0;
}

.guide-list {
  margin: 0.9rem 0 0;
  padding-left: 1.1rem;
  color: #1d2d25;
}

.guide-list li {
  margin: 0.28rem 0;
}

.view-nav {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.nav-btn {
  border-radius: 999px;
  border: 1px solid #b9c8c0;
  background: #fff;
  color: #153027;
  padding: 0.55rem 0.85rem;
}

.nav-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #0f5740;
}

.view-pane {
  display: grid;
  gap: 1rem;
}

.stats-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.stat-box {
  border: 1px solid #d7e5de;
  border-radius: 12px;
  padding: 0.75rem;
  background: #fbfefc;
}

.stat-title {
  font-size: 0.82rem;
  color: var(--muted);
}

.stat-value {
  margin-top: 0.2rem;
  font-weight: 700;
  font-size: 1.06rem;
}

.dashboard-info {
  margin-top: 0.85rem;
  border-top: 1px dashed #d6dfdb;
  padding-top: 0.75rem;
}

.tabs {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 0.5rem 0.72rem;
  border-radius: 999px;
}

.tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #093f3a;
}

.workspace {
  margin-top: 0.9rem;
}

.warning-text {
  margin: 0.75rem 0;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: #fff4db;
  border: 1px solid #f2d48d;
}

.file-drop {
  border: 2px dashed #a9b3c0;
  border-radius: 12px;
  padding: 1rem;
  background: #fafdfc;
  text-align: center;
}

.file-drop.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.split-view {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.split-box {
  border: 1px solid #dce7e2;
  border-radius: 12px;
  padding: 0.75rem;
  background: #fcfefd;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.62rem;
}

.file-table th,
.file-table td {
  text-align: left;
  border-bottom: 1px solid #dce7e2;
  padding: 0.46rem;
  vertical-align: middle;
}

.file-buttons {
  display: flex;
  gap: 0.42rem;
  flex-wrap: wrap;
}

.file-table small {
  color: #5b7268;
  font-size: 0.75rem;
}

.folder-browser {
  margin-top: 0.95rem;
  border: 1px solid #dce7e2;
  border-radius: 12px;
  padding: 0.75rem;
  background: #fbfefc;
}

.browser-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

#browser-current-path {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  background: #e9f1ee;
  padding: 0.2rem 0.45rem;
  border-radius: 8px;
}

.folder-list {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.55rem;
}

.folder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
  border: 1px solid #deebe5;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: #fff;
}

.folder-name {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
}

.saved-domains {
  margin-top: 0.95rem;
  border: 1px solid #dce7e2;
  border-radius: 12px;
  padding: 0.75rem;
  background: #fcfffd;
}

.saved-domains h3 {
  margin-bottom: 0.55rem;
}

.saved-domain-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border: 1px solid #deebe5;
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  background: #fff;
  margin-bottom: 0.5rem;
}

.saved-domain-row small {
  display: block;
  color: #5b7268;
  margin-top: 0.15rem;
}

.preview-panel {
  margin-top: 0.95rem;
  border: 1px solid #dce7e2;
  border-radius: 12px;
  padding: 0.75rem;
  background: #fcfffd;
}

.preview-meta {
  margin-bottom: 0.45rem;
  font-size: 0.85rem;
  color: #27463a;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

#enc-selection-count {
  font-size: 0.84rem;
  color: #385f52;
}

.warn-mini {
  display: block;
  margin-top: 0.2rem;
  color: #8c5200;
}

.preview-stage {
  width: 100%;
  max-height: min(70vh, 560px);
  min-height: 180px;
  border-radius: 10px;
  border: 1px solid #dbe8e1;
  background: #0f1725;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-media {
  max-width: 100%;
  max-height: min(70vh, 560px);
  display: block;
}

.preview-media-image {
  width: auto;
  height: auto;
  object-fit: contain;
}

.preview-media-video {
  width: 100%;
  border-radius: 10px;
  border: 1px solid #dbe8e1;
  background: #0f1725;
  object-fit: contain;
}

.preview-frame {
  width: 100%;
  height: min(70vh, 560px);
  border: 1px solid #dbe8e1;
  border-radius: 10px;
  background: #fff;
}

.preview-text {
  margin: 0;
  max-height: min(70vh, 560px);
  overflow: auto;
  border: 1px solid #dbe8e1;
  border-radius: 10px;
  padding: 0.65rem;
  background: #fbfdfc;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.82rem;
  line-height: 1.35;
}

.status-card pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--ink-dark);
  color: #d4f7f1;
  border-radius: 10px;
  padding: 0.74rem;
  min-height: 90px;
}

@media (max-width: 760px) {
  .file-table {
    font-size: 0.84rem;
  }

  .file-buttons button,
  .actions button {
    padding: 0.46rem 0.55rem;
  }
}

/* Encryption info button inline with select */
.select-with-info {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.select-with-info select {
  flex: 1;
}

.info-btn {
  white-space: nowrap;
  padding: 0.58rem 0.7rem;
  font-size: 0.88rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 24, 16, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem;
  max-width: 660px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.28);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}

.modal-header h3 {
  margin: 0;
}

.modal-close-btn {
  padding: 0.42rem 0.8rem;
  font-size: 0.88rem;
}

.enc-profile-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
  margin-bottom: 0.75rem;
  background: #fbfefc;
}

.enc-profile-card.is-recommended {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.enc-profile-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.6rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
}

.enc-badge {
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

.enc-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.28rem 0.8rem;
  margin: 0;
  font-size: 0.88rem;
}

.enc-dl dt {
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.enc-dl dd {
  margin: 0;
}

.enc-note {
  margin: 0.6rem 0 0;
  font-size: 0.83rem;
  color: #3a5a4a;
  border-top: 1px solid #d4e8de;
  padding-top: 0.5rem;
}

.enc-autostart-box {
  border: 1px solid #c2d8cb;
  border-radius: 12px;
  padding: 0.9rem;
  margin-top: 0.5rem;
  background: #f3fbf7;
}

.enc-autostart-box h4 {
  margin: 0 0 0.5rem;
  font-size: 0.97rem;
}
