:root {
  --black: #000;
  --white: #fff;
  --gray-line: #ddd;
  --gray-text: #555;
  --gray-bg: #f5f5f5;
  --radius: 2px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--white);
  color: var(--black);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.hidden { display: none !important; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 2px solid var(--black);
}

.brand {
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
  font-size: 1.1rem;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--gray-text);
}

/* App layout */
.app {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

.view-auth {
  display: flex;
  justify-content: center;
  padding-top: 3rem;
}

.card {
  width: 100%;
  max-width: 380px;
  border: 2px solid var(--black);
  padding: 2rem;
  border-radius: var(--radius);
}

.card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
}

.muted { color: var(--gray-text); font-size: 0.9rem; }

form label {
  display: block;
  margin: 1rem 0 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
}

input[type="text"],
input[type="tel"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1.5px solid var(--black);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--white);
  color: var(--black);
}

input:focus {
  outline: 2px solid var(--black);
  outline-offset: 1px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border: 1.5px solid var(--black);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--black);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.btn:hover { background: var(--black); color: var(--white); }

.btn-primary {
  background: var(--black);
  color: var(--white);
}
.btn-primary:hover { background: var(--white); color: var(--black); }

.btn-block { width: 100%; margin-top: 1.25rem; }

.btn-secondary { background: var(--white); color: var(--black); }

.btn-ghost {
  border-color: var(--gray-line);
  color: var(--gray-text);
}
.btn-ghost:hover { background: var(--gray-bg); color: var(--black); border-color: var(--black); }

.btn-link {
  background: none;
  border: none;
  color: var(--black);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
}

.row-links {
  display: flex;
  justify-content: space-between;
  margin-top: 1.25rem;
}

.msg {
  min-height: 1.2em;
  font-size: 0.88rem;
  margin: 0.75rem 0 0;
}
.msg.error { color: #b00000; }
.msg.success { color: #006400; }

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--black);
  margin-bottom: 1.25rem;
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.7rem 1.2rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--gray-text);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}

.tab-btn.active {
  color: var(--black);
  border-bottom: 3px solid var(--black);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

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

.breadcrumb {
  font-size: 0.9rem;
  font-weight: 600;
  word-break: break-all;
}
.breadcrumb .crumb {
  cursor: pointer;
  text-decoration: underline;
}
.breadcrumb .sep { margin: 0 0.3rem; color: var(--gray-text); }

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

.file-input-label { position: relative; overflow: hidden; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1.5px solid var(--black); border-radius: var(--radius); }

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

.data-table th, .data-table td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--gray-line);
  white-space: nowrap;
}

.data-table th {
  background: var(--black);
  color: var(--white);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table tbody tr:hover { background: var(--gray-bg); }
.data-table tbody tr:last-child td { border-bottom: none; }

.name-cell { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.name-cell.is-dir { font-weight: 600; }

.row-actions { display: flex; gap: 0.5rem; justify-content: flex-end; }
.row-actions button {
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.82rem;
  padding: 0.2rem 0.3rem;
  color: var(--black);
}
.row-actions button.danger { color: #b00000; }

/* Info / client details */
.ftp-info {
  margin-top: 1.5rem;
  border: 1.5px solid var(--black);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}
.ftp-info summary {
  cursor: pointer;
  font-weight: 600;
}
.info-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1rem;
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}
.info-list dt { color: var(--gray-text); }
.info-list dd { margin: 0; }

/* Forms */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.75rem;
}
.inline-form input { width: auto; flex: 1 1 160px; }
.at-domain { color: var(--gray-text); font-weight: 600; }

h2 { font-size: 1.05rem; margin: 2rem 0 0.25rem; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 10;
}
.modal-box {
  background: var(--white);
  border: 2px solid var(--black);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 420px;
}
.modal-box h2 { margin-top: 0; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

/* Responsive */
@media (max-width: 640px) {
  .app { padding: 1rem; }
  .topbar { padding: 0.85rem 1rem; }
  .brand { font-size: 0.95rem; }
  .data-table th:nth-child(3), .data-table td:nth-child(3) { display: none; }
  .card { padding: 1.5rem; }
  .inline-form input { flex: 1 1 100%; }
}
