body {
    font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif;
    background: linear-gradient(135deg,#141e30,#243b55);
    color:#f4f4f4;
    margin:0;
}

header {
    padding:30px 20px 15px;
    text-align:center;
    background:rgba(0,0,0,0.3);
    position:relative;
}

header img {
    max-height:80px;
    margin-bottom:10px;
}

header h1 {
    margin:0;
    font-size:1.6rem;
    font-weight:bold;
    letter-spacing:2px;
}

.logout-btn {
    position:absolute;
    top:15px;
    right:20px;
}

.logout-btn button {
    padding:6px 14px;
    background:#ff4d4d;
    border:none;
    border-radius:20px;
    cursor:pointer;
    color:white;
    transition:0.3s;
}

.logout-btn button:hover {
    background:#ff1a1a;
}

.container {
    max-width:1000px;
    margin:30px auto;
    background:rgba(255,255,255,0.05);
    border-radius:15px;
    padding:20px;
    box-shadow:0 8px 20px rgba(0,0,0,0.4);
}

/* -------- LOGIN PANEL -------- */

.login-wrapper {
    display:flex;
    justify-content:center;
    align-items:center;
    min-height:400px;
}

.login-box {
    width:100%;
    max-width:420px;
    padding:40px;
    border-radius:20px;
    background:rgba(255,255,255,0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px); /* Safari support */
    box-shadow:0 15px 35px rgba(0,0,0,0.6);
    animation:fadeIn 0.6s ease;
}

@keyframes fadeIn {
    from { opacity:0; transform:translateY(20px); }
    to { opacity:1; transform:translateY(0); }
}

.login-box h2 {
    text-align:center;
    margin-bottom:25px;
    font-weight:600;
}

.login-box input {
    width:100%;
    padding:12px 15px;
    margin:10px 0;
    border-radius:12px;
    border:1px solid rgba(255,255,255,0.2);
    background:rgba(0,0,0,0.4);
    color:white;
    font-size:14px;
    transition:0.3s;
}

.login-box input:focus {
    outline:none;
    border-color:#00d4ff;
    box-shadow:0 0 10px #00d4ff66;
}

.login-box button {
    width:100%;
    padding:12px;
    margin-top:15px;
    border:none;
    border-radius:25px;
    background:linear-gradient(90deg,#00d4ff,#1affd5);
    font-weight:bold;
    cursor:pointer;
    transition:0.3s;
}

.login-box button:hover {
    transform:translateY(-2px);
    box-shadow:0 0 15px #00d4ff;
}

.error {
    background:rgba(255,0,0,0.1);
    border:1px solid rgba(255,0,0,0.3);
    padding:10px;
    border-radius:10px;
    text-align:center;
    margin-bottom:15px;
    color:#ff6b6b;
}

/* -------- FILE LIST -------- */

ul {
    list-style:none;
    padding:0;
}

li {
    background:rgba(255,255,255,0.1);
    margin:10px 0;
    padding:15px;
    border-radius:10px;
    display:flex;
    justify-content:space-between;
    align-items:center;
    flex-wrap:wrap;
    transition:0.3s;
}

li:hover {
    background:rgba(255,255,255,0.2);
    transform:translateY(-2px);
}

.file-name {
    font-weight:bold;
}

a {
    text-decoration:none;
    color:#00d4ff;
    font-weight:bold;
    transition:0.3s;
}

a:hover {
    color:#1affd5;
}

.info {
    font-size:0.9rem;
    color:#bbb;
}

/* -------- TABS -------- */

.tabs {
    display:flex;
    gap:10px;
    margin-bottom:25px;
    flex-wrap:wrap;
}

.tab {
    padding:10px 18px;
    border-radius:20px;
    text-decoration:none;
    background:rgba(255,255,255,0.1);
    color:#f4f4f4;
    transition:0.3s;
    font-weight:500;
}

.tab:hover {
    background:rgba(255,255,255,0.2);
}

.tab.active {
    background:linear-gradient(90deg,#00d4ff,#1affd5);
    color:#000;
    font-weight:bold;
}

/* -------- ADMIN ACTIONS IN TABS -------- */

.tab-wrap {
    display:flex;
    align-items:center;
    gap:8px;
}

.tab-menu, .tab-add {
    position:relative;
}

.tab-menu summary {
    list-style:none;
    cursor:pointer;
    user-select:none;
    padding:6px 10px;
    border-radius:14px;
    background:rgba(255,255,255,0.1);
    transition:0.3s;
}
.tab-menu summary:hover {
    background:rgba(255,255,255,0.2);
}
.tab-menu summary::-webkit-details-marker { display:none; }

.tab-add-btn {
    display:flex;
    align-items:center;
    justify-content:center;
    min-width:44px;
    padding:10px 14px;
}

.tab-form {
    position:absolute;
    top:46px;
    right:0;
    z-index:50;
    width:260px;
    padding:12px;
    border-radius:14px;
    background:rgba(0,0,0,0.65);
    border:1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    box-shadow:0 12px 30px rgba(0,0,0,0.5);
    display:flex;
    flex-direction:column;
    gap:8px;
}

.tab-form label {
    font-size:0.85rem;
    opacity:0.85;
}

.tab-form input, .tab-form select {
    width:100%;
    padding:10px 12px;
    border-radius:12px;
    border:1px solid rgba(255,255,255,0.2);
    background:rgba(0,0,0,0.35);
    color:#fff;
}

.tab-form button {
    width:100%;
    padding:10px;
    border:none;
    border-radius:14px;
    background:linear-gradient(90deg,#00d4ff,#1affd5);
    font-weight:bold;
    cursor:pointer;
}

.tab-form button.danger {
    background:#ff4d4d;
    color:#fff;
}
.tab-form button.danger:hover {
    background:#ff1a1a;
}

/* opcional: mensagens */
.success {
    background:rgba(0,255,120,0.10);
    border:1px solid rgba(0,255,120,0.25);
    padding:10px;
    border-radius:10px;
    margin-bottom:15px;
    color:#7CFFB2;
}

/* =========================
   File: css/styles.css
   4) ADICIONA/ATUALIZA estas regras (podes pôr no fim)
   ========================= */

.tab-item{
    position:relative;
    display:flex;
    align-items:center;
    gap:10px;
    padding:8px 10px;
    border-radius:22px;
    background:rgba(255,255,255,0.08);
    transition:0.3s;
}

.tab-item:hover{
    background:rgba(255,255,255,0.14);
}

.tab-item.active{
    background:linear-gradient(90deg,#00d4ff,#1affd5);
}

.tab-item.active .tab-link{
    color:#000;
    font-weight:bold;
}

.tab-link{
    display:inline-block;
    padding:6px 10px;
    border-radius:18px;
    color:#f4f4f4;
    text-decoration:none;
    font-weight:500;
    line-height:1;
}

.tab-actions{
    display:flex;
    gap:6px;
    margin-left:2px;
}

.tab-icon{
    border:none;
    background:rgba(0,0,0,0.25);
    color:#fff;
    cursor:pointer;
    padding:6px 8px;
    border-radius:14px;
    transition:0.2s;
    line-height:1;
}

.tab-icon:hover{
    transform:translateY(-1px);
    background:rgba(0,0,0,0.35);
}

.tab-icon.danger{
    background:rgba(255,77,77,0.25);
}

.tab-icon.danger:hover{
    background:rgba(255,77,77,0.4);
}

.tab-item.active .tab-icon{
    background:rgba(0,0,0,0.15);
    color:#000;
}
.tab-item.active .tab-icon.danger{
    background:rgba(255,77,77,0.25);
    color:#000;
}

.tab-popover{
    position:absolute;
    top:54px;
    right:0;
    z-index:50;
    display:none;
}

.tab-popover.open{
    display:block;
}

/* reaproveita o teu .tab-form (mantém) */
.tab-item.add .tab-link{
    background:rgba(255,255,255,0.1);
}

/* =========================
   UPLOAD (modal + botão) - adicionar no fim
   ========================= */

.toolbar{
    display:flex;
    justify-content:flex-end;
    margin: 0 0 14px 0;
}

.btn-upload{
    border:none;
    border-radius:22px;
    padding:10px 16px;
    cursor:pointer;
    font-weight:800;
    color:#000;
    background:linear-gradient(90deg,#00d4ff,#1affd5);
    box-shadow:0 10px 25px rgba(0,0,0,0.35);
    transition:0.25s;
}
.btn-upload:hover{
    transform:translateY(-1px);
    box-shadow:0 14px 30px rgba(0,0,0,0.45);
}

body.modal-open{
    overflow:hidden;
}

.modal{
    position:fixed;
    inset:0;
    display:none;
    z-index:200;
}
.modal.open{
    display:block;
}

.modal-backdrop{
    position:absolute;
    inset:0;
    background:rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
}

.modal-card{
    position:relative;
    width:min(720px, calc(100vw - 26px));
    margin: 8vh auto;
    border-radius:18px;
    background:rgba(255,255,255,0.08);
    border:1px solid rgba(255,255,255,0.12);
    box-shadow:0 20px 60px rgba(0,0,0,0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow:hidden;
    animation: modalIn 0.18s ease;
}
@keyframes modalIn{
    from { opacity:0; transform:translateY(10px) scale(0.98); }
    to { opacity:1; transform:translateY(0) scale(1); }
}

.modal-head{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:12px;
    padding:16px 16px 12px;
    background:rgba(0,0,0,0.22);
    border-bottom:1px solid rgba(255,255,255,0.10);
}

.modal-title{
    font-size:1.1rem;
    font-weight:900;
    letter-spacing:0.5px;
}
.modal-subtitle{
    font-size:0.86rem;
    opacity:0.8;
    margin-top:4px;
}

.icon-btn{
    border:none;
    background:rgba(0,0,0,0.25);
    color:#fff;
    cursor:pointer;
    padding:8px 10px;
    border-radius:14px;
    transition:0.2s;
    line-height:1;
}
.icon-btn:hover{
    background:rgba(0,0,0,0.35);
    transform:translateY(-1px);
}

.upload-form{
    padding:16px;
    display:flex;
    flex-direction:column;
    gap:12px;
}

.field-row{
    display:flex;
    gap:12px;
}
.field{
    display:flex;
    flex-direction:column;
    gap:8px;
    width:100%;
}
.field span{
    font-size:0.85rem;
    opacity:0.85;
}
.field select{
    width:100%;
    padding:12px 12px;
    border-radius:12px;
    border:1px solid rgba(255,255,255,0.2);
    background:rgba(0,0,0,0.35);
    color:#fff;
}

.dropzone{
    position:relative;
    display:flex;
    align-items:center;
    gap:12px;
    padding:16px;
    border-radius:16px;
    border:1px dashed rgba(255,255,255,0.25);
    background:rgba(0,0,0,0.28);
    cursor:pointer;
    transition:0.2s;
}
.dropzone:hover{
    background:rgba(0,0,0,0.34);
    border-color: rgba(0,212,255,0.55);
}
.dropzone.dragover{
    border-color: rgba(26,255,213,0.85);
    box-shadow:0 0 0 3px rgba(26,255,213,0.15);
}
.dropzone.has-file{
    border-style:solid;
    border-color: rgba(0,212,255,0.45);
}

.dz-icon{
    width:44px;
    height:44px;
    border-radius:14px;
    background:rgba(255,255,255,0.08);
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:1.2rem;
}
.dz-title{
    font-weight:800;
}
.dz-hint{
    opacity:0.8;
    margin-top:2px;
    font-size:0.9rem;
}

.file-input{
    position:absolute;
    inset:0;
    opacity:0;
    cursor:pointer;
}

.file-meta{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
}
.file-pill{
    display:flex;
    align-items:center;
    gap:8px;
    padding:10px 12px;
    border-radius:14px;
    background:rgba(255,255,255,0.08);
    border:1px solid rgba(255,255,255,0.10);
}
.file-pill .dot{
    opacity:0.55;
}
.link-btn{
    border:none;
    background:transparent;
    color:#00d4ff;
    cursor:pointer;
    font-weight:800;
}
.link-btn:hover{
    color:#1affd5;
}

.progress-wrap{
    padding:12px 12px;
    border-radius:14px;
    background:rgba(0,0,0,0.22);
    border:1px solid rgba(255,255,255,0.10);
}
.progress-top{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:10px;
    font-size:0.9rem;
    color:#ddd;
}
.progress-bar{
    height:10px;
    border-radius:999px;
    overflow:hidden;
    background:rgba(255,255,255,0.10);
}
.progress-fill{
    height:100%;
    width:0%;
    border-radius:999px;
    background:linear-gradient(90deg,#00d4ff,#1affd5);
    transition:width 0.1s linear;
}

.modal-actions{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    padding-top:4px;
}

.status{
    min-height:18px;
    font-size:0.9rem;
    opacity:0.9;
}
.status.info{ color:#ddd; }
.status.ok{ color:#7CFFB2; }
.status.err{ color:#ff6b6b; }

.actions-right{
    display:flex;
    gap:10px;
    align-items:center;
}

.btn-ghost{
    padding:10px 14px;
    border-radius:16px;
    border:1px solid rgba(255,255,255,0.18);
    background:rgba(0,0,0,0.22);
    color:#fff;
    cursor:pointer;
    transition:0.2s;
}
.btn-ghost:hover{
    background:rgba(0,0,0,0.32);
    transform:translateY(-1px);
}

.btn-primary{
    padding:10px 14px;
    border:none;
    border-radius:16px;
    font-weight:900;
    color:#000;
    cursor:pointer;
    background:linear-gradient(90deg,#00d4ff,#1affd5);
    transition:0.2s;
}
.btn-primary:disabled{
    opacity:0.5;
    cursor:not-allowed;
}
.btn-primary:not(:disabled):hover{
    transform:translateY(-1px);
    box-shadow:0 0 15px rgba(0,212,255,0.45);
}

/* =========================
   UPLOAD (modal + botão)
   ========================= */

.toolbar{
    display:flex;
    justify-content:flex-end;
    margin: 0 0 14px 0;
}

.btn-upload{
    border:none;
    border-radius:22px;
    padding:10px 16px;
    cursor:pointer;
    font-weight:800;
    color:#000;
    background:linear-gradient(90deg,#00d4ff,#1affd5);
    box-shadow:0 10px 25px rgba(0,0,0,0.35);
    transition:0.25s;
}
.btn-upload:hover{
    transform:translateY(-1px);
    box-shadow:0 14px 30px rgba(0,0,0,0.45);
}

body.modal-open{ overflow:hidden; }

.modal{
    position:fixed;
    inset:0;
    display:none;
    z-index:200;
}
.modal.open{ display:block; }

.modal-backdrop{
    position:absolute;
    inset:0;
    background:rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
}

.modal-card{
    position:relative;
    width:min(720px, calc(100vw - 26px));
    margin: 8vh auto;
    border-radius:18px;
    background:rgba(255,255,255,0.08);
    border:1px solid rgba(255,255,255,0.12);
    box-shadow:0 20px 60px rgba(0,0,0,0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow:hidden;
    animation: modalIn 0.18s ease;
}
@keyframes modalIn{
    from { opacity:0; transform:translateY(10px) scale(0.98); }
    to { opacity:1; transform:translateY(0) scale(1); }
}

.modal-head{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:12px;
    padding:16px 16px 12px;
    background:rgba(0,0,0,0.22);
    border-bottom:1px solid rgba(255,255,255,0.10);
}

.modal-title{ font-size:1.1rem; font-weight:900; letter-spacing:0.5px; }
.modal-subtitle{ font-size:0.86rem; opacity:0.8; margin-top:4px; }

.icon-btn{
    border:none;
    background:rgba(0,0,0,0.25);
    color:#fff;
    cursor:pointer;
    padding:8px 10px;
    border-radius:14px;
    transition:0.2s;
    line-height:1;
}
.icon-btn:hover{
    background:rgba(0,0,0,0.35);
    transform:translateY(-1px);
}

.upload-form{
    padding:16px;
    display:flex;
    flex-direction:column;
    gap:12px;
}

.field-row{ display:flex; gap:12px; }
.field{ display:flex; flex-direction:column; gap:8px; width:100%; }
.field span{ font-size:0.85rem; opacity:0.85; }
.field select{
    width:100%;
    padding:12px 12px;
    border-radius:12px;
    border:1px solid rgba(255,255,255,0.2);
    background:rgba(0,0,0,0.35);
    color:#fff;
}

.dropzone{
    position:relative;
    display:flex;
    align-items:center;
    gap:12px;
    padding:16px;
    border-radius:16px;
    border:1px dashed rgba(255,255,255,0.25);
    background:rgba(0,0,0,0.28);
    cursor:pointer;
    transition:0.2s;
}
.dropzone:hover{
    background:rgba(0,0,0,0.34);
    border-color: rgba(0,212,255,0.55);
}
.dropzone.dragover{
    border-color: rgba(26,255,213,0.85);
    box-shadow:0 0 0 3px rgba(26,255,213,0.15);
}
.dropzone.has-file{
    border-style:solid;
    border-color: rgba(0,212,255,0.45);
}

.dz-icon{
    width:44px;
    height:44px;
    border-radius:14px;
    background:rgba(255,255,255,0.08);
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:1.2rem;
}
.dz-title{ font-weight:800; }
.dz-hint{ opacity:0.8; margin-top:2px; font-size:0.9rem; }

.file-input{
    position:absolute;
    inset:0;
    opacity:0;
    cursor:pointer;
}

.file-meta{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
}
.file-pill{
    display:flex;
    align-items:center;
    gap:8px;
    padding:10px 12px;
    border-radius:14px;
    background:rgba(255,255,255,0.08);
    border:1px solid rgba(255,255,255,0.10);
}
.file-pill .dot{ opacity:0.55; }

.link-btn{
    border:none;
    background:transparent;
    color:#00d4ff;
    cursor:pointer;
    font-weight:800;
}
.link-btn:hover{ color:#1affd5; }

.progress-wrap{
    padding:12px 12px;
    border-radius:14px;
    background:rgba(0,0,0,0.22);
    border:1px solid rgba(255,255,255,0.10);
}
.progress-top{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:10px;
    font-size:0.9rem;
    color:#ddd;
}
.progress-bar{
    height:10px;
    border-radius:999px;
    overflow:hidden;
    background:rgba(255,255,255,0.10);
}
.progress-fill{
    height:100%;
    width:0%;
    border-radius:999px;
    background:linear-gradient(90deg,#00d4ff,#1affd5);
    transition:width 0.1s linear;
}

.modal-actions{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    padding-top:4px;
}

.status{ min-height:18px; font-size:0.9rem; opacity:0.9; }
.status.info{ color:#ddd; }
.status.ok{ color:#7CFFB2; }
.status.err{ color:#ff6b6b; }

.actions-right{
    display:flex;
    gap:10px;
    align-items:center;
}

.btn-ghost{
    padding:10px 14px;
    border-radius:16px;
    border:1px solid rgba(255,255,255,0.18);
    background:rgba(0,0,0,0.22);
    color:#fff;
    cursor:pointer;
    transition:0.2s;
}
.btn-ghost:hover{
    background:rgba(0,0,0,0.32);
    transform:translateY(-1px);
}

.btn-primary{
    padding:10px 14px;
    border:none;
    border-radius:16px;
    font-weight:900;
    color:#000;
    cursor:pointer;
    background:linear-gradient(90deg,#00d4ff,#1affd5);
    transition:0.2s;
}
.btn-primary:disabled{ opacity:0.5; cursor:not-allowed; }
.btn-primary:not(:disabled):hover{
    transform:translateY(-1px);
    box-shadow:0 0 15px rgba(0,212,255,0.45);
}

/* =========================
   FILE OPTIONS (⋯ menu)
   ========================= */

.file-item{
    position:relative;
}

.file-left{
    display:flex;
    align-items:center;
    gap:10px;
    min-width: 280px;
}

.file-actions{
    position:relative;
    display:flex;
    align-items:center;
}

.file-menu-btn{
    border:none;
    background:rgba(0,0,0,0.25);
    color:#fff;
    cursor:pointer;
    padding:6px 10px;
    border-radius:14px;
    transition:0.2s;
    line-height:1;
    font-weight:900;
}

.file-menu-btn:hover{
    transform:translateY(-1px);
    background:rgba(0,0,0,0.35);
}

.file-popover{
    right:0;
    top:40px;
}

.file-form{
    width:300px;
}

.file-form-title{
    font-weight:900;
    letter-spacing:0.3px;
    margin-bottom:6px;
}

.file-subform{
    display:flex;
    flex-direction:column;
    gap:8px;
}

.file-divider{
    height:1px;
    background:rgba(255,255,255,0.10);
    margin:10px 0;
}

/* =========================
   FIX: FILE OPTIONS layout
   ========================= */

/* garante referência correta */
.file-actions { position: relative; }

/* o popover (wrapper) é absolute */
.file-popover{
  position:absolute;
  top:42px;
  right:0;
  left:auto;
  z-index:120;
  display:none;
}

/* quando abre */
.file-popover.open{ display:block; }

/* IMPORTANTÍSSIMO: o conteúdo NÃO pode ser absolute */
.file-popover .file-form{
  position:static !important;
  top:auto !important;
  right:auto !important;

  width:min(340px, calc(100vw - 24px));
  padding:14px;
  border-radius:16px;

  background:rgba(0,0,0,0.70);
  border:1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:0 18px 45px rgba(0,0,0,0.60);
}

/* inputs/selects dentro do menu */
.file-popover input,
.file-popover select{
  width:100%;
  box-sizing:border-box;
}

/* separador */
.file-divider{
  height:1px;
  background:rgba(255,255,255,0.10);
  margin:12px 0;
}

/* melhora alinhamento do item */
.file-item{
  gap:12px;
}

/* evita quebrar o nome e empurrar tudo */
.file-name{
  max-width:520px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* deixa a parte do "info" sempre alinhada à direita */
.file-item .info{
  margin-left:auto;
  white-space:nowrap;
}

/* mobile: o info vai para baixo */
@media (max-width: 720px){
  .file-left{ min-width:0; }
  .file-item .info{ width:100%; margin-left:0; margin-top:10px; white-space:normal; }
  .file-name{ max-width:100%; }
  .file-popover{ right:0; left:0; }
}